then i run my code and all goes very slow
what change in the code to get better running ?
else if (State == State.Configure)
{
AddDataSeries("MES 03-25", Data.BarsPeriodType.Minute, 1, Data.MarketDataType.Last);
SetStopLoss("", CalculationMode.Ticks, Stoplossbyticks, false);
SetProfitTarget("", CalculationMode.Ticks, TPbyTicks);
}
}
double currLowNq = 0;
double currLowEs = 0;
double esHighestHigh = 0;
double esLowestLow = 0;
double nqhighestHigh = 0;
double nqlowestLow = 0;
protected override void OnBarUpdate()
{
if (BarsInProgress == 1 )
{
// Get the highest high and lowest low for ES
esHighestHigh = SampleGetHighLowByTimeRange(5, 17, 8, 0).HighestHigh[0];
esLowestLow = SampleGetHighLowByTimeRange(5, 17, 8, 0).LowestLow[0];
// Log ES values
Log("ES Highest High between 5:17 AM and 8:00 AM: " + esHighestHigh, LogLevel.Information);
Log("ES Lowest Low between 5:17 AM and 8:00 AM: " + esLowestLow, LogLevel.Information);
}
if (BarsInProgress == 0 )
{
nqhighestHigh = SampleGetHighLowByTimeRange(5, 17, 8, 0).HighestHigh[0];
nqlowestLow = SampleGetHighLowByTimeRange(5, 17, 8, 0).LowestLow[0];
Log("Highest High between 5:17 AM and 8:00 AM: " + nqhighestHigh, LogLevel.Information);
Log("Lowest Low between 5:17 AM and 8:00 AM: " + nqlowestLow, LogLevel.Information);
}
currLowEs = Lows[1][0];
Log("curr low es " + currLowEs, LogLevel.Information);
currLowNq = Low[0];
Log("curr low nq: " + currLowNq, LogLevel.Information);
if (currLowNq < nqlowestLow && currLowEs >=esLowestLow && BarsInProgress == 0 && Time[0].Hour == 5 && Time[0].Minute > 17 )
{
EnterLong(Convert.ToInt32(DefaultQuantity), "");
}
}
region Properties
[NinjaScriptProperty]
[Range(1, int.MaxValue)]
[Display(Name = "Stoplossbyticks", Order = 1, GroupName = "Parameters")]
public int Stoplossbyticks
{ get; set; }
[NinjaScriptProperty]
[Range(1, int.MaxValue)]
[Display(Name = "TPbyTicks", Order = 2, GroupName = "Parameters")]
public int TPbyTicks
{ get; set; }
#endregion
}
}

Comment