Strange behavior

Back to topics list To post a new topic, please log in or register
avatar
10
goodvinj 2015.07.28 17:10
 

Hello!

There is something strange with my EA.

I'm using this function for position selection:

bool SelectBotPosition()
{
   int ordersCount = OrdersTotal();
  
   for (int i = 0; i < ordersCount; i++)
   {
      if (OrderSelect(i, SELECT_BY_POS))
      {
         if (OrderSymbol() == Symbol() && OrderMagicNumber() == BotMagic)
         {
            Print("order type ", OrderType());
            switch (OrderType())
            {
               case OP_BUY:
               case OP_SELL:
                  return true;
            }
         }
      }
   }

   return false;
}
And it prints "order type 4" i.e. OP_BUYSTOP, but EA never creates a BUYSTOP order, moreover I see opened position in the Trades window:

2015.07.28 15:59:59.833    '3087888': order was opened : #2466572 buy 0.01 EURUSD.q at 1.10500 sl: 0.00000 tp: 0.00000
2015.07.28 15:59:59.692    '3087888': order buy market 0.01 EURUSD.q sl: 0.00000 tp: 0.00000

It should be OP_BUY. What's wrong?

I'm using terminal ver. 840.


avatar
13008
WHRoeder 2015.07.29 15:13 #
 
goodvinj it prints "order type 4" i.e. OP_BUYSTOP, but EA never creates a BUYSTOP order,
Apparently it does.
There are no mindreaders here. Print out all relevant information, like ticket number, and find out.

avatar
10
goodvinj 2015.07.29 20:44 #
 

There is no BUYSTOP orders nor in the trades list nor in the history.

History contains BUY/SELL orders only.

avatar
13008
WHRoeder 2015.07.29 20:48 #
 
There won't be stop/limits in history (except deleted ones.) They become buy/sell when they trigger.
avatar
10
goodvinj 2015.07.29 21:06 #
 

OK, anyway when EA prints "order type 4" there is only BUY trade, journal contains lines

2015.07.28 15:59:59.833    '3087888': order was opened : #2466572 buy 0.01 EURUSD.q at 1.10500 sl: 0.00000 tp: 0.00000

2015.07.28 15:59:59.692    '3087888': order buy market 0.01 EURUSD.q sl: 0.00000 tp: 0.00000

for the current BUY position.

avatar
10
goodvinj 2015.07.30 12:45 #
 

I've added a ticket number to the log.

Now the journal contains:

2015.07.30 11:07:18.200    '3087888': order was opened : #2487443 buy 0.01 EURUSD.q at 1.09818 sl: 0.00000 tp: 0.00000
2015.07.30 11:07:17.607    '3087888': order buy market 0.01 EURUSD.q sl: 0.00000 tp: 0.00000

And the EA prints

2015.07.30 11:07:18.763    MyEA EURUSD.q,M5: ticket 2487443, type 4

messages.

So again.. How is it possible?

avatar
10
goodvinj 2015.08.16 21:37 #
 

Looks like a broker-specific issue.

Back to topics list  

To add comments, please log in or register