Magic Number X Chart ID in MQL4
lacp.forex:. But how to relate the MagicNumber with the ChartID
There isn't any. An EA on any chart can use any magic number it likes.
- Change EA to use its ChartID as its magic number
- Change EA to create a terminal variable that maps ChartID to magic number.
name=Symbol() + EnumToString( ENUM_TIMEFRAMES(_Period) ) + " cid=" + IntegerToString(ChartID); GlobalVariableSet(name, MagicNumer);
The functions ChartFirst and ChartNext allow to know the Chart ID of all open Charts. The ChartClose function allows to close a specific Chart and the corresponding EA.
The OrderMagicNumber function allows to discover which EA is not producing the expected result. But how to relate the MagicNumber with the ChartID in order to close the correct Chart and corresponding EA that is not running properly ?
Thanks.