Problem with SL and TP when use buy/sell stop

 

HI,

int orderSend = OrderSend(Symbol(), OP_BUYSTOP, lotSize, Ask+OpenBuySellStop*_Point, Slippage,Bid-FixedSL*_Point,  Bid+FixedTP*_Point,
                comment, MagicNumber,TimeCurrent()+60*45);

FixedSL = 300 points
FixedTP = 1000 points

I got BUY STOP:
Price: 1.05837
SL: 1.04998
TP: 1.6298


So SL must be 300 points and TP 1000 points. If you can see both are wrong.


I think is problem here with Trigger Price because Bid do not get Price from Buy Stop?

 

Your TP should be the entry price + and SL entry price -

You don't use Ask/Bid, you use the trigger price.

 
Keith Watford #: You don't use Ask/Bid, you use the trigger price.

You buy at the Ask and sell at the Bid. Pending Buy Stop orders become market orders when hit by the Ask.

  1. Your buy order's TP/SL (or Sell Stop's/Sell Limit's entry) are triggered when the Bid / OrderClosePrice reaches it. Using Ask±n, makes your SL shorter and your TP longer, by the spread. Don't you want the specified amount used in either direction?

  2. Your sell order's TP/SL (or Buy Stop's/Buy Limit's entry) will be triggered when the Ask / OrderClosePrice reaches it. To trigger close to a specific Bid price, add the average spread.
              MODE_SPREAD (Paul) - MQL4 programming forum - Page 3 #25

 
William Roeder #:

You buy at the Ask and sell at the Bid. Pending Buy Stop orders become market orders when hit by the Ask.

  1. Your buy order's TP/SL (or Sell Stop's/Sell Limit's entry) are triggered when the Bid / OrderClosePrice reaches it. Using Ask±n, makes your SL shorter and your TP longer, by the spread. Don't you want the specified amount used in either direction?

  2. Your sell order's TP/SL (or Buy Stop's/Buy Limit's entry) will be triggered when the Ask / OrderClosePrice reaches it. To trigger close to a specific Bid price, add the average spread.
              MODE_SPREAD (Paul) - MQL4 programming forum - Page 3 #25

Why have you quoted me and not the OP?

It is not me that made any error, it was the OP.
I was just telling him where he was wrong.

 
Keith Watford #: Why have you quoted me and not the OP?

Because you posted an incorrect statement.

Keith Watford #: Your TP should be the entry price + and SL entry price - You don't use Ask/Bid, you use the trigger price.

Wrong. Using the “trigger price” makes your SL shorter and your TP longer, by the spread.

 
William Roeder #:Because you posted an incorrect statement. Wrong. Using the “trigger price” makes your SL shorter and your TP longer, by the spread.

@William Roeder, the OP is using a Pending Order, not a Market Order, so the future spread is unknown when placing the order.

So, @Keith Watford, is correct in stateing that the Take-Profit and Stop-Loss are in reference to the Trigger Price.

One may use the value of the  current spread or an average spread to compensate, but that is a different issue and much too complex for the OP to understand and implement at the moment.

 
Fernando Carreiro #:

@William Roeder, the OP is using a Pending Order, not a Market Order, so the future spread is unknown when placing the order.

So, @Keith Watford, is correct in stateing that the Take-Profit and Stop-Loss are in reference to the Trigger Price.

One may use the value of the  current spread or an average spread to compensate, but that is a different issue and much too complex for the OP to understand and implement at the moment.

Thank you Fernando, you have saved me needing to reply.

 
Keith Watford #: Thank you Fernando, you have saved me needing to reply.
You are welcome!
Reason: