I hope I'm missing something because I'd really like to get this to work such that my 1min and 5min charts return matching rsi values.
When I first load or re-load my efs study on a 1min chart, the following (edited) code snippet:
if( bInit == false ) {
xRSI = rsi( 14, inv( 5 ));
bInit = true;
}
nRSI = xRSI.getValue(0);
returns rsi values which correspond exactly to those on a 5min chart which uses a simple rsi(14) with no inv() function.
That is to say that the xRSI = rsi( 14, inv(5)) function on the 1 min chart returns a constant RSI across each group of 5 bars; and this value exactly matches the single corresponding rsi value on the 5min chart. Sounds right to me.
So far, so good, but when I then run this same pair of charts in real-time or tick replay mode then the 1min chart's rsi( 14, inv(5)) function begins to do two things I don't understand.
1) It begins to plot an rsi which changes each bar instead of every 5 bars. (If I then reload the 1min chart these new rsi values clean up like those from before the chart was last reloaded.)
2) None of the bars have an rsi which matches the rsi of the 5min chart.
I think I can code around (1) using a global value (declared outside main & pre-main) for nRSI and controlling when I update it.
But (2) has me stuck completely since it never returns an nRSI value which matches the 5min chart.
Help is much appreciated, thanks.
When I first load or re-load my efs study on a 1min chart, the following (edited) code snippet:
if( bInit == false ) {
xRSI = rsi( 14, inv( 5 ));
bInit = true;
}
nRSI = xRSI.getValue(0);
returns rsi values which correspond exactly to those on a 5min chart which uses a simple rsi(14) with no inv() function.
That is to say that the xRSI = rsi( 14, inv(5)) function on the 1 min chart returns a constant RSI across each group of 5 bars; and this value exactly matches the single corresponding rsi value on the 5min chart. Sounds right to me.
So far, so good, but when I then run this same pair of charts in real-time or tick replay mode then the 1min chart's rsi( 14, inv(5)) function begins to do two things I don't understand.
1) It begins to plot an rsi which changes each bar instead of every 5 bars. (If I then reload the 1min chart these new rsi values clean up like those from before the chart was last reloaded.)
2) None of the bars have an rsi which matches the rsi of the 5min chart.
I think I can code around (1) using a global value (declared outside main & pre-main) for nRSI and controlling when I update it.
But (2) has me stuck completely since it never returns an nRSI value which matches the 5min chart.
Help is much appreciated, thanks.
Comment