Magic Number

 

HI ppl,

Can someone help me please put a magic number in my EA.. is because for only one chart the EA works well .. but when i try to use more than one chart for the ea the ea don't work well.

Can someone tell me what is the settings i have to put in the EA

Thanks

Fast_cris

 

I am not a coder but as i understand it is not difficult.

Take some EA from files' thread as a sample.

For example, SBS EA https://www.mql5.com/en/forum/174262/page2

Or just use "scripts for opening of manual orders with Magic Numbers" as an example https://www.mql5.com/en/forum/174881/page5

 
Fast_cris:
HI ppl,

Can someone help me please put a magic number in my EA.. is because for only one chart the EA works well .. but when i try to use more than one chart for the ea the ea don't work well.

Can someone tell me what is the settings i have to put in the EA

Thanks

Fast_cris

Try this one: int OrderSend( string symbol, int cmd, double volume, double price, int slippage, double stoploss, double takeprofit, string comment=NULL, int magic=0, datetime expiration=0, color arrow_color=CLR_NONE)

 

Thanks ppl for all help

 

testing several ea's simultaniously

can someone tell me please how can i check several ea's on difernts demo acounts simultaniously?

 
guy_ml:
can someone tell me please how can i check several ea's on difernts demo acounts simultaniously?

Yes, it depends on magic number options. And it depends on timeframes and systems/EAs you are using on the same copy of metatrader.

 

MagicNumber maker

If you want to make a unique MagicNumber you could always put it into code like this

//set a global variable with a name i.e. EXpertID

//you would only need to change this for each different EA

int ExpertID = 5200000000;

//then in your start function you add something like this

int MagicNumber;

MagicNumber = MakeMagicNumber();

//add a new function called MakeMagicNumber

int MakeMagicNumber()

{

int Symbol,Period,Month;

// then you can add some code to distiguish each currency pair

if (Symbol()=="GBPUSD" || Symbol()=="GBPUSDm")

Symbol = 1000000;

if (Symbol()=="EURUSD" || Symbol()=="EURUSDm")

Symbol = 2000000;

//you can add some code to distinguish your timeframe

if (Period()==1)

Period=10000;

if (Period()==5)

Period=20000;

//then if you need to you can add something else like a month

//you will rarely need this but I have used it for an EA I wrote

//but I decided not to use It placed 10 trades a month and was capable of

//keeping track of trades for each month for the past year

if (Month()==1)

Month=100;

// then you can simply add them and return them and you have a

//unique magic number

return( ExpertID + Symbol + Period + Month);

}

Reason: