in pine-script in DCA strategy between two strategy.entry determining candle range

Viewed 24

In pine script V5, our DCA strategy is opening long positions by too close candles.

As opening new position after last position, I want to determine the ranges among candles. For instance, after providing ten candles circumstance, it must be able to open new positions.

Waiting for your help.. Best Regards..

1 Answers

You can save to an int (let's say entryIndex) the bar_index when opening a deal, and afterwards check

if (bar_index - entryIndex >= 10)
Related