Apply Same EA with different parameters to multiple charts in one go

To add comments, please log in or register
MacGiamma
73
MacGiamma  

Hi All,

I am operating on several crosses and for each one I would need to apply the same EA but with different parameters e.g. for Cross EURUSD the variable leverage is 1, while for USDCAD is 2, for CHFJPY 3 etc

I can certainly do it manually although this is quite repetitive and time consuming.

Is there a way to create a script/EA that will apply the aforementioned EA to multiple chart in just one go?

I have found somewhere else in the forum that I could use the ChartApplyTemplate function, however this will call a template where the EA variables are already set. So one way could be to create different templates for different crosses just once. This is better than doing it all the time, but is there a faster solution?

Thanks,

MG

William Roeder
20207
William Roeder  
MacGiamma: this is quite repetitive and time consuming.
writing code is even more.
MacGiamma
73
MacGiamma  

Interesting pov WR. I have always thought that programming is the most efficient and effective way to avoid repetitive tasks;)

Anyway I have tried the ChartApplyTemplate function and it works at least for EA (Not sure for scripts which I would like to have a solution too). The only drawback is that I need to create as many templates as the crosses I am operating. 

Any other suggestion to make the process more efficient and/or applicable to scripts as well?

Tx,
MG

andrew
405
andrew  
MacGiamma:

Hi All,

I am operating on several crosses and for each one I would need to apply the same EA but with different parameters e.g. for Cross EURUSD the variable leverage is 1, while for USDCAD is 2, for CHFJPY 3 etc

I can certainly do it manually although this is quite repetitive and time consuming.

Is there a way to create a script/EA that will apply the aforementioned EA to multiple chart in just one go?

I have found somewhere else in the forum that I could use the ChartApplyTemplate function, however this will call a template where the EA variables are already set. So one way could be to create different templates for different crosses just once. This is better than doing it all the time, but is there a faster solution?

Thanks,

MG

Can you assign the variables based on the value of Symbol().
  if (Symbol()=="EURUSD")) var1=4;. //etc
Attach the EA to your charts and this sets the variables in one place.


MacGiamma
73
MacGiamma  

Hi Andrew,

Thanks for the tip this is indeed very helpful.

Instead of the IF operator I'd like to use the SWITCH operator, but this does not seem to be working as SWITCH cases just use integer and the symbol is a string…Is there any way to get around it, otherwise I guess I will stick with a series of IF statements as you have suggested.

Thanks a lot. 

MG

To add comments, please log in or register