Price from a given RSI  [SOLVED]

Questions about MultiCharts and user contributed studies. Dan122
Posts: 9
Joined: 10 May 2012
Has thanked: 1 time
Been thanked: 3 times

Price from a given RSI

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

TJ
Posts: 7210
Joined: 29 Aug 2006
Location: Global Citizen
Has thanked: 991 times
Been thanked: 2052 times

Re: Price from a given RSI

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
It will be the same code as the regular RSI. Just set the period to 2.

From your PowerLanguage Editor,

File > Open

select Function > RSI

For explanation and usage examples of RSI (Function)
EasyLanguage Functions & Reserved Words Reference
https://www.multicharts.com/multicharts ... mentation/ Dan122
Posts: 9
Joined: 10 May 2012
Has thanked: 1 time
Been thanked: 3 times

Re: Price from a given RSI  [SOLVED]

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- C;
if change<0 then loss= absvalue (change) else loss=0;
if change>0 then gain=change else gain=0;
avggain=(avggain+gain)/2;
avgloss=(avgloss+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");
Cheers
Daniel segut
Posts: 14
Joined: 01 Nov 2012
Has thanked: 5 times

Re: Price from a given RSI

Thanks for the code.