I want to compare the price of 2 instruments (ES Futures less NQ Futures), And compare 10 second candles vs 15minutes candles
I add the instruments and the different time frames, and then i create some double vars with the difference of open, close, high and low of that 2 instruments.
I do not know why i could not enable the strategy, y show below some parts of the script if someone could help me.
Thanks, Ignacio
else if (State == State.Configure)
{
AddDataSeries("ES 09-18", Data.BarsPeriodType.Minute, 15, Data.MarketDataType.Last);
AddDataSeries("NQ 09-18", Data.BarsPeriodType.Minute, 15, Data.MarketDataType.Last);
AddDataSeries("ES 09-18", Data.BarsPeriodType.Second, 10, Data.MarketDataType.Last);
AddDataSeries("NQ 09-18", Data.BarsPeriodType.Second, 10, Data.MarketDataType.Last);
}
else if (State == State.DataLoaded)
{
}
}
protected override void OnBarUpdate()
{
if (BarsInProgress != 0)
return;
if (CurrentBars[1] < 1
|| CurrentBars[2] < 1)
return;
SClose15[0] = ( Closes[1][0] + Closes[2][0]);//ES 09-18 less NQ 09-18 in 15 min close
SOpen15[0] = ( Opens[1][0] + Opens[2][0]);//ES 09-18 less NQ 09-18 in 15 min Open
SHigh15[0] = ( Highs[1][0] + Highs[2][0]);//ES 09-18 less NQ 09-18 in 15 min HIgh
SLow15[0] = ( Lows[1][0] + Lows[2][0]);//ES 09-18 less NQ 09-18 in 15 min Low
SSLow15[0] = ( Lows[3][0] + Lows[4][0]);//ES 09-18 less NQ 09-18 in 10 seg low
SSLow15[1] = ( Lows[3][1] + Lows[4][1]);//ES 09-18 less NQ 09-18 in 10 seg low previous bar
SSLow15[2] = ( Lows[3][2] + Lows[4][2]);//ES 09-18 less NQ 09-18 in 10 seg low 2 bars ago
SSLow15[3] = ( Lows[3][3] + Lows[4][3]);//ES 09-18 less NQ 09-18 in 10 seg low 3 bars ago
SSLow15[4] = ( Lows[3][4] + Lows[4][4]);//ES 09-18 less NQ 09-18 in 10 seg low 4 bars ago
SSHigh15[0] = ( Highs[3][0] + Highs[4][0]);
if (
SSLow15[0] < (SLow15 [0]+((SHigh15[0]-SLow15[0])/4))
)
{
EnterLong(3,1, "long1");
EnterShort(4,1, "short2");
}
........
at final i make the properties
#region Properties
[Browsable(false)]
[XmlIgnore]
public Series<double> SClose15
{
get { return Values[0]; }
}
[Browsable(false)]
[XmlIgnore]
public Series<double> SOpen15
{
get { return Values[0]; }
}
[Browsable(false)]
[XmlIgnore]
public Series<double> SHigh15
{
get { return Values[0]; }
}
[Browsable(false)]
[XmlIgnore]
public Series<double> SLow15
{
get { return Values[0]; }
}
[Browsable(false)]
[XmlIgnore]
public Series<double> SSLow15
{
get { return Values[0]; }
}
[Browsable(false)]
[XmlIgnore]
public Series<double> SSHigh15
{
get { return Values[0]; }
}
#endregion/*/
}
Comment