Download MetaTrader 5

What is and how to set the magic number at EA's ?

To add comments, please log in or register
You sell neither signals nor apps? No problem, everyone can make profit!
eduardo fiuza
228
eduardo fiuza 2008.01.28 18:18 
I am testing some EA's but I do not know what is and how to set the "magic number".

What determine wich magic number to use?

Do I set the same magic number at one currency pair at different timeframes? or not?

Do I set the same magic number at different currencies? What happens if a set the same one?

Can I use the magic number to make the EA manage the trades I open manually?



I want to understand what is magic number.

Thanks for any information.

Eduardo
Ray
2650
Ray 2008.01.28 19:58  

Magic number is intended to be used for trade identification. Implementation varies.

It is set when the trade is opened by an EA with the OrderSend() command.

Example usage:

You have two EA trading EURUSD

To permit each EA to recognize trades that "belong to it" set a different magic number (ID) with each EA.

eduardo fiuza
228
eduardo fiuza 2008.01.28 20:26  
Thank you.

But if I have only one EA, two EURUSD charts at different time frames? Do I have to change the magic number? What number to define? Anyone?

Each window, independently of the currency or time frame, need your own magic number to MetaTrader identify in what trade act?

I am not talking about code. I am talking about the magic number to complete when I drag the EA from navigator window to chart window.


Was I clear? sorry the poor english.


thanks
Erman Ardianto
1141
Erman Ardianto 2008.01.28 20:55  
I believe Phy can solve your problem better, but I was using Period() as a magic number in case like that.
Ray
2650
Ray 2008.01.29 01:04  

"But if I have only one EA, two EURUSD charts at different time frames? Do I have to change the magic number? What number to define? Anyone?"

Try "1" and "2"

eduardo fiuza
228
eduardo fiuza 2008.01.29 20:43  
Then it is simple?

I just have to determinate a number I choose each chart window? Ok!!

Is there a specific magic number If I want the EA manage the trade opened manually?

Thanks
Ray
2650
Ray 2008.01.29 21:08  

Is there a specific magic number If I want the EA manage the trade opened manually?

Probably "0"


You could use the Comment to identy manual trades, and add a test for specific comment in the EA.

Rashid Umarov
Admin
11820
Rashid Umarov 2008.01.30 09:00  
Chandra Sekhar
24
Chandra Sekhar 2009.03.30 17:11  

Hello,

I have five charts on one platform for five diferent currencies (one chart per currency).

I apply same EA for all the five charts (same EA for all the five currecies).

Do I need to change the magic number of the EA for each chart (each currency)?

Thanks

-Chandra

Chandra Sekhar
24
Chandra Sekhar 2009.03.30 17:16  
phy wrote >>

Is there a specific magic number If I want the EA manage the trade opened manually?

Probably "0"


You could use the Comment to identy manual trades, and add a test for specific comment in the EA.

Hello Phy,

I have five charts on one platform for five diferent currencies (one chart per currency).

I apply same EA for all the five charts (same EA for all the five currencies).

Do I need to change the magic number of the EA for each chart (each currency)?

Thanks

-Chandra

Tovan Adams
168
Tovan Adams 2009.03.31 17:52  
Chandra_Sekhar wrote >>

Hello Phy,

I have five charts on one platform for five diferent currencies (one chart per currency).

I apply same EA for all the five charts (same EA for all the five currencies).

Do I need to change the magic number of the EA for each chart (each currency)?

Thanks

-Chandra

Hi Chandra,

Short answer is no. Correct answer is - it depends. Your EA must be smart enough to determine which currecy it is operating on if there are any order modifications or deletions done. Magic number is one way to do that, although a good EA will use other methods as well such as currency pair checking.

You will need to determine whether or not your code is robust enough to operate without a magic number change - or whether or not it even uses the magic number

- Tovan

12
To add comments, please log in or register