is this how to do it? if OrdersTotal increases by 1 then Print……

 

Is this how to print when a new order opens?

 

 

if(OrdersTotal() ++)

Print(“a new Order has opened, OrdersTotal() is now = “+OrdersTotal() );


 

 

thanks pros  :) 

 
c3po:

Is this how to print when a new order opens?


No. 
 
c3po: Is this how to print when a new order opens?
if(OrdersTotal() ++)
Print(“a new Order has opened, OrdersTotal() is now = “+OrdersTotal() );
  1. OrdersTotal() returns a number (say 5). 5++ is 6. What does if(6) mean?
  2. You need to remember the old value so you know when it changes.
    static int OTcurrent; int OTprevious = OTcurrent; OTcurrent = OrdersTotal();
    if(OTcurrent > OTprevious) Print("new order");
  3. Do you care whether another EA or a human opened an order on another chart? Shouldn't you only care about your orders on your chart? You know that when you called OrderSend().
  4. If you want to know whether a pending order opened, then you need to look for an increase of your open orders.
    static int OTcurrent; int OTprevious = OTcurrent; OTcurrent = MyOrdersTotal(OP_BUY) + MyOrdersTotal(OP_SELL);
    if(OTcurrent > OTprevious) Print("new order");

 
Yes, it`s so. But static mode is not realised correctly in mt4, so I recomend to use global data section. 
 
tara:
Yes, it`s so. But static mode is not realised correctly in mt4, so I recomend to use global data section. 
what is wrong with static mode ?
 
WHRoeder:
static int OTcurrent; int OTprevious = OTcurrent; OTcurrent = OrdersTotal();
if(OTcurrent > OTprevious) Print("new order");


got it boss. This is like taking a snapshot with a video camera and comparing the two. Then MyOrdersTotal to filter out everything but current chart, symbol, magic, etc. Thanks.

Reason: