MA Cross Over HELP on EA
Results 1 to 5 of 5

Thread: MA Cross Over HELP on EA

  1. #1
    I'm pulling my hair out and want some help.

    The connected EA is just a very easy one and is producing signals, however, the orders are not being entered and NO ERRORS are showing up from the Journal.

    What it should do is every time the current price crosses UP or DOWN on the EMA 89 it would place an order in the direction of the cross.

    It sets the first one then no longer orders.

    You're able to see from the Journal there are loads of signals being actuated when you run it.

    PLEASE HELP!

    Thank you in advance.
    Neal

    (It would not let me do an attachment so here it is)

    Inserted Code // ------------------------------------------------------------------ //| Daily 100 System | //| Twist © 2008, Neal Chapman | //| Number 91;email@gmail. com#93;******. Com#91;/email#93; | // ------------------------------------------------------------------ //-- enter parameters extern int MagicNumber = 304323; extern int StopLoss=30; extern int TakeProfit=40; extern double Lots=1; int Bought=0; int Ticket,OrderSignal=0; dual EMA89,pbid; dual Vol; // ------------------------------------------------------------------ //| expert start function | // ------------------------------------------------------------------ int begin () //-- EMA89 = iMA(NULL, 15, 89, 0, MODE_SMA, PRICE_MEDIAN, 0); if ((Close#91;0#93; gt;= EMA89) (Close#91;1#93; gt;= EMA89) (Open#91;2#93; lt; EMA89)) OrderSignal=1; / / / /-------------------------------- // BEGIN - this IF statement only for debug purposes //------------------------- if(EMA89! = pbid) Print(Buy Ready gt;gt;gt;gt; H:,Open#91;0#93;, gt;(1)H:,Close#91;1#93;, (89):,EMA89, lt;(2)L:,Open#91;2#93;, Signal:,OrderSignal); pbid=EMA89; //-------------------------------- // END - this IF statement Just for debug purposes //------------------------- else if ((Close#91;0#93; lt;= EMA89) (Close#91;1#93; lt;= EMA89) (Open#91;2#93; gt; EMA89)) OrderSignal=-1; //-------------------------------- // BEGIN - this IF statement Just for debug purposes //------------------------- if(EMA89! = pbid) Print(Sell Ready gt;gt;gt;gt; L:,Open#91;0#93;, gt;(1)L:,Close#91;1#93;, (89):,EMA89, lt;(2)H:,Open#91;2#93;, Signal:,OrderSignal); pbid=EMA89; //-------------------------------- // END - this IF statement Just for debug purposes //------------------------- else OrderSignal=0; //Check to see if there is an order currently open int cnt, total = OrdersTotal(); for(cnt=0;cntlt;total;cnt ) OrderSelect(cnt, SELECT_BY_POS, MODE_TRADES); if(OrderMagicNumber() == MagicNumber) Bought ; if(Bought==0) //no order yet if(OrderSignal gt; 0) // buy order Vol=Lots; Ticket=OrderSend(Symbol(),OP_BUY,Vol,Ask,3,Ask-StopLoss*Point,Ask TakeProfit*Point,Daily100,MagicNumber,0,Green); Sleep(1000); if(OrderSignal lt; 0) // sell order Vol=Lots; Ticket=OrderSend(Symbol(),OP_SELL,Vol,Bid,3,Bid StopLoss*Point,Bid-TakeProfit*Stage,Daily100,MagicNumber,0,Red); Sleep(1000); return(0);

  2. #2
    That is because after the first order, bought is gt;0 so your if statement never executes again.

  3. #3
    There is no loop on your EA, so when an order is executed, it stops.

  4. #4
    Just initialize Bought at the start of the beginning function (to be zero). Or you can move the int Bought=0line in to the start function. That should help.

    Regards,
    chandra

  5. #5
    Lucky for Me Personally to Discover this thread.Would you show me the complete EA with better Outcomes of MA crossing?Tks a lot Ele

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
This website uses cookies
We use cookies to store session information to facilitate remembering your login information, to allow you to save website preferences, to personalise content and ads, to provide social media features and to analyse our traffic. We also share information about your use of our site with our social media, advertising and analytics partners.