I am new to coding and I added a magic number to this Indicator. I get no errors but when I put the Indicator on 2 charts with 2 different EAs the Indicators TakeProfit Left and StopLoss Left only works with one of the EAs. Any help would be appreciated.
- one trade at a time using magic numbers
- adding a magic number to an EA
- Magic Number for different chart
Ian Macmillan:
I am new to coding and I added a magic number to this Indicator. I get no errors but when I put the Indicator on 2 charts with 2 different EAs the Indicators TakeProfit Left and StopLoss Left only works with one of the EAs. Any help would be appreciated.
I am new to coding and I added a magic number to this Indicator. I get no errors but when I put the Indicator on 2 charts with 2 different EAs the Indicators TakeProfit Left and StopLoss Left only works with one of the EAs. Any help would be appreciated.
So you have two EA running using the same indicator. Are you looking to have different magic numbers for each EA? Or the same Magic number for both?
You are setting the magic number in the Oninit function, but then calling that same magic number before creating a position. Maybe try to change where you set the magic number.
trade.SetExpertMagicNumber(InpMagicNumber);
It could be that the EA needs a unique magic number separate from other EAs. You might need to pass the magic number from the ea to the indicator.
Hope this helps,
chris
I have the 2 EAs working with 2 majic numbers. I guess what I need is a magic number for each Indicator, but I am not shure where to put that code. Yes I need to pass the magic number from the ea to the indicator.
![MQL5 - Language of trade strategies built-in the MetaTrader 5 client terminal](https://c.mql5.com/i/registerlandings/logo-2.png)
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