Abdul Salam :
do some body have the template for inserting magic number in EA
i have an EA and i want to insert EA to avoid closing my other open trades
Example:
Input:
//--- input parameter ... input ulong m_magic = 427474216; // magic number ...
Set Expert Magic Number:
//+------------------------------------------------------------------+ //| Expert initialization function | //+------------------------------------------------------------------+ int OnInit() { ... m_trade.SetExpertMagicNumber(m_magic); //---
Using:
//+------------------------------------------------------------------+ //| Expert tick function | //+------------------------------------------------------------------+ void OnTick() { ... if(ExtTrailingStop>0.0) for(int i=PositionsTotal()-1;i>=0;i--) if(m_position.SelectByIndex(i)) if(m_position.Symbol()==m_symbol.Name() && m_position.Magic()==m_magic) { if(!RefreshRates()) { PrevBars=iTime(1); return; } TrailingStop(m_position.Ticket(),ExtTrailingStop,ExtTrailingStep); }
Salam brother Abul Salem ...
Describing how to do it is harder than doing it.
If you have mq4 EA file format, upload it here and I will do it for you if you like :) ... It is easy.
![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
do some body have the template for inserting magic number in EA
i have an EA and i want to insert EA to avoid closing my other open trades