Reputation: 9
I was wondering, are there any functions to analyze historical trades in the back tests on PineScript? in the Strategy Tester Tab we are able to look at trade history, but how can I access the values of indicators at each trades entry point? For example for trade #1 in the trade history , how can extract the value of the RSI or any other indicator for the matter for all trades in the sample history?
thanks in advance!
Upvotes: 0
Views: 148
Reputation: 21121
The easiest way would be plotting some data and going there with your mouse.
You can use some of the debugging techniques explained here.
If you don't want to see something on your chart or cannot plot it on your chart for any reason, you can use the plotchar()
and then check the value in the data window.
//@version=5
strategy("My strategy", overlay=true, margin_long=100, margin_short=100)
rsi_val = ta.rsi(close, 14)
longCondition = (rsi_val < 20)
shortCondition = (rsi_val > 80)
if (longCondition)
strategy.entry("My Long Entry Id", strategy.long)
if (shortCondition)
strategy.entry("My Short Entry Id", strategy.short)
plotchar(rsi_val, "RSI", "")
Upvotes: 0