Different RSI Calc between RSI Indicator and RSI Function

Questions about MultiCharts .NET and user contributed studies.
3strategy
Posts: 22
Joined: 31 Dec 2014
Has thanked: 2 times
Been thanked: 1 time

Different RSI Calc between RSI Indicator and RSI Function

Postby 3strategy » 05 Jan 2015

The output of the RSI Function is different from the output of the RSI Indicator.
How can this be?

Code: Select all

protected override void Create(){
RSI = (Indicator.RSI)AddIndicator("RSI");
RsiF = new Function.RSI(this, 0);
///...
}
protected override void StartCalc() // assign inputs
{
RSI.length = 28;
RsiF.price = Bars.Close;
RsiF.length= 28;
}
protected override void CalcBar(){
R = Math.Round(RSI.Plots[0].Values[0],1);
Rf = Math.Round(RsiF.Value,1);
if (Rf < 60)
{
if(!LongLimitOn)//define price just once.
{
LongLimitOn=true;
P = Math.Round(Bars.Close[0]-20,0);
FlagTime = Bars.Time[0];
}
Output.WriteLine(Bars.Time[0] + " since "+ FlagTime + " sending @: "+P+" \tRSIf:" + Rf + " \tRSI:" + R+", Close="+Bars.Close[0]);
bLimit.Send("R<50@"+P +"/Openned "+FlagTime.ToShortTimeString() , P, 1);
}
}

User avatar
JoshM
Posts: 2195
Joined: 20 May 2011
Location: The Netherlands
Has thanked: 1544 times
Been thanked: 1565 times
Contact:

Re: Different RSI Calc between RSI Indicator and RSI Functio

Postby JoshM » 05 Jan 2015

Did you use the same MaxBarsBack value for the above code and the regular RSI indicator?

3strategy
Posts: 22
Joined: 31 Dec 2014
Has thanked: 2 times
Been thanked: 1 time

Re: Different RSI Calc between RSI Indicator and RSI Functio

Postby 3strategy » 06 Jan 2015

The code includes both the RSI and the RSI function in the same code (R gets the indicator's value, and Rf gets the function's value). So I assume it's the same length, unless I'm missing something.

User avatar
Henry MultiСharts
Posts: 9165
Joined: 25 Aug 2011
Has thanked: 1264 times
Been thanked: 2957 times

Re: Different RSI Calc between RSI Indicator and RSI Functio

Postby Henry MultiСharts » 12 Jan 2015

This issue has been confirmed. The fix is targeted to MultiCharts .NET 9.1 Beta1.


Return to “MultiCharts .NET”