Download MetaTrader 5

How to make a script persistent when changing timeframe ?

To add comments, please log in or register
The Market has more than 400 indicators. Try any of them!
David Saulnier
400
David Saulnier 2013.04.04 07:57 

Hello,

I made a simple MQL5 script. No problem to attach it to a chart, it runs properly.

But if I'm changing the Timeframe of the chart (for example from M1 to M5): the script is automatically removed from the chart.

Any help appreciated,
Thanks
Sergey Golubev
Moderator
93675
Sergey Golubev 2013.04.04 08:13  

Hi DavidS777,

If it is really script (not EA) so as far as I know - then script is executed once after attaching it to the chart, or based on some special condition. I mean: you will need to attach it every time you will need something from this script. 

David Saulnier
400
David Saulnier 2013.04.04 08:15  
All right, thanks for the reply. Maybe I'll convert it to an indicator to make it persistent (or EA) but only one EA is possible per chart ?
Sergey Golubev
Moderator
93675
Sergey Golubev 2013.04.04 08:32  

Yes, only 1 EA per chart. But you can have many same charts with many same EAs on it - just change magic number of your EA to any "unique number per chart" - and attach your EA to many charts with different magic number.

And there are some Eas which are working for all (pre-selected) the pairs (or for whole the account) if you attach it to any one chart for example.

David Saulnier
400
David Saulnier 2013.04.04 09:05  
thanks a lot for your prompt answer.
Alain Verleyen
Moderator
30737
Alain Verleyen 2013.04.04 11:44  
DavidS777:

Hello,

I made a simple MQL5 script. No problem to attach it to a chart, it runs properly.

But if I'm changing the Timeframe of the chart (for example from M1 to M5): the script is automatically removed from the chart.

Any help appreciated,
Thanks
You can't make a script "persistent" when changing timeframe. Depending on what you want to do, you can use EA or indicator. See documentation about different types of program.
To add comments, please log in or register