Your TP should be the entry price + and SL entry price -
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.
-
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?
-
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
You buy at the Ask and sell at the Bid. Pending Buy Stop orders become market orders when hit by the Ask.
-
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?
-
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.
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.
@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.
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
HI,
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?