Using this code shown below. After meeting the "Bars formula" below, an order is submitted, and immediately canceled. I'd like to have the order stay active for the duration of the following bar, using a buy/sell price of the last closing bar (Close[0]), and this has been my experience as the default action with other strategy I've built. However it does not appear to be working with this strategy, and I can't seem to figure out why...
The time frame I'm using is a 2-min, and caclulateonbarclose = true.
// Bars formula
int greenbars=0;
int redbars=0;
for (int x=0;x<signalbars;x++)
{
if (Closes[1][x]>Opens[1][x])
greenbars++;
if (Closes[1][x]<Opens[1][x])
redbars++;
}
// Short Order
if (
greenbars==signalbars &&
tradeshort == true &&
tradepermission == true
)
SE=EnterShortLimit(1,false,tradesize,Close[0],"");
barNumberOfOrder = CurrentBar;
// Long Order
if (
redbars==signalbars &&
tradelong == true &&
tradepermission == true
)
LE=EnterLongLimit(1,false,tradesize,Close[0],"");
Comment