Script Potential

 

Hello Anybody,

I just completed removing all the bugs out of an ea that is doing great now. I need to know how to automate setting up the ea on multiple charts. Right now I am manually attaching the ea to about 11 charts and its time consuming. Can I write a script which will automatically attach the ea to a list of currency pairs that I write into the script?

 
Time consuming ? why ?
 
Time consuming? why? open chart, set period, drag EA. 10 Seconds per chart max. You don't have 2 spare minutes?
 
forestmyopia:

Hello Anybody,

I just completed removing all the bugs out of an ea that is doing great now. I need to know how to automate setting up the ea on multiple charts. Right now I am manually attaching the ea to about 11 charts and its time consuming. Can I write a script which will automatically attach the ea to a list of currency pairs that I write into the script?


Are you saying you wrote your EA as a scritp and you need to put it back on the chart every time it stops? Might that be why it is time consuming? You should only have to put it on a chart once.
 
RaptorUK:
Time consuming ? why ?


Okay, I attach the ea to the EURUSD chart and I manually put in the magic number in an extern variable for this currency pair. Then I attach the ea to the GBPUSD chart and I make sure I put in a different magic number for this currency-pair chart. I do it for the next chart and so on and so on. I manually put in the magic number for each chart because I have to insure the magic numbers never conflict, obviously. When the ea is attached to the full set of charts then I enable the ea, which activates all the ea's on all the charts simultaneously.

My ea can run in a one trade or continuous trade mode. If I run in the continous trade mode, after one trade closes the ea adds 1 to the original magic number before it opens a new trade for the same currency pair. (I am not sure I can reuse the original magic number I used for the first trade after the first trade closes.)

Whatever, I have to make sure the magic numbers are unique and I am not impressed with the 2 random functions used in MQL4. I don't trust they guarantee unique sets of numbers.

I was wondering if a script is possible that would attach the ea to a EURUSD chart, then to a GBPUSD chart, etc. while at the same time assigning a unique magic number to each chart pair.

And yes, maybe the solution is just good old-fashion elbow grease. But, I am a lazy hack of a programmer. My credo is: write the least amount of code in the least amount of time for the most data processing possible.

 
 
MarketInfo("EURUSD",MODE_ASK)
//rather than
Ask
Ask will be the one of the chart attached and Market... is of the EURUSD no matter wehre you are. Could you make you code independent of the chart attached by avoinding using stuff that gives you the attached chart value
 
ciremql4:
Ask will be the one of the chart attached and Market... is of the EURUSD no matter wehre you are. Could you make you code independent of the chart attached by avoinding using stuff that gives you the attached chart value

I am sorry ciremql4, but could you be more clear on what you mean? I'm lost on your response.
 
If you use something like "OrderSymbol()==Symbol() && OrderMagicNumber()==MagicNumber" you can use the same magic number for all pairs. No conflict there.
Reason: