Pine Script

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

Pine Script

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 →

Backtesting Pine Script Strategies on entire history with Deep Backtesting

If you backtest a lot of strategies in TradingView you most likely know that that TradingView is a bit limited in terms of backtesting. If you run backtest in a standard way you get your backtest computed on the last ~ 20k bars only for the most expensive account. And that’s not enought for majority Backtesting Pine Script Strategies on entire history with Deep Backtesting Read More →

Adding a dynamic filter to Pine Script strategies.

Quite often your strategies in TradingView will be complicated and will have multiple conditions at once. You might want to check if certain conditions work or not for your strategy. It’s a good idea to create a checkbox in your parameter that switch on/off certain filters. In this article, I’ll show you a simple example Adding a dynamic filter to Pine Script strategies. Read More →

The `when` parameter will be deprecated in future Pine versions. How to fix it?

Just recently you might start to see the following warnings in Tradingview : line 12: The `when` parameter will be deprecated in future Pine versions. We recommend using `if` or `switch` conditional blocks instead This is happening when you’re using “when” parameter in any strategy.* functions. For example, following code will produce 2 warnings for The `when` parameter will be deprecated in future Pine versions. How to fix it? Read More →