Pine Script

Few ways to close/exit positions in Pine Script

Pine Script

Displaying Pine Script indicator overlaying the price or in a separate chart.

Depending on the type of your indicator, you might want to plot it on top of your price or in a separate pane. If your indicator has the same scale as your data, you might want it to display on top, for example, BB, SMA, or Ichimoku cloud. If the scale is completely different, you Displaying Pine Script indicator overlaying the price or in a separate chart. Read More →

How to concatenate strings in Pine Script

String concatenation is the main string feature in any programming language. It allows multiple strings to be joined together to form one larger string. This is used in many programming languages to create more complicated strings. String concatenation can be used to combine strings of different lengths, as well as to concatenate strings of text and numerical data.

How to loop/iterate through an array in Pine Script with a “for/in” statement

Arrays are pretty crucial for Pine Script. From the time of their release, it immediately became Pine’s essential feature. Some time ago, I published an article about how to loop through an array in Pine Script. But language evolves quite quickly, and there is already a much more convenient way to iterate through an array. How to loop/iterate through an array in Pine Script with a “for/in” statement Read More →

Pine Script Strategy trading at specific days of the week.

In this article, I’m showing how to work with days of the week in Pine Script and an example of a simple strategy built with only days of the week signals. To know the current day of the week, I’m using “dayofweek()” function. It outputs numbers from 1 to 7 depending on the day of the week. Be careful with the values, 1 is Sunday, and 7 is Saturday here.

Add a parameter to allow Pine Script Strategy to be long or short.

Trading strategies can vary greatly when applied to long and short positions. So traders might want to use different parameters for both sides. Furthermore, traders may develop different strategies for managing risk when taking a long or short position. By understanding the differences in strategies for long and short sides, traders can make informed decisions Add a parameter to allow Pine Script Strategy to be long or short. Read More →