OrderType() returns wrong in a complicated EA while it's correct in another simple EA

Back to topics list To post a new topic, please log in or register
avatar
31
wqking 2016.01.22 13:26
 

Hi all,

I have two pending orders for test purpose. One is buy limit (OP_BUYLIMIT is 2), another is sell stop which is OP_SELLSTOP 5.

There are only those two pending orders, no any other orders or trades.

I put the following code in an almost empty EA, in the OnInit function,

        for(int i = 0; i < OrdersTotal(); ++i) {
                if(! OrderSelect(i, SELECT_BY_POS, MODE_TRADES)) {
                        continue;
                }
        
                Print(OrderSymbol() + " " + (string)OrderTicket() + " " + (string)OrderType());
        }

It prints the correct information and order types.

However, if I put the code in a complicated EA, even in the OnInit function, the order type is always 4 (OP_BUYSTOP) for both two orders, though the symbol and ticket are correct. I'm 100% sure there are no any buy stop orders.

The EA includes quite a lot of code, which the size of EX4 exceeds 500 KB, and it uses a DLL which is more than 2 MB. It's so complicated that I can't post any piece of code of it.

Did any one see that OrderType returns wrong result? If so, why and how to solve it?

Thanks


avatar
12992
WHRoeder 2016.01.22 14:36 #
 
Your loop should be filtering by magic number and pair, so you don't get values from other charts.
avatar
31
wqking 2016.01.22 14:46 #
 
WHRoeder:
Your loop should be filtering by magic number and pair, so you don't get values from other charts.

That's not the problem. The code is for test purpose, there is no order on other charts.
avatar
31
wqking 2016.01.23 04:52 #
 

After some very tough debug, I found the reason.

I have an enum named OrderType, which messed up the function OrderType().

After I rename the enum to another name, OrderType() returns correct value.

Back to topics list  

To add comments, please log in or register