Download MetaTrader 5

Help with my EA

To add comments, please log in or register
r.bau 2015.11.10 21:07 

Hi guys, I have some problems whith an EA I'm trying to write... The EA is simple. There is and indicator that draw a down arrow for sell and a up arrow for buy.

My EA will buy or sell where the arrow  appears (at the same candle).

I tryed to do this but there is something wrong..... please help me.....

The EA, for now, do nothing with stoploss or take profit 

bc.ex4 8 kb
ea_bc.mq4 17 kb
whroeder1 2015.11.11 13:00  
  1. for(int i=0;i<OrdersTotal();i++){
       if(OrderSymbol() == Symbol() && OrderMagicNumber()==MagicNumberSELL)
          OrderClose(OrderTicket(), OrderLots(), Ask, 3, DeepPink);
    In the presence of multiple orders (one EA multiple charts, multiple EA's, manual trading) you must count down when closing/deleting/modifying in a position loop. Get in the habit of always counting down. Loops and Closing or Deleting Orders - MQL4 forum
  2. OrderClose(OrderTicket(), OrderLots(), Ask, 3, DeepPink);

    OrderSend(Symbol(), OP_SELL, Lots, Bid, 3, Bid+Stoploss*Point*MyPoint, Bid-Takeprofit*Point*MyPoint ,"EA BC Sell", MagicNumberSELL, 0, Red);
    Check your return codes and find out why. What are Function return values ? How do I use them ? - MQL4 forum and Common Errors in MQL4 Programs and How to Avoid Them - MQL4 Articles
  3. print out your variable values at if statements and find out why.
To add comments, please log in or register