Reply

Duplicate this EA with automatic magic number updater.

5 replies

Count-Roy

Subscriber, bbp_participant, community, 69 replies.

Visit profile

9 years ago #113370

It would be nice to have a function that lets you duplicate your EA with one push of the button that automatically scales up the magic numbers.

 

say you have a EA with 20 different magic numbers and you wish to have two or more EA’s with the same rule set running simultaneously. Then all one would have to do is hit the (duplicate/ copy) EA button and EA Wizard would recognize the current magic numbers and replicate the EA but with the next normally reoccurring sequence of numbers; in this case 21 – 40 etc.

 

greetz,

 

Roy

 

0

Mark Fric

Administrator, sq-ultimate, 2 replies.

Visit profile

9 years ago #128940

thanks for suggestion, I agree it would be sometimes useful.

Mark
StrategyQuant architect

0

beniko

Subscriber, bbp_participant, community, 31 replies.

Visit profile

9 years ago #129607

Hello Count-Roy,

 

Right now something you can do is create all the variables you are going to use for magic numbers and then create a new rule that does the following:

 

If

bar is open

 

Then

assign values

MagicNumber2=MagicNumber1+1

MagicNumber3=MagicNumber2+1

MagicNumber4=MagicNumber3+1

etc…

 

In other words the user has to configure the 1st MagicNumber and all the others will be calculated based on that.

 

Mark, as I suggested in my latest topic an initialization-tab would be useful. This is a good example for which somebody could use it, since the EA wouldn’t do the above calculations after each new bar is created.

 

Regards

0

Count-Roy

Subscriber, bbp_participant, community, 69 replies.

Visit profile

9 years ago #129654

still how does this look in a sqw file? could you share the template? please.

0

beniko

Subscriber, bbp_participant, community, 31 replies.

Visit profile

9 years ago #129655

Here you are. I also added a rule that writes the Magic Numbers on the chart.

0

D0NKbet

Subscriber, bbp_participant, community, 6 replies.

Visit profile

9 years ago #129757

In my self developed EA’s I’m using a bit of code that generates a unique magic number based on…

 

– Timeframe

– Symbol

– EA Name

// create uniq magic number for currency pair and timeframe
   int MNSymbol,MNSymbolCalc;
   //turn the Symbol() into an ASCII string and add each character into MNSymbol
   for(int a=0;a<StringLen(Symbol());a++){
      MNSymbolCalc=StringGetChar(Symbol(), a);
      MNSymbolCalc=((MNSymbolCalc-64)*(MathPow(10,(a))));//subtract 64 b/c ASCII characters start at 65, multiply result by the a-th power for neatness (unnecessary though)
      MNSymbol = MNSymbol+MNSymbolCalc;
   } 
   int MNPeriod=Period();
   
   // turn the EA Name into an ASCII string
   int MNExpert,MNExpertCalc;
   for(int a=0;a<StringLen(WindowExpertName());a++){
      MNExpertCalc=StringGetChar(WindowExpertName(), a);
      MNExpertCalc=((MNExpertCalc-64)*(MathPow(10,(a))));//subtract 64 b/c ASCII characters start at 65, multiply result by the a-th power for neatness (unnecessary though)
      MNExpert = MNExpert+MNExpertCalc;
   }
   // calculate uniqe magic number
   MagicUnique=MathAbs(MNExpert + MNSymbol + MNPeriod);
   Comment("Unique Magic Number: " + IntegerToString(MagicUnique));

It’s not perfect and should be modified to create different for BUY / SELL positions but this way it’s sure that the number is unique even if you attach the same EA on different currency pairs or timeframes 

 

Perhaps you could add something like that into EA Wizard !? Let’s say the code above + the difference for buy and sell order + a running counter depending on how many rules for making orders there are. So nobody would have to care about the magic numbers anymore. 

0

Viewing 5 replies - 1 through 5 (of 5 total)