I’m trying to calculate what the value of RSI[2] would be if on the next bar price had dropped to a certain value.
I’ve tried several ideas but nothing seems to return the correct values. Anyone know how to do this?
You can try to reverse engineer the RSI or start from this version: RSI Reverse Engineering indicator
I’ve reverse engineered the reverse engineered RSI indicator!… and I think I have something that works. In this code the value for RSI2 is returned if price is at the Average[2](Low).
My plan was to have RSI2 based position sizing and buy on a pending order if price fell to the Average[2](low) so hopefully this can now be done. I’m sure there is most likely a more elegant solution to find this info but I’ll use this until someone else can tell me what that solution is.
RSIPeriod = 2
for i = 0 to 10000
RSIRevValue = i/100
REM Original RSI values
RSIOri = RSI[RSIPeriod](close)
UPOri = MAX(0, close - open) //higher close then previous
DOWNOri = MAX(0, open - close) //lower close then previous
upMAOri = wilderAverage[RSIPeriod](UPOri)
downMAOri = wilderAverage[RSIPeriod](DOWNOri)
REM Reversed Engineered RSI Value to Price
RSRev = (100/((-1*RSIRevValue)+100))-1
if RSIRevValue < RSIOri THEN
upMARev = upMAOri*(1-(1/RSIPeriod))
downMARev = upMARev/RSRev
DOWNRev = (downMARev - (downMAOri * (1-(1/RSIPeriod))))/(1/RSIPeriod)
RSIPriceRev = close - DOWNRev
elsif RSIRevValue > RSIOri THEN
downMARev = downMAOri*(1-(1/RSIPeriod))
upMARev = downMARev*RSRev
UPRev = (upMARev - (upMAOri * (1-(1/RSIPeriod))))/(1/RSIPeriod)
RSIPriceRev = close + UPRev
endif
if RSIPriceRev >= average[2](low) then
myRSI = RSIRevValue
break
endif
next
//Dummy Trade
if average[2] = -1 then
buy at market
endif
graph myRSI
[attachment file=”81268″]