Very Strange

 

My EA will not work unless i check the (Allow Live Trading) + (Manual Confirmation)

If I just check the (Allow Live Trading) it will do nothing ... just skip the step of OrderSend() and generate an alarm!!

do i need to add some sleep time or what?

//---- buy conditions
   if (OrdersTotal()==0)
    {
   if(Bid==BUY_PRICE)
     {
      res=OrderSend(Symbol(),OP_BUY,LotsOptimized(),Bid,3,(SELL_PRICE-(Commission*Point)),(BUY_PRICE+(TARGET*Point)),"",MAGICMA,0,Blue);
      LastTrade = Buy;
      SendMail ("BUY "+Symbol(),"1st Buy Excuted");
      PlaySound ("news.wav");
      return;
     }   
   }
 
If you want to know if your EA works try it in the Strategy tester first . . . and check return codes ( res ) and take appropriate actions . . .
 

it is works fine with the strategy tester "no problem" ... the only thing it doesn't execute trades automatically in case of live trading, but if i activate the manual confirmation it works!!!

I thought there was some thing wrong in meta trader but i tried to do for another broker and got the same results !!

 

Maybe it's a Broker thing, try a Demo from a different Broker and see if it does the same . . . there are 2 places you can set this option . . .

 
meroo_basha:

it is works fine with the strategy tester "no problem" ... the only thing it doesn't execute trades automatically in case of live trading, but if i activate the manual confirmation it works!!!

Perhaps if you had reported the error generated when your order tried to place the order and failed you might have a better idea of what was going on . . . why don't you do that ?
 

Thanks RaptorUK ... but i am already doing the same options you attached, it seems very strange because i got no error and if you just looked at the code .. it going directly to

      LastTrade = Buy;
      SendMail ("BUY "+Symbol(),"1st Buy Excuted");
      PlaySound ("news.wav");
      return;

and skip

  res=OrderSend(Symbol(),OP_BUY,LotsOptimized(),Bid,3,(SELL_PRICE-(Commission*Point)),(BUY_PRICE+(TARGET*Point)),"",MAGICMA,0,Blue);

this is only if i just "Allow live trading"

but if i "Allow live trading" + "Ask manual confirmation" it will not skip any thing and give me a pop up for confirmation "Buy/Sell" then it will send the mail and generate the alarm.

 
Do I have to repeat a third time what I have already said twice ? I guess I don't . . .
 
Why are you so arrogant? If you are so clever then you should not be here asking dumb questions. It works for thousands of people, don't you think that you are doing something wrong?!
 
RaptorUK:
Do I have to repeat a third time what I have already said twice ? I guess I don't . . .

I didn't force you to answer ... if you have no idea or don't know the correct answer then you should ignore and look at another topic you might know
 

OK, I'll write your code for you . . .

res=OrderSend(Symbol(),OP_BUY,LotsOptimized(),Bid,3,(SELL_PRICE-(Commission*Point)),(BUY_PRICE+(TARGET*Point)),"",MAGICMA,0,Blue);
if(res<0)
   {
   int GLE = GetLastError();
   Print("OrderSend failed, error: ", GLE);
   SendMail("BUY "+Symbol(), StringConcatenate("OrderSend failed, error: ", GLE));
   }
else
   {
   LastTrade = Buy;
   SendMail ("BUY "+Symbol(),"1st Buy Excuted");
   }

Add this to your code, turn off manual confirmation, wait for a trade to try to happen, check the Experts tab and your email for the error . . .

 
Thank you so much, Now i am getting error 129 at the experts tab, what does this mean?