quantumninja:
Is the below usage of Bid and Ask correct ?
let x and y be some double value
for Buy trade
price Ask
stoploss Ask-x
takeprofit Bid+y
for Sell trade
price Bid
stoploss Bid+x
takeprofit Bid-y
technically correct, as long as the price (stoploss or Takeprofit value) not within StopLevel limit.
but, for better calculation of pip distance in point;
Buy:
Stoploss = Bid-x
TakeProfit = Bid+y
Sell:
Stoploss = Ask+x
TakeProfit = Ask-y
but, it all depends on you as a coder.
quantumninja: Is the below usage of Bid and Ask correct ?
You buy at the Ask and sell at the Bid.
for Buy trade
price Ask
stoploss Ask-x
takeprofit Bid+y
for Sell trade
price Bid
stoploss Bid+x
takeprofit Bid-y
- Your buy order's TP/SL are triggered when the Bid reaches it. Not the Ask.
-
Your sell order's TP/SL will be triggered when the Ask reaches it. To trigger at
a specific Bid price, add the average spread.
MODE_SPREAD (Paul) - MQL4 and MetaTrader 4 - MQL4 programming forum - Page 3 - The charts show Bid prices only. Turn on the Ask line to see how big the spread is (Tools -> Options {control-O} -> charts -> Show ask line.)
Thank you all so much, these are very informative answers
![MQL5 - Language of trade strategies built-in the MetaTrader 5 client terminal](https://c.mql5.com/i/registerlandings/logo-2.png)
You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
Hi All,
sorry for basic question,
i am currently using MQL5, the CTrade Class to open trades
The below parameters for Buy
CTrade::Buy(const double volume,const string symbol=NULL,double price=0.0,const double sl=0.0,const double tp=0.0,const string comment="")
The below parameters for Sell
bool CTrade::Sell(const double volume,const string symbol=NULL,double price=0.0,const double sl=0.0,const double tp=0.0,const string comment="")
Is the below usage of Bid and Ask correct ?
let x and y be some double value
for Buy trade
price Ask
stoploss Ask-x
takeprofit Bid+y
for Sell trade
price Bid
stoploss Bid+x
takeprofit Bid-y