Download MetaTrader 5

buy buy buy or sell sell sell

To add comments, please log in or register
Does your signal already have a lot of of subscribers? It's time to think about the paid subscription!
pompei
9
pompei 2015.05.15 20:16 
hi
very good , I need some help, my EA made ​​several orders followed buy buy buy or sell sell sell but just want to make a signal , the first of each order is possible .. ?
Francis Dogbe
9501
Francis Dogbe 2015.05.16 12:31  
pompei:
????
Rodrigo Malacarne
Moderator
9904
Rodrigo Malacarne 2015.05.19 13:13  
pompei:

Hello pompei,

If you don't give more details about your problem, it will be very difficult to find any help for your problem.

Try to be more specific, and if possible try to show parts of your code, so you can get any help from users.

You can also try to take a look at this forum post: https://www.mql5.com/en/forum/23358 

Regards,
Malacarne 

Multiple Order Entry Problem for live account with a specific broker
Multiple Order Entry Problem for live account with a specific broker
  • www.mql5.com
I am currently experiencing some multiple order execution problem with my EA but only for a specific broker. - - Category: expert advisors and automated trading
Osama Shaban
1448
Osama Shaban 2015.05.22 15:33  

You need to use a function to check existence of any open order before opening a new one ...

 Follow these logical steps to let it go ...

 Before opening any order, at the moment of the opening an order, the EA must check if there is no open orders of the same pair, if no order is opened, let it open that order, remember to use (return) to go to the starting point to prevent the program flow to continue checking other conditions.

Why use (return) ?

This solves a lot of problems like yours ... it will update the info to the EA that there is a new opened order to put it into consideration to prevent opening a new order.

I used to use the following function ...

bool ExistPositions() {
        for (int i=0; i<OrdersTotal(); i++) {
                if (OrderSelect(i, SELECT_BY_POS, MODE_TRADES)) {
                        if (OrderSymbol()==Symbol() && (OrderMagicNumber()==MagicUP || OrderMagicNumber()==MagicDN)) {
                           return(True);
                        }
                } 
        } 
        return(false);
}
To add comments, please log in or register