add string to comments for ordersend

 

Hi all,

 
i want to add comment to each order and after googling around, i found some people use StringConcatenate

 
I wanted to add a variable value to the comments, so i try below. Nothing came out at comment , not even the "MA Diff Is" string

OrderSend(Symbol(), OP_SELL, start_lot, Bid, 3, 0, 0, StringConcatenate("MA Diff Is ",+ ma_diff), magic, 0, Red);

 

But when i change it to function like below, it works

OrderSend(Symbol(), OP_SELL, start_lot, Bid, 3, 0, 0, StringConcatenate("MA Diff Is ", abc()), magic, 0, Red); 

 

any idea what went wrong? 

 

Forget the StringConcatenate. Either do it before in a string variable or just forget it and use something like

 

OrderSend(Symbol(), OP_SELL, start_lot, Bid, 3, 0, 0, "MA Diff Is "+ ma_diff, magic, 0, Red);

But remember, the order comment has a length limit, if it's over the limit, no comment will be entered

 
Stuart Browne:

Forget the StringConcatenate. Either do it before in a string variable or just forget it and use something like

 

But remember, the order comment has a length limit, if it's over the limit, no comment will be entered

Hi Stuart,

 nothing was displayed at all

 maybe too long?  what's the limit?

 

edit : you are right. the issue is too long. i tried another dummy variable with defined 4 digit.. it works . googled around, found the max is 32 character

 

i can't create a new thread within 3 hours, so i temporary ask here


########## 

 

 For OrderProfit(), is it correct that


 1. if it is a buy order, it will calculate the tick bid value - buy order value and


2.   if it is a sell order, it will calculate the sell order value - tick ask value?


 Thanks 

 
bobo1974:

i can't create a new thread within 3 hours, so i temporary ask here


########## 

 

 For OrderProfit(), is it correct that


 1. if it is a buy order, it will calculate the tick bid value - buy order value and


2.   if it is a sell order, it will calculate the sell order value - tick ask value?


 Thanks 


if you need call profit of order position, you just need OrderProfit().

example:

if(OrderType()==OP_BUY) profitbuy=OrderProfit;


but if you want to calculate profit.. like HiddenTakeProfit or else...

you can use like you said.

profit buy= Bid-buyprice;

profit sell= sellprice-Ask;

 
Siti Latifah:


if you need call profit of order position, you just need OrderProfit().

example:

if(OrderType()==OP_BUY) profitbuy=OrderProfit;


but if you want to calculate profit.. like HiddenTakeProfit or else...

you can use like you said.

profit buy= Bid-buyprice;

profit sell= sellprice-Ask;

 Thanks Siti

 For the code below, that profit is close to 0? like 1 pip?

###

if(OrderType()==OP_BUY) profitbuy=OrderProfit; 

 
bobo1974:

 Thanks Siti

 For the code below, that profit is close to 0? like 1 pip?

###

if(OrderType()==OP_BUY) profitbuy=OrderProfit; 


if(OrderType()==OP_BUY) profitbuy=OrderProfit();


the code calls running profit for BUY POSITION.