additional code for my EA plz

 

I put a takeprofit level, but when price reach it, another order is executed again. Can somebody help me to stop execution of another order until the opposite signal when my takeprofit is reached?

 please help, thank you in advance.

I use MT4 

 
 
sparty07: Can somebody help me to...
Since there are no slaves here, you have only three choices: Search for it, learn to code it, or pay someone. We're not going to code it FOR you. We are willing to HELP you when you post your attempt and the nature of your problem.
 
sparty07:

I put a takeprofit level, but when price reach it, another order is executed again. Can somebody help me to stop execution of another order until the opposite signal when my takeprofit is reached?

 please help, thank you in advance.

I use MT4 

for if you don't want  Search for it, learn to code it, or pay someone.

open properties of the EA   choose common

Click on Long & Short  and now you can make it the EA is not open trade in the direction you have open

If the EA opens new trade of opposite signal then you can do this again 

 

did you yourself write the EA?

If that is true, here's what you can do:

First:

define 2 variables, initialised: iLong=false; iShort=false;

Put these before before the code line that gets the trade signal,

After the signal is determined, then put iLong=true (if it is a long signal) OR iShort= true ( if short signal)

Needless to say only 1 must be true!

Second and final:  Once the trade is made ( confirm with the  err value), reset the appropriate variable to false.


BUT if you did not write the EA, then post i! Maybe someone will see if you can do with it what I have suggested. Goodluck!

Hey, just know my helping you does not mean you should not be paying others to do work you are unable to do. Sometimes, paying some gets you results faster and more reliably.



 

Please use SRC for Codes. Instructions.

 
sparty07:
I put a takeprofit level, but when price reach it, another order is executed again. Can somebody help me by making a code to stop execution of another order until the opposite signal when my takeprofit is reached? please help, thank you in advance. I use MT4.
some parts of my EA based on Ichimoku:
-----------------------------------------------------------------------------------------------------
<CODE DELETED>

Please edit your posts above . . .    please use the   SRC   button to post code: How to use the   SRC   button.
 
I put a takeprofit level, but when price reach it, another order is executed again. Can somebody help me by making a code to stop execution of another order until the opposite signal when my takeprofit is reached? please help, thank you in advance. I use MT4.
some parts of my EA based on Ichimoku:
-----------------------------------------------------------------------------------------------------

   //+------------------------------------------------------------------+
   //| Signal Begin(Entry)                                              |
   //+------------------------------------------------------------------+

   if ( chinkou > Close[26] && tenkan >= kijun && Ask >= KumoHigh) Order = SIGNAL_BUY;

   if ( chinkou < Close[26] && tenkan <= kijun && Bid <= KumoLow) Order = SIGNAL_SELL;


   //+------------------------------------------------------------------+
   //| Signal End                                                       |
   //+------------------------------------------------------------------+

   //Buy
   if (Order == SIGNAL_BUY && ((EachTickMode && !TickCheck) || (!EachTickMode && (Bars != BarCount)))) {
      if(!IsTrade) {
         //Check free margin
         if (AccountFreeMargin() < (1000 * Lots)) {
            Print("We have no money. Free Margin = ", AccountFreeMargin());
            return(0);
         }

         if (UseStopLoss) StopLossLevel = Ask - StopLoss * Point; else StopLossLevel = 0.0;
         if (UseTakeProfit) TakeProfitLevel = Ask + TakeProfit * Point; else TakeProfitLevel = 0.0;

         Ticket = OrderSend(Symbol(), OP_BUY, Lots, Ask, Slippage, StopLossLevel, TakeProfitLevel, "Buy(#" + MagicNumber + ")", MagicNumber, 0, DodgerBlue);
         if(Ticket > 0) {
            if (OrderSelect(Ticket, SELECT_BY_TICKET, MODE_TRADES)) {
                                Print("BUY order opened : ", OrderOpenPrice());
                if (SignalMail) SendMail("[Signal Alert]", "[" + Symbol() + "] " + DoubleToStr(Ask, Digits) + " Open Buy");
                        } else {
                                Print("Error opening BUY order : ", GetLastError());
                        }
         }
         if (EachTickMode) TickCheck = True;
         if (!EachTickMode) BarCount = Bars;
         return(0);
      }
   }
-------------------------------------------------------------------------------------------------------





 
RaptorUK:

Please edit your posts above . . .    please use the   SRC   button to post code: How to use the   SRC   button.
What about your other 2 posts ?  shall I delete them ?
 
sparty07: I put a takeprofit level, but when price reach it, another order is executed again
So don't trigger on a level, trigger on a change in levels.
static int Order; int OrderPrev = Order; Order = SIGNAL_NONE;
 if ( chinkou > Close[26] && tenkan >= kijun && Ask >= KumoHigh) Order = SIGNAL_BUY;
 if ( chinkou < Close[26] && tenkan <= kijun && Bid <= KumoLow) Order = SIGNAL_SELL;
if (OrderPrev == Order || Order == SIGNAL_NONE) return; // No change or no signal.
 
WHRoeder:
So don't trigger on a level, trigger on a change in levels.

thank you sir, I try
Reason: