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

Postby Dan122 » 17 Oct 2012

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

User avatar
TJ
Posts: 6518
Joined: 29 Aug 2006
Location: Global Citizen
Has thanked: 957 times
Been thanked: 1883 times

Re: Price from a given RSI

Postby TJ » 17 Oct 2012

Dan122 wrote: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)
please see
EasyLanguage Functions & Reserved Words Reference
https://www.multicharts.com/multicharts/ ... mentation/
These users thanked the author TJ for the post:
Andrew MultiCharts

Dan122
Posts: 9
Joined: 10 May 2012
Has thanked: 1 time
Been thanked: 3 times

Re: Price from a given RSI  [SOLVED]

Postby Dan122 » 19 Oct 2012

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.

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");
Cheers
Daniel
These users thanked the author Dan122 for the post (total 2):
TJsegut

segut
Posts: 14
Joined: 01 Nov 2012
Has thanked: 5 times

Re: Price from a given RSI

Postby segut » 01 Nov 2012

Thanks for the code.


Return to “MultiCharts”