Magic number

 

What is the purpose of the magic number in EA codes, and what are the magic numbers for all the pairs

??

 
forextrend:
What is the purpose of the magic number in EA codes, and what are the magic numbers for all the pairs ??

Magic number is the number that you choose. It can be any number that you want eg 12345 or 432121 or 929292 just as you wish. It is used to mark sent order by the ea to find it later to eg. move stop loss or change take profit or close that order. With magic number you can manage many orders with many ea's and each one of them will know which orders are signed to it. Magic number is independent from the currency or timeframe.

 

i'm interested to know as well..

how do you use it? and know the magic number to put? sorry newbie

 
antone:
i'm interested to know as well.. how do you use it? and know the magic number to put? sorry newbie

EA should have it in the settings. For example:

TakeProfit = 70;

StopLoss = 100;

Magic Number = 1000;

...........

If you use many EAs in one Metatrader so set magic number value to the different numbers for different pairs.

There are exeptional cases with some EAs but usually coders are telling about it.

 
newdigital:
EA should have it in the settings. For example:

TakeProfit = 70;

StopLoss = 100;

Magic Number = 1000;

...........

If you use many EAs in one Metatrader so set magic number value to the different numbers for different pairs.

There are exeptional cases with some EAs but usually coders are telling about it.

so how do you set the magic number on the trade? is it the order number?

i know how to put in the EA, how about how to put it in the oreder?

 
antone:
so how do you set the magic number on the trade? is it the order number? i know how to put in the EA, how about how to put it in the oreder?

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)

 
Kalenzo:
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)

not that.. how do i make the order the same magic number as what i place in my EA? is it in the comment?

 
antone:
not that.. how do i make the order the same magic number as what i place in my EA? is it in the comment?

You mean - you have ea that controls orders eg, by magic number 11111 and you want to open manually another trade and set the magic for that manual order to 11111 so the ea could control it?

 

What if I pick a number that someone else is using, will our trades get mixed up?

 
matrixebiz:
What if I pick a number that someone else is using, will our trades get mixed up?

LOL, no, magic number is separated for each platform (each metatrader instalation).

 

So if I use 1111 and you use 1111 we are still ok? adn we are on the same platform. Sorry, just confused a bit

Reason: