Order Comment in mql4

 

Hi everyone

I have a question

I printed comment of an order closed by Take profit (I selected deal with OrderSelect() from trade history)

I expected for get comment that i sent with OrderSend() but what i got in Print is this : 

my ordercomment:

string ordercomment = "0";

but what i got when printed:

Print(OrderComment());

// result = "0[tp]"

Do [tp] append to end of closed deals by tp?

Thanks

Extract profit down to the last pip
Extract profit down to the last pip
  • www.mql5.com
The article describes an attempt to combine theory with practice in the algorithmic trading field. Most of discussions concerning the creation of Trading Systems is connected with the use of historic bars and various indicators applied thereon. This is the most well covered field and thus we will not consider it. Bars represent a very artificial entity; therefore we will work with something closer to proto-data, namely the price ticks.
 
yas: Do [tp] append to end of closed deals by tp?

Broker specific modification.

Can't modify comments.
          Metaquotes language: OrderComment() is not able to be modified - Expert Advisors and Automated Trading - MQL5 programming forum (2013)

Not a good idea to use comments, brokers can change comments, including complete replacement.

 
You have to see your broker specific … at my broker , for example , is the same… once the order is closed by SL or TP, a [SL] or a [TP will be  added to the comment . But I have observed that if the trade is still open , or the trade was closed NOt by SL or tp, order comment remains as I have set it. But this doesn’t mean that it will be like this forever. As it has been said, should avoid using comments as filters 
 
William Roeder #:

Broker specific modification.

Can't modify comments.
          Metaquotes language: OrderComment() is not able to be modified - Expert Advisors and Automated Trading - MQL5 programming forum (2013)

Not a good idea to use comments, brokers can change comments, including complete replacement.

Thank you dear William, i got it. Now i know it is not good idea to use order comments.

Do you think OrderOpenTime() can work as a good filter to filter an order from others?

 
Daniel Cioca #:
You have to see your broker specific … at my broker , for example , is the same… once the order is closed by SL or TP, a [SL] or a [TP will be  added to the comment . But I have observed that if the trade is still open , or the trade was closed NOt by SL or tp, order comment remains as I have set it. But this doesn’t mean that it will be like this forever. As it has been said, should avoid using comments as filters 

Hey dear Daniel
You are right, I use comments as filters but now i know its not good idea, so do you think OrderOpenTime() can work as a good filter?

Thank you for help

 
yas #:

Hey dear Daniel
You are right, I use comments as filters but now i know its not good idea, so do you think OrderOpenTime() can work as a good filter?

Thank you for help

I guess it depends on the strategy… in your strategy, this EA will open many trades in the same chart? 
 
Daniel Cioca #:
I guess it depends on the strategy… in your strategy, this EA will open many trades in the same chart? 

Yes exactly

I want to create a filter to detect a closed order by tp and it is necessary to a parameter be unique for each order that i open or opened or will open.

I used order comment but today i got that broker could modify order comment in trade history puol. Its my new idea: use OrderOpenTime() that it is unique for each deal and i will save this time in somewhere for use next(i will not open 2 or more orders in same time).

 
yas #: Yes exactly. I want to create a filter to detect a closed order by tp and it is necessary to a parameter be unique for each order that i open or opened or will open. I used order comment but today i got that broker could modify order comment in trade history puol. Its my new idea: use OrderOpenTime() that it is unique for each deal and i will save this time in somewhere for use next(i will not open 2 or more orders in same time).

If you need "something" that is unique to each trade then use their ticket numbers which are already unique. That is what the "ticket" is for. Why complicate matters?

If you need to group trades, then use the "Magic Number ID" that you can assign to them when you place the order.

So, in conclusion, use the "tickets" to uniquely identify each trade, and use the "magic number" to identify a basket or group of trades.

 
Fernando Carreiro #:

If you need "something" that is unique to each trade then use their ticket numbers which are already unique. That is what the "ticket" is for. Why complicate matters?

If you need to group trades, then use the "Magic Number ID" that you can assign to them when you place the order.

So, in conclusion, use the "tickets" to uniquely identify each trade, and use the "magic number" to identify a basket or group of trades.

Thank you dear Fernando 
You are right I decided to use ticket number.

 
yas #:Thank you dear Fernando. You are right I decided to use ticket number.
You are welcome!
Reason: