Takeprofit not being exercised?

 

Hi all,

I could really do with some help on my EA. I can't see why the takeprofit is not being exercised:

SL=Low[1];
Risk = NormalizeDouble(MagicPrice-SL,MarketInfo(Symbol(),MODE_DIGITS));
TP = 3*Risk;

Ticket = OrderSend(Symbol(), OP_BUYLIMIT, 1, MagicPrice, 3, SL, TP, "", MagicNumber, 0, Red);

where MagicPrice is just figured out from some averages. MT4 reports the OrderSend is submitted OK. All the SL get exercised when they are needed, but none of the TP?

Help? Thanks in advance.

 

can u give us the values MagicPrice & SL

 
  1. SL=Low[1];
    Risk = NormalizeDouble(MagicPrice-SL,MarketInfo(Symbol(),MODE_DIGITS));
    TP = 3*Risk +MagicPrice;
    

    A TP of N pips makes no sense. A TP of N pips from somewhere does.


  2. MarketInfo(Symbol(),MODE_DIGITS) is the same a just Digits.
  3. Ticket = OrderSend(Symbol(), OP_BUYLIMIT, 1, MagicPrice, 3, SL, TP, "", MagicNumber, 0, Red);
    EA's should adjust to 5 digit brokers, TP, SL, and slippage
    //++++ These are adjusted for 5 digit brokers.
    double  pips2points,    // slippage  3 pips    3=points    30=points
            pips2dbl;       // Stoploss 15 pips    0.0015      0.00150
    int     Digits.pips;    // DoubleToStr(dbl/pips2dbl, Digits.pips)
    int     init(){
        if (Digits == 5 || Digits == 3){    // Adjust for five (5) digit brokers.
                    pips2dbl    = Point*10; pips2points = 10;   Digits.pips = 1;
        } else {    pips2dbl    = Point;    pips2points =  1;   Digits.pips = 0; }
        // OrderSend(... Slippage.Pips * pips2points, Bid - StopLossPips * pips2dbl
    

  4. On ECN brokers you must open the order with no TP/SL, and set the TP/SL once it opens.
 
WHRoeder:
  1. A TP of N pips makes no sense. A TP of N pips from somewhere does.

Sorry - that was a typo. I have that in my EA already.

MagicPrice is just the average of the last two days ranges.

I've adjusted the slippage for Digits, but I get the same result. The OrderSend() submits successfully and the OrderTakeProfit() returns the correct number, but the price moves straight through without taking. I can see the EA taking some profits every now and again when I test it which is even more frustrating.

What am I missing? Thanks for your help so far.

Reason: