RSI_LE and other reference Signals

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

RSI_LE and other reference Signals

Postby 3strategy » 28 Jan 2015

In RSI_LE signal provided with the platform, as well as other signals, there is a series
m_myrsi = new VariableSeries<Double>(this);

Why is the series needed?
Here below is a modified version (see comments //1, //2, //3, //4) that works exactly the same:

Code: Select all

using System;
using PowerLanguage.Function;

namespace PowerLanguage.Strategy
{
public class BTestRSI_LE : SignalObject
{
private RSI m_RSI;

//1private VariableSeries<Double> m_myrsi;

private IOrderMarket m_RsiLE;

public BTestRSI_LE(object ctx) :
base(ctx)
{
OverSold = 30;
Length = 14;
}

private ISeries<double> Price { get; set; }

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

[Input]
public double OverSold { get; set; }

protected override void Create(){
m_RSI = new RSI(this);
//2m_myrsi = new VariableSeries<Double>(this);
m_RsiLE =
OrderCreator.MarketNextBar(new SOrderParameters(Contracts.Default, "RsiLE", EOrderAction.Buy));
}

protected override void StartCalc(){
Price = Bars.Close;
m_RSI.price = Price;
m_RSI.length = Length;
}


protected override void CalcBar(){
//3m_myrsi.Value = m_RSI[0];
if (Bars.CurrentBar > 1){
if (this.CrossesOver(m_RSI,OverSold)){ //4if (this.CrossesOver(m_myrsi,OverSold)){
m_RsiLE.Send();
}
}
}
}
}
and here is the original:

Code: Select all

using System;
using PowerLanguage.Function;

namespace PowerLanguage.Strategy
{
public class RSI_LE : SignalObject
{
private RSI m_RSI;

private VariableSeries<Double> m_myrsi;

private IOrderMarket m_RsiLE;

public RSI_LE(object ctx) :
base(ctx)
{
OverSold = 30;
Length = 14;
}

private ISeries<double> Price { get; set; }

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

[Input]
public double OverSold { get; set; }

protected override void Create(){
m_RSI = new RSI(this);
m_myrsi = new VariableSeries<Double>(this);
m_RsiLE =
OrderCreator.MarketNextBar(new SOrderParameters(Contracts.Default, "RsiLE", EOrderAction.Buy));
}

protected override void StartCalc(){
Price = Bars.Close;
m_RSI.price = Price;
m_RSI.length = Length;
}


protected override void CalcBar(){
m_myrsi.Value = m_RSI[0];
if (Bars.CurrentBar > 1){
if (this.CrossesOver(m_myrsi,OverSold)){
m_RsiLE.Send();
}
}
}
}
}
Why is the series needed?

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

Re: RSI_LE and other reference Signals

Postby Henry MultiСharts » 04 Feb 2015

Hello 3strategy,

Both versions are workable.


Return to “MultiCharts .NET”