StochRSI

Questions about MultiCharts .NET and user contributed studies.
joanricard
Posts: 3
Joined: 03 May 2015

StochRSI

Postby joanricard » 03 May 2015

I am trying to implement a StochRSI in MC.NET
(https://www.multicharts.com/support/bas ... le&id=1185)
but my knowledge of C# are poor. Despite (https: // www .multicharts.com / downloads / MultiCharts.NET-ProgrammingGuide-v1.1.pdf) & (https://www.multicharts.com/trading-sof ... _Indicator).

How I can calculate the maximum or minimum value in a period of RSI indicator (other period)?? There is a direct function or have to make a loop every calc bar?

Thanks in advance

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

Re: StochRSI

Postby Henry MultiСharts » 04 May 2015

Hello joanricard,

You can use the Highest, Lowest prebuilt functions. Here is how to find the bar number of the function.

joanricard
Posts: 3
Joined: 03 May 2015

Re: StochRSI

Postby joanricard » 04 May 2015

Henry,

Before your answer, I readed that link but I don't know to apply at something as this (note that I am not a programer and C# is too much for me):
I'm looking for the maximun value of 39 periods of RSI of 19 periods calculate on close price.

Code: Select all

highest[39](RSI[19](close))
Thanks in advance

joanricard
Posts: 3
Joined: 03 May 2015

Re: StochRSI

Postby joanricard » 06 May 2015

I've been writing this code and seems to work. I want to add some things to make it nice, but for now I would like someone to assure me that this is what I want to calculate (see post up). If so, now my goal is to make a strategy ...

Code: Select all

using System;
using System.Drawing;
using PowerLanguage.Function;

namespace PowerLanguage.Indicator
{
public class StochRSI_0 : IndicatorObject
{
private Function.RSI m_rsi1;

private VariableSeries<Double> m_myrsi;

private double Maxrsi1;

private double Minrsi1;

private IPlotObject Plot1;

public StochRSI_0(object ctx) : base(ctx)
{

RSI_length = 19;
Stochastic_length = 39;
}

[Input]
public int RSI_length { get; set; }

[Input]
public int Stochastic_length { get; set; }

protected override void Create()
{
m_rsi1 = new Function.RSI(this);
m_myrsi = new VariableSeries<Double>(this);
Plot1 = AddPlot(new PlotAttributes("StochRSI", 0, Color.Silver, Color.Empty, 0, 0, true));
}

protected override void StartCalc()
{
m_rsi1.price = Bars.Close;
m_rsi1.length = RSI_length;
}

protected override void CalcBar()
{
Maxrsi1 = m_rsi1.Highest(Stochastic_length);
Minrsi1 = m_rsi1.Lowest(Stochastic_length);
m_myrsi.Value = (m_rsi1[0] - Minrsi1)/(Maxrsi1 - Minrsi1);
Plot1.Set(0, m_myrsi.Value);
}
}
}

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

Re: StochRSI

Postby JoshM » 08 May 2015

I don't see an error in it compared with the mentioned Knowledgebase article.


Return to “MultiCharts .NET”