---
title: "How to Create On Off Columns in Pine Script - CloudBlast"
description: "How to Create On Off Columns in Pine Script"
url: "https://cloudblast.io/article/How-to-Create-On-Off-Columns-in-Pine-Script"
language: "en-US"
---

BLOG

# How to Create On Off Columns in Pine Script

5€ FREE BALANCE when you register

Register to cloudblast and get 5€ cloud credit to deploy your VPS's

[Claim Free 5€](https://console.cloudblast.io/auth/login?ref=2)

-   [Back](https://cloudblast.io/)
-   [All Articles](https://cloudblast.io/blog)

2024-09-25

### How to Create On Off Columns in Pine Script

tutorials

[Add as a preferred source on Google](https://www.google.com/preferences/source?q=cloudblast.io)

Pine Script, the scripting language used by TradingView, allows traders to create custom indicators and strategies. One useful feature is the ability to create on/off columns, which can help visualize binary states or conditions directly on your chart. This article will guide you through the process of implementing on/off columns in Pine Script.

**Understanding On/Off Columns**

On/off columns are essentially visual indicators that toggle between two states, often represented by different colors or symbols. These can be used to indicate conditions such as buy/sell signals, active/inactive states, or any binary condition relevant to your trading strategy.

**Implementing On/Off Columns in Pine Script**

To create on/off columns in Pine Script, you can use the `plotshape()` function, which allows you to plot shapes on the chart based on certain conditions. Here’s a basic example:

> indicator("On/Off Columns Example", overlay=true) // Define a condition for the on/off state onCondition = close > open // Plot a shape when the condition is true (on state) plotshape(series=onCondition, location=location.abovebar, color=color.green, style=shape.triangledown, size=size.small) // Plot a shape when the condition is false (off state) plotshape(series=not onCondition, location=location.belowbar, color=color.red, style=shape.triangleup, size=size.small)

In this example, the script checks if the closing price is greater than the opening price. If true, it plots a green triangle above the bar, indicating the "on" state. If false, it plots a red triangle below the bar, indicating the "off" state.

**Customizing Your Columns**

You can customize the appearance of your on/off columns by adjusting the parameters of the `plotshape()` function. Options include changing the shape style, size, and color to better fit your chart's design and your personal preferences.

**Conclusion**

Creating on/off columns in Pine Script is a straightforward process that enhances the visual representation of binary conditions on your TradingView charts. By using the `plotshape()` function, you can effectively communicate important signals and states, aiding in better decision-making for your trading strategies.

Share

## Continue Reading

[2026-07-25 How to Install and Set Up Mailcow on Ubuntu and Debian VPS tutorials](https://cloudblast.io/article/how-to-install-and-setup-mailcow-on-ubuntu-and-debian-vps)

[2026-07-25 How to Install Chatwoot on the Latest Ubuntu and Debian Server tutorials](https://cloudblast.io/article/how-to-install-chatwoot-on-ubuntu-and-debian-server)

[2026-07-25 How to Install Mattermost on the Latest Ubuntu and Debian Server tutorials](https://cloudblast.io/article/how-to-install-mattermost-on-ubuntu-and-debian-server)

[2026-07-25 How to Install RustDesk on the Latest Ubuntu and Debian Server tutorials](https://cloudblast.io/article/how-to-install-rustdesk-on-ubuntu-and-debian-server)
