MT4 Live trading using Expert Advisor

 

When i'm using expert advisor in MT4 to open trades, it doesn't work by himself. I need to check the "Ask manual confirmation" checkbox or else nothing happen. If there is an open trade condition from the expert advisor, if the "Ask manual confirmation" is not checked, nothing happen but as soon as I check that box, the open trade dialogue pops up and ask me to confirm the trade.

The thing is I don't want to confirm the trades manually.

Did I miss an option or is there something wrong with the expert advisor I use?

Thank you!

 
You need to allow live Trading in 2 places, in the Properties > Common for your EA and in Tools > Options > Expert Advisors try setting both to Allow Live trading and untick Ask manual confirmation in both.
 

Also you should check your Experts log file in the terminal. If you don't find anything you should add a bit of code to your EA:

ticket=OrderSend(Symbol(),OP_BUY,1,Ask,3,Ask-25*Point,Ask+25*Point,"My order #2",16384,0,Green);
     if(ticket<0)
       {
        Print("OrderSend failed with error #",GetLastError());
        return(0);
       }

if you haven't already got this code it will help log the error you might be getting from the provider.

 

I tried almost anything with the options but I had no luck.

I will try to add this code and see if there's some errors!

Thanks for your replies!

 
TradesAreMAde:

I tried almost anything with the options but I had no luck.

I will try to add this code and see if there's some errors!

Thanks for your replies!

So you have this set for your EA ?

and this set in MT4 ?

 

Yes the options are ok!

The problem is the famous error 130 on the OrderSend function!

I tried OrderSend with S/L & T/P = 0 and then do a OrderModify and still get the error 130 on the OrderModify! I also tried multiplying by 10 the S/L and T/P.... No luck!

Thanks for your help!

 
Add a print statement to print your SL and TP . . .
 
ticket=OrderSend(Symbol(),OP_BUY,1,Ask,3,Ask-25*Point,Ask+25*Point,"My order #2",16384,0,Green);

On a 5 digit broker your stops are 2.5 pips away. The closest they can be is MarketInfo(Symbol(), MODE_STOPLEVEL)*Point (3.0 pips/30 points on IBFX) Thus 130.

EA's must adjust for 4/5 Digit brokers, TP, SL, AND slippage. On ECN brokers you must open first and THEN set stops.

For a BUY you open at the Ask, the stops are relative to the BID

//++++ These are adjusted for 5 digit brokers.
int     pips2points;    // slippage  3 pips    3=points    30=points
double  pips2dbl;       // Stoploss 15 pips    0.0015      0.00150
int     Digits.pips;    // DoubleToStr(dbl/pips2dbl, Digits.pips)
int     init(){
     if (Digits % 2 == 1){      // DE30=1/JPY=3/EURUSD=5 forum.mql4.com/43064#515262
                pips2dbl    = Point*10; pips2points = 10;   Digits.pips = 1;
    } else {    pips2dbl    = Point;    pips2points =  1;   Digits.pips = 0; }
    // OrderSend(... Slippage.Pips * pips2points, Bid - StopLossPips * pips2dbl
//---- These are adjusted for 5 digit brokers.
    /* On ECN brokers you must open first and THEN set stops
    int ticket = OrderSend(...)
    if (ticket < 0)
       Alert("OrderSend failed: ", GetLastError());
    else if (!OrderSelect(ticket, SELECT_BY_POS))
       Alert("OrderSelect failed: ", GetLastError());
    else if (!OrderModify(OrderTicket()...)
       Alert("OrderModify failed: ", GetLastError());
     */
 

Hey Gang, I'm actually having this same issue and I'm not a coder at all so haven't been able to make heads or tails out of the code pasted above... I thought I had done pretty well creating/modifying the EA which uses some pretty crude methods - overall backtesting and on demo accounts it has shown that it can work quite well in certain circumstances.

I'd prefer not to paste the code - is anyone able to assist? Happy to email and fix you anyone up for their time via Paypal or something like that - 5 days of research and I'm no closer so would appreciate any help!

Cheers!

 
Go here and post your job: MT4 and MT5 coding