Do you set the 'Magic number' for an object of the CTrade trade class? ( SetExpertMagicNumber )

Documentation on MQL5: Standard Library / Trade Classes / CTrade / SetExpertMagicNumber
- www.mql5.com
SetExpertMagicNumber(ulong) - CTrade - Trade Classes - Standard Library - MQL5 Reference - Reference on algorithmic/automated trading language for MetaTrader 5
Vladimir Karputov:
Do you set the 'Magic number' for an object of the CTrade trade class? ( SetExpertMagicNumber )
Do you set the 'Magic number' for an object of the CTrade trade class? ( SetExpertMagicNumber )
Yes. Look at the first bloc code I posted
michel picard :
Yes. Look at the first bloc code I posted
I asked for a reason.
You are initializing to ' magic ' and the positions are trying to sort by ' magicbuy '.
Vladimir Karputov:
I asked for a reason.
You are initializing to ' magic ' and the positions are trying to sort by ' magicbuy '.
My mistake. It's just typo bug but yes it's magic everywhere.
PS: I edited my first post.

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,
I note a strange behavior with my EA. Sometimes it closes the opened positions but without magic number.
I tried to figure out why but I can't find the reason
I'm using the following code to open trade
and this one to make some calculation
I use the following code to close my orders
When I use debugger some deal have magic number equal '0' but I don't closed them manually. They have been closed by the EA.
So I don't understand why
Someone can help me ?