Does anyone have the code to calculate the price from a given two bars RSI value?
It probably showed up in this forum but I couldn’t find it.
Thanks
Daniel
Price from a given RSI [SOLVED]
- TJ
- Posts: 7743
- Joined: 29 Aug 2006
- Location: Global Citizen
- Has thanked: 1033 times
- Been thanked: 2222 times
Re: Price from a given RSI
It will be the same code as the regular RSI. Just set the period to 2.Does anyone have the code to calculate the price from a given two bars RSI value?
It probably showed up in this forum but I couldn’t find it.
Thanks
Daniel
From your PowerLanguage Editor,
File > Open
select Function > RSI
For explanation and usage examples of RSI (Function)
please see
EasyLanguage Functions & Reserved Words Reference
https://www.multicharts.com/multicharts ... mentation/
Re: Price from a given RSI [SOLVED]
Thanks for your answer Andrew.
I wasn´t clear about the question. Suppose I have the closing price of the previous day, and I want a RSI value of 10. What will the price that corresponds to that value? I don´t think it´s possible to set this kind of reverse approach with multiple bars RSI, but with just 2 bars it is possible.
I wrote the code below and apparently it works.
Cheers
Daniel
I wasn´t clear about the question. Suppose I have the closing price of the previous day, and I want a RSI value of 10. What will the price that corresponds to that value? I don´t think it´s possible to set this kind of reverse approach with multiple bars RSI, but with just 2 bars it is possible.
I wrote the code below and apparently it works.
Code: Select all
Input: RSIValue (1);
vars:change(0),gain(0),loss(0),avggain(0),avgloss(0),RS_Value(0),NEEDEDLOSS(0),RSIENTRY(0);
change = C[0]- C[1];
if change<0 then loss= absvalue (change) else loss=0;
if change>0 then gain=change else gain=0;
avggain=(avggain[1]+gain)/2;
avgloss=(avgloss[1]+loss)/2;
//RS from RSI
RS_Value=(-100 /(RSIValue-100))-1;
// how much it needs to fall
//the price should be fallen to get the right values
NEEDEDLOSS = (avggain/RS_value)-avgloss;
RSIENTRY = c-NEEDEDLOSS;
plot1 (change,"change");
Plot2 (gain, "GAIN");
plot3 (loss, "LOSS");
Plot4 (avggain, "AVGGAIN");
Plot5 (avgloss, "AVGLOSS");
Plot6 (RS_Value,"RS_VALUE");
Plot7 (NEEDEDLOSS,"NEEDEDLOSS");
plot8 (RSIENTRY,"RSIENTRY");
Daniel