I am working on my first NT8 strategy and need some help with coding. I've built this strategy using the strategy builder wizard.
The strategy would enter long if the value TrendSignalUp = 1 or short if TrendSignalDown = 1.
It needs to enter on the open of the next bar if the previous bar was different than the one before it. That is, 2 bars ago is different.
So, if TrendSignalDown[2] = 1 and TrendSignalUp[1] = 1 then enter long.
The code below causes a trade to be entered on every bar.
{
if (BarsInProgress != 0)
return;
if (CurrentBars[0] < 1)
return;
// Set 1
if (atsTrendFinder1.TrendSignalUp[0] == 1)
{
EnterLong(Convert.ToInt32(DefaultQuantity), "");
}
// Set 2
if (atsTrendFinder1.TrendSignalDown[0] == 1)
{
EnterShort(Convert.ToInt32(DefaultQuantity), "");
}
}
What is the syntax to make this work?
Thanks
Andrew
Comment