Okay, I did notice I was not selecting the order as the first step in the for loop of the exit test exitStrategy_cg_l16 (the 2
bold if conditions were reversed), but even when I do as below, I get the same incongruent results. I also commented out the magic number condition.
Code:
for(int cnt=0; cnt<total; cnt++)
{
if(selectOrderByIndex(cnt))
{
if(OrderType()<=OP_SELL && OrderSymbol()==Symbol())// && OrderMagicNumber()==cg_l16)
{
if(OrderType()==OP_BUY) // long position is opened