Hi, while building my robot I looked into the CExpert class.
I see the Symbol-Check but there is no check for the magic_number.
What am I missing ? (the Expert should only handle its own orders right?)
thanks
Robert
#include <Trade\PositionInfo.mqh> #include <Trade\Trade.mqh> CPositionInfo m_position; CTrade m_trade; void OnTick() { for(int i=PositionsTotal()-1; i>=0; i--) if(m_position.SelectByIndex(i)) { Print("Magic Number ",m_position.Magic()); } } } }
Hi, while building my robot I looked into the CExpert class.
I see the Symbol-Check but there is no check for the magic_number.
What am I missing ? (the Expert should only handle its own orders right?)
Whtn you instantiate Ctrade, you can set some parameters to it:
CTrade m_trade; m_trade.SetExpertMagicNumber(Magic1); m_trade.SetDeviationInPoints(m_slippage);
It depends on how you code your EA.. there are other ways too.
You can also take a look at public functions on Trade.mqh. line 91 is about SetExpertMagic..
\Include\Trade\Trade.mqh
Whtn you instantiate Ctrade, you can set some parameters to it:
It depends on how you code your EA.. there are other ways too.
You can also take a look at public functions on Trade.mqh. line 91 is about SetExpertMagic..
\Include\Trade\Trade.mqh
He wants to find the magic number on open market orders. Do not set the magic number before the order you have written is opened. "m_trade.SetExpertMagicNumber(Magic1);" it won't do any good.
Whtn you instantiate Ctrade, you can set some parameters to it:
It depends on how you code your EA.. there are other ways too.
You can also take a look at public functions on Trade.mqh. line 91 is about SetExpertMagic..
\Include\Trade\Trade.mqh
Thank you rrochi, I can see now also in CExpert class.
void CExpert::Magic(ulong value) { if(m_trade!=NULL) m_trade.SetExpertMagicNumber(value); . . . . . .

- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
Hi, while building my robot I looked into the CExpert class.
I see the Symbol-Check but there is no check for the magic_number.
What am I missing ? (the Expert should only handle its own orders right?)
thanks
Robert