I have written a very simple strategy to test the accuracy of order execution, because in some of our automated strategies I can see on chart, that it should working, but NT executes sometimes at undefined points (see on picture) or doesn't execute not at all, although the trigger has been touched.
On the picture you can see on the right side the execution point. The position should be opened after a "cross below red line (Low[1]) - Go Short" or "cross above blue line (Median[1]) - Go Long". As you can see on the picture, the blue line wasn't triggered at all but NT has opened a long position.
This is only one example. The test program runs on a simulation account live, the most orders are not executed on the trigger points and often - that's also great - executed contrary. On a "cross above green line (High[1])", where program shoud enter Long, it enters Short...? Here is the code, I don't know what could be the reason for this. The code is generated by the strategy builder.
protected override void OnBarUpdate()
{
if (BarsInProgress != 0)
return;
if (CurrentBars[0] < 1)
return;
// set 1
if ((BlokLong != Median[1])
&& (Times[0][0].TimeOfDay >= new TimeSpan(8, 0, 0))
&& (Times[0][0].TimeOfDay <= new TimeSpan(22, 0, 0))
// Konditionsgruppe 1
&& ((CrossAbove(Close, High, 1))
|| (CrossAbove(Close, Median, 1))))
{
EnterLong(Convert.ToInt32(DefaultQuantity), "");
BlokLong = Median[1];
}
// set 2
if ((BlokLong != Median[1])
&& (Times[0][0].TimeOfDay >= new TimeSpan(8, 0, 0))
&& (Times[0][0].TimeOfDay <= new TimeSpan(22, 0, 0))
// Konditionsgruppe 2
&& ((CrossBelow(Close, Low, 1))
|| (CrossBelow(Close, Median, 1))))
{
EnterShort(Convert.ToInt32(DefaultQuantity), "");
BlokLong = Median[1];
}
Calculation mode is OnPriceChange
Comment