Magic Number

6 replies

ForexTrader

Subscriber, bbp_participant, community, 34 replies.

Visit profile

6 years ago #112774

When I make an EA I put one magic number for sell orders and another one for buy orders. How can I put the EA on multiple pairs since it will open 2 or 3 sell and/or buy orders with the same magic number? How can I solve this problem since I know that the magic number must be unique and only for one order?

 

Thanks in advance

0

mantadiver

Subscriber, bbp_participant, community, 33 replies.

Visit profile

6 years ago #127139

My crude attempt at solving this was to create two parameters – “Magic_Long” & “Magic_Short” with default numbers 1 & 2 respectively.

 

Select  “Magic_Long” for the long order rule and  “Magic_Short”  in the short order rule.

 

Then on each new pair you add the EA you need to increment the numbers in the user definable inputs. So pair 1 could use 1 & 2, pair 2 – 3 & 4, pair 3 – 5 & 6 etc etc thereby providing unique long/short magic numbers for each pair.

 

It’s probably a poor attempt at solving this and I too would be interested in a more eloquent solution but for now it works.

0

Mark Fric

Administrator, sq-ultimate, 3 replies.

Visit profile

6 years ago #127271

this is exactly the solution – create variables for your magic numbers and you can change them when applying EA to the chart.

Mark
StrategyQuant architect

0

ForexTrader

Subscriber, bbp_participant, community, 34 replies.

Visit profile

6 years ago #127339

So Mark I have to do it manually? When I add the EA to a new pair I have to change the Magic number myself? Is there a way to make the EA able to do it by itself?

0

Mark Fric

Administrator, sq-ultimate, 3 replies.

Visit profile

6 years ago #127376

you should do it manually – when you attach EA to the chart you can edit its parameters- so just set your MagicNumber parameter to unique value.

Mark
StrategyQuant architect

0

ForexTrader

Subscriber, bbp_participant, community, 34 replies.

Visit profile

6 years ago #127384

Mark because I am confused, the EA knows which order is its by the Magic Number only, or by the Magic Number AND the pair? Because if it’s the latter, you can have the same Magic Number on every order on different pairs. For example you can have a sell order on EUR/USD with a magic number 12345, a sell order on USD/CHF with the same magic number, a sell order on EUR/GBP with the same magic number e.t.c.  Am I right? Or I need a different magic number for every pair? 10 sell orders on 10 pairs with 10 different magic numbers?

 

Thanks!

0

Mark Fric

Administrator, sq-ultimate, 3 replies.

Visit profile

6 years ago #127464

you should use unique magic number for every pair,it doesn’t check also pair in most of the functions.

Mark
StrategyQuant architect

0

Viewing 7 posts - 1 through 7 (of 7 total)