This issue is driving me crazy. Everytime I try to run this apparently simple code, NT crashes. I really need your help. This is the core of this simple testing code:
#region Variables
private double s = 1000; // Default setting for Stoploss
private DataSeries cc; // Roc for close
private DataSeries hh; // Roc for high
private DataSeries ll; // Roc for low
#endregion
protected override void Initialize()
{
SetProfitTarget("", CalculationMode.Ticks, S);
SetStopLoss("", CalculationMode.Ticks, S, false);
BarsRequired = 3;
cc = new DataSeries(this);
hh = new DataSeries(this);
ll = new DataSeries(this);
CalculateOnBarClose = true;
}
protected override void OnBarUpdate()
{
if (CurrentBar > BarsRequired)
{
cc.Set(Math.Round((Close[0]/Close[1]), 7));
hh.Set(Math.Round((High[0]/High[1]), 7));
ll.Set(Math.Round((Low[0]/Low[1]), 7));
if (cc[0]>hh[0] && cc[0]>ll[0] && hh[0]>ll[0] )
{
EnterLong(100000, "BUY");
}
// The code continues with different combinations...
ExitLong();
}
}
An important note: the crashes just happens when I set the comparation:
cc[0]>hh[0] && cc[0]>ll[0] && hh[0]>ll[0]
and it goes just fine with this combinations:
cc[0]>1 && cc[0]>1 && hh[0]>1
WHY? and how can I solve this?
I appreciate your help as always
Comment