Jake
Jake

Reputation: 145

How to access next candles data in tradingview by using pine script

How to access next candles data in trading view by using pine script. For example access historical close price in pine we use close[1],close[2],close[3],close[4],close[5] what I am looking for is opposite of this.

For me to test efficiency of strategy need to find candles close price which hit target without hitting stop lose. For example how to find a entry candle whose close price will rise up 5% without hit 2% stop loss for long position and down 5% without hit 2% stop loss for short position.

Upvotes: 0

Views: 957

Answers (1)

vitruvius
vitruvius

Reputation: 21332

You cannot access future data.

You should start from somewhere and see what happens after that candle.

In your case, if close[5] is your entry, then close[4], is your "next" candle.

So, figure out where your entry is, then start your calculations after that candle.

Upvotes: 0

Related Questions