Download MetaTrader 5

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

To add comments, please log in or register
Brian Kester
820
Brian Kester  

Is this how to print when a new order opens?

 

 

if(OrdersTotal() ++)

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


 

 

thanks pros  :) 

Алексей Тарабанов
7316
Алексей Тарабанов  
c3po:

Is this how to print when a new order opens?


No. 
whroeder1
14778
whroeder1  
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");

Алексей Тарабанов
7316
Алексей Тарабанов  
Yes, it`s so. But static mode is not realised correctly in mt4, so I recomend to use global data section. 
Ian Venner
2584
Ian Venner  
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 ?
Brian Kester
820
Brian Kester  
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.

To add comments, please log in or register