Simple Help: Take Profit Moving Average

 

Hi guys,

I made this EA on http://sufx.core.t3-ism.net/ExpertAdvisorBuilder/index.html#Var2

It will place a buy order if RSI is below 30, the price went below the lower bollinger band and when the next candle is white. opposite story for sell (with RSI above 70)

It's fine that it waits till a new bar is performed to enter a trade.

I would like to take profit IMMEDIATLY when the price TOUCHES moving average (50). Because now when price touches the MA it waits for a new candle and then exit the trade.

Can you help me?

P.S: Another problem is, that it won't open any trades when SL and TP are set to true. You guys know why?

Thank you very much in advance

I added some part of the code (Exit Sell is missing because the uploader said "text is too long")




 

This forum is for people learning how to code. You're going to run into allot of problems trying to modify your EA. If someone fixes one problem for you, they'll end up having to fix another-and-another. I recommend you learn or hire someone.

 

Then give me at least some hints...

 
Try Setting: {extern bool EachTickMode = False;} to {extern bool EachTickMode = true;}
 
P.S: Another problem is, that it won't open any trades when SL and TP are set to true. You guys know why? Perhaps it's not adjusting for Market Execution in the OrderSend() .... go figure.
 

then the EA will open a trade before the bar is completed. Just tell me one thing: Is what I want even possible to implement into that code?

I already tried to activate tick mode only for exit point but this doesn't work.

 
Is what I want even possible to implement into that code? Yes.
 

I would actually do it like this:

//+------------------------------------------------------------------+
            //| Signal Begin(Exit Buy)                                           |
            //+------------------------------------------------------------------+

                     if (CloseBuy1_1 >= CloseBuy1_2)
                      {
                       OrderClose(OrderTicket(),OrderLots() ,Bid, Slippage, MediumSeaGreen);
                       return(0);
                      }


            //+------------------------------------------------------------------+
            //| Signal End(Exit Buy)                                             |
            //+------------------------------------------------------------------+

  
            //Trailing stop
            if(UseTrailingStop && TrailingStop > 0) {                 
               if(Bid - OrderOpenPrice() > Point * TrailingStop) {
                  if(OrderStopLoss() < Bid - Point * TrailingStop) {
                     OrderModify(OrderTicket(), OrderOpenPrice(), Bid - Point * TrailingStop, OrderTakeProfit(), 0, MediumSeaGreen);
                     if (!EachTickMode) BarCount = Bars;
                     continue;
                  }
               }
            }
         } else {
            //Close
Reason: