Download MetaTrader 5

How to stop EA from making multiple buy orders

To add comments, please log in or register
ParaMoo
10
ParaMoo  

Hi,

I am currently working on my EA and ran into some trouble. Part of my script is below.  My EA keeps producing a buy order when it is within the price range I have specified below, despite me putting

a sleep function there for a long time. Is there an alternative way that is more efficient or works cause mine doesn't.

I have a five digit broker.


 if(Bid > PriceBid - 15*Point && Bid < PriceBid + 15*Point)

                          

                           {

                              

                               int ticket ;

                              ticket = OrderSend (OrderSymbol(), OP_BUYSTOP, Lots, Buystop, 15, StopLoss, TakeProfit  ,NULL);   

                             

                                Sleep (200000000);        

                           }

Mladen Rakic
61882
Mladen Rakic  
ParaMoo:

Hi,

I am currently working on my EA and ran into some trouble. Part of my script is below.  My EA keeps producing a buy order when it is within the price range I have specified below, despite me putting

a sleep function there for a long time. Is there an alternative way that is more efficient or works cause mine doesn't.

I have a five digit broker.


 if(Bid > PriceBid - 15*Point && Bid < PriceBid + 15*Point)

                          

                           {

                              

                               int ticket ;

                              ticket = OrderSend (OrderSymbol(), OP_BUYSTOP, Lots, Buystop, 15, StopLoss, TakeProfit  ,NULL);   

                             

                                Sleep (200000000);        

                           }

You can use OrdersTotal() - but with that sleep (the Sleep (200000000);) you maybe even do not need it :)
To add comments, please log in or register