how to run one EA for several charts?

 

it is easy to develop one ea to be used only in one chart. 

But how can we use this ea for several charts? It is possible to transition to other charts programmatically and process the things on these charts.

But then how to prohibit other copies of this EA in other charts in order to avoid any conflict between these copies?

I mean if we use MyRobot.mql4 (for ex) in EURUSD chart, then I should prohibit using the same MyRobot.mql4 to be attached into other charts like, GBPUSD-H1, USDCAD-M15, etc (neigboring charts)

How to check that this advisor is already attached to other charts? Or how to avoid attaching the same EA into several charts?

[email redacted by moderator] - I would appreciate your kind advices...

Look forward to hearing from you.

Regards

Documentation on MQL5: Python Integration / order_calc_margin
Documentation on MQL5: Python Integration / order_calc_margin
  • www.mql5.com
order_calc_margin - Python Integration - MQL5 Reference - Reference on algorithmic/automated trading language for MetaTrader 5
 
Your topic has been moved to the section: MQL4 and MetaTrader 4
Please consider which section is most appropriate — https://www.mql5.com/en/forum/172166/page6#comment_49114893
 
  • Usually people who can't code don't receive free help on this forum.
  • If you show your attempts and describe your problem clearly, you will most probably receive an answer from the community. Use the CODE button (Alt-S) when inserting code.
  • To learn MQL programming, you can research the many available Articles on the subject, or examples in the Codebase, as well as reference the online Documentation.
  • If you do not want to learn to code, that is not a problem. You can either look at the Codebase if something free already exists, or in the Market for paid products (also sometimes free). However, recommendations or suggestions for Market products are not allowed on the forum, so you will have to do your own research.
  • Finally, you also have the option to hire a programmer in the Freelance section.
 
bahmanasgerov:

it is easy to develop one ea to be used only in one chart. 

But how can we use this ea for several charts? It is possible to transition to other charts programmatically and process the things on these charts.

But then how to prohibit other copies of this EA in other charts in order to avoid any conflict between these copies?

I mean if we use MyRobot.mql4 (for ex) in EURUSD chart, then I should prohibit using the same MyRobot.mql4 to be attached into other charts like, GBPUSD-H1, USDCAD-M15, etc (neigboring charts)

How to check that this advisor is already attached to other charts? Or how to avoid attaching the same EA into several charts?

[email redacted by moderator] - I would appreciate your kind advices...

Look forward to hearing from you.

Regards

You can change the symbol from an EA with ChartSetSymbolPeriod (same for mql4-mql5)

ChartSetSymbolPeriod - Chart Operations - MQL5 Reference - Reference on algorithmic/automated trading language for MetaTrader 5


Now you can also have a file that exists when one instance is running , or a global variable . 
When your EA exits it deletes that file or variable . 
That would be the solution if you are not asking about limiting the EA but just running one instance at a time for calculations efficiency . 

Documentation on MQL5: Chart Operations / ChartSetSymbolPeriod
Documentation on MQL5: Chart Operations / ChartSetSymbolPeriod
  • www.mql5.com
ChartSetSymbolPeriod - Chart Operations - MQL5 Reference - Reference on algorithmic/automated trading language for MetaTrader 5
 
Lorentzos Roussos #:

You can change the symbol from an EA with ChartSetSymbolPeriod (same for mql4-mql5)

ChartSetSymbolPeriod - Chart Operations - MQL5 Reference - Reference on algorithmic/automated trading language for MetaTrader 5


Now you can also have a file that exists when one instance is running , or a global variable . 
When your EA exits it deletes that file or variable . 
That would be the solution if you are not asking about limiting the EA but just running one instance at a time for calculations efficiency . 

that is a good idea... Maybe I can register every instance of the EA file in a CSV file, and when the next instance is attahed into a chart, I can check if there is anything in the CSV file... If yes, then I can prohibit the second/next instance to work in a paralel chart at the same time..

This is a solution, for sure. Thanks Lorentzos a lot. Regards

 
bahmanasgerov #:

that is a good idea... Maybe I can register every instance of the EA file in a CSV file, and when the next instance is attahed into a chart, I can check if there is anything in the CSV file... If yes, then I can prohibit the second/next instance to work in a paralel chart at the same time..

This is a solution, for sure. Thanks Lorentzos a lot. Regards

Yes and it does not need to be a csv file either . It can be anything . You can literally have your own format with |FILE_BIN . If you read and write in the same order then it works .

Reason: