Magic number - page 3

 

Magic number

Hi i'm a bit confused as to when to change the magic number. Do i change them when I attach the same EA to different charts, or should I leave them all the same. Or does this number only matter when you have 2 diffrent EA's running on the same charts?

Thanks in advance

 

Is this function possible?

I'm trying to develop an EA which--when opened--will open every currency pair available and trade according to the rules.

Given that my broker has somewhere in the neighborhood of 50 pairs available to trade, I don't really want to have to constantly click and open and click and open, etc.

On the other hand, can someone please explain the magicnumber principle?

I have always thought that the magicnumber is required if a terminal has more than 1 ea. Other programmers are telling me that if the EAs are on different symbols or different timeframes, but NEVER on the same symbol and timeframe, that I don't need to worry about setting a magic number.

 

I moved your post to this thread where you can find the answer i hope.

The other thread related to this subject is this one https://www.mql5.com/en/forum/176445

 

Thank you for your efforts NewDigital, I'm familiar with both threads, however, neither seem to answer my question fully, perhaps I wasn't clear enough.

I know what MagicNumber DOES: it helps an EA identify which trade belongs to it.

I don't know when a MagicNumber is NEEDED.

Is it needed when...

  • ...multiple EAs are attached on a terminal?
  • ...there are several EAs for one pair?
  • ...two or more EAs use the same timeframe?
  • ...any combination of the above?
 

I am always trying to use different magic numbers for any case you described. Sometimes the coders say: "use same magic number with my EA". If the coder did not say like that so I will use dffrent magic number for any EA/pair/timeframe combination.

For example:

- Codersguu said that his MaChannel (elite section) can be used with same magic number if trading on one copy of Metatrader on few charts but for MaChannel only on Metatrader;

- davidke20 said the same about his 10p3v0.03 (public EA);

- project1972 said the same about his Alpha and Electra EAs (elite section).

All those cases are about testing just one EA with many charts.

I understand magic number as personal protection: if I use different magic number for any case so I am sure that EA will know exactly which order should be modified or closed for example.

 

How to halt other EAs when one is running in the same account?

Say I want to maximize my capital & time in the same account by having more than one EA attached but I do not want more than one to run which might blow up my account, is there a way to do it? Otherwise the account is just sitting there, waiting for only one EA signal to occur.

Once that EA has finished it's run(taken profit or stoploss), all attached EAs

becomes eligible again.

 
scalpmaster:
Say I want to maximize my capital & time in the same account by having more than one EA attached but I do not want more than one to run which might blow up my account, is there a way to do it? Otherwise the account is just sitting there, waiting for only one EA signal to occur.

Once that EA has finished it's run(taken profit or stoploss), all attached EAs

becomes eligible again.

a simple way of doing that is to give all the experts the same magic number , then check the open trades NOT by the currency but WITH the magic numberso if there is an open trade dont open a new trade till that one close ... add that code to all the expert " a funciton to check the open trades "

Simple and it works

 
MiniMe:
a simple way of doing that is to give all the experts the same magic number , then check the open trades NOT by the currency but WITH the magic numberso if there is an open trade dont open a new trade till that one close ... add that code to all the expert " a funciton to check the open trades " Simple and it works

How to "check the open trades NOT by the currency but WITH the magic numberso if there is an open trade dont open a new trade till that one close ... add that code to all the expert " a funciton to check the open trades"?

What does that code look like?

 

Besides Magic Number, What other methods can be used for halting EAs?

 
scalpmaster:
Besides Magic Number, What other methods can be used for halting EAs?

- close the offending chart - seriously! But why would you want 'another' method, that afterall is what magics are for, to allow you to differentiate between open order types. As for the code, practically every EA that is freely available scans open orders in this way, so if you honestly can't find this code, it is probably fair to say you are not a programmer, so maybe you should not be risking money on your own 'creations'...