StopLoss and TakeProfit with Bid and Ask

To add comments, please log in or register
quantumninja
48
quantumninja  

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



Mohamad Zulhairi Baba
15826
Mohamad Zulhairi Baba  
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.

whroeder1
17949
whroeder1  
quantumninja: Is the below usage of Bid and Ask correct ?


for Buy trade

price Ask

stoploss Ask-x

takeprofit Bid+y


for Sell trade

price Bid

stoploss Bid+x

takeprofit Bid-y

You buy at the Ask and sell at the Bid.
  • 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.)
quantumninja
48
quantumninja  
Thank you all so much, these are very informative answers 
To add comments, please log in or register