Stoploss points are higher than my takeprofit points! Help!

Back to topics list To post a new topic, please log in or register
avatar
49
Opengates 2015.04.08 14:51
 

Dear Gurus in the house,

Please I need enlightenment on this: I used 30p for my stoploss and 30p for takeprofit also but after the ea opens the order, I noticed that the stoploss points was higher than takeprofit point sometimes by almost 10p. What do you think might be responsible for this as when the ea makes 1 loss and 1 win. i ended up losing some pips for those trades.

Any help that brings solution to this from you guys would be appreciated.

Thanks in advance.

avatar
13009
WHRoeder 2015.04.08 14:58 #
 

Opengates: Please I need enlightenment on this:

sometimes by almost 10p

Any help

  1. Your code is broken
  2. Not adjusting for the spread.
  3. How do you expect any when you haven't posted your broken code?
avatar
Moderator
3427
GumRai 2015.04.08 15:17 #
 
Opengates:

Dear Gurus in the house,

Please I need enlightenment on this: I used 30p for my stoploss and 30p for takeprofit also but after the ea opens the order, I noticed that the stoploss points was higher than takeprofit point sometimes by almost 10p. What do you think might be responsible for this as when the ea makes 1 loss and 1 win. i ended up losing some pips for those trades.

Any help that brings solution to this from you guys would be appreciated.

Thanks in advance.

Learn to be consistent and be clear whether you are referring to Points or Pips.
avatar
49
Opengates 2015.04.08 17:50 #
 
extern double        TakeProfit   = 300;    // Take Profit 
extern double        StopLoss     = 300;    // Stop Loss

//=============== Open Buy order here ========================
 if(Opn_B==true)
  { 
 
    RefreshRates();                        // Refresh rates 
    bid = NormalizeDouble(MarketInfo(Symb,MODE_BID),Digits); // Request for the value of Bid      
    SL=bid-StopLoss*Point;     // Calculating SL of opened     
    TP=bid+TakeProfit*Point;   // Calculating TP of opened
    Ticket=OrderSend(Symb,OP_BUY,lot,Ask,2,SL,TP); //Opening Buy      
     if (Ticket>0) // Success       
    {        
    Print("The Order for BUY was opened ",Ticket);        
    return(0);         // Exit start()      
     }     
    if (Error==1)      // Processing errors       
    return(1);                                // Exit start()     
   }     
   
   //======= Open Sell order here =======================================
 if (Opn_S==true)
  { 
   
    RefreshRates();                        // Refresh rates 
    ask = NormalizeDouble(MarketInfo(Symb,MODE_ASK),Digits); // Request for the value of Ask    
    SL=ask+StopLoss*Point;     // Calculating SL of opened     
    TP=ask-TakeProfit*Point;   // Calculating TP of opened
    Ticket=OrderSend(Symb,OP_SELL,lot,Bid,2,SL,TP); //Opening Sell
   if (Ticket>0)
    {      
    Print("The Order for SELL was opened ",Ticket);        
    return(0);                             // Exit start()      
     }   

avatar
49
Opengates 2015.04.08 17:51 #
 
Here is it. Thank you
avatar
16
xiruko 2015.04.08 18:39 #
 

1. The OrderSend() for SELL orders is wrong. SELL orders are opened at Bid price (you are opening them at Ask price).

2. The reason why your loss is bigger than your profit when your win 1 and lose 1 using equal SL and TP is because of the spread.

For example:

You open a BUY order at ASK price. BUY orders are closed at BID price, so you calculate the stop loss and take profit for that order as:

SL=bid-StopLoss*Point;     // Calculating SL of opened
TP=bid+TakeProfit*Point;   // Calculating TP of opened

Now, if the position ends up being a losing one, you will have a loss of StopLoss points. However, if the position ends up being a winner one, you will have a profit of (TakeProfit - SPREAD) points.

So, if you want to win or lose the same amount of points in a position using equal StopLoss and TakeProfit parameters, you must calculate, for a BUY position, the SL and TP levels as:

SL=bid-StopLoss*Point;     // Calculating SL of opened
TP=ask+TakeProfit*Point;   // Calculating TP of opened

But be aware that by adjusting for the spread like this way, the market will have to move StopLoss points to hit your SL, but will have to move (TakeProfit + SPREAD) points to hit your TP.

Regards. 

 

 

avatar
13009
WHRoeder 2015.04.08 18:57 #
 
Ticket=OrderSend(Symb,OP_BUY,lot,Ask,2,SL,TP); //Opening Buy    
Code fails if Symb is not the current pair
avatar
49
Opengates 2015.04.09 10:42 #
 

Xiruko and WHRoeder,

Thanks so much. I've gotten it right by your guidance.

More grease to your elbow. You are both great!

Best regards

Back to topics list  

To add comments, please log in or register