Difference in TP and SL in OrderSend command

 

Hi,

I have a problem. In my trading history or in opened trade list I see differnce in TP or in SL. I set example TP and SL = 5 pip. After opening trade the TP and SL has not the required value:
The EA open a trade usdjpy at 113.459, I see TP 113.504 and SL 113.404. But I send with the OrderSend command 5 pip difference.

last_order_ticket=OrderSend(Symbol(),OP_SELL,newlots,Bid,20,Ask+order_sl,Ask-order_tp,order_comment,magic_number,0,clrWhite);

or as long

last_order_ticket=OrderSend(szimbolum,OP_BUY,newlots,Ask,20,Bid-order_sl,Bid+order_tp,order_comment,magic_number,0,clrWhite);

Do I use the right code? In my perception after this command in long @113.459 the TP should be 113.509 instead of 113.504

Thanks for help

 
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.)

Your code is currently symmetrical, you would gain TP-spread or loose SL-spread. They do not include the spread.

If you change it ("113.509 instead of 113.504,") then the gain would be TP. It includes the spread.

 
whroeder1:

Your code is currently symmetrical, you would gain TP-spread or loose SL-spread. They do not include the spread.

If you change it ("113.509 instead of 113.504,") then the gain would be TP. It includes the spread.

Thanx!
 
double tp= ask + tp1;
                  
       
                  

  double tp= bid-tp1;

i confuse because where we take positive and negative is the line with respect to bid and ask is correct or not


                  
Reason: