Period converter optimized with real-time freshing support and low CPU cost

 
Posted on mql4 codebase.

https://www.mql5.com/en/code/7673

The code is not fully tested, comments and suggestions are welcome.

Also a few suggestions for Metaquotes which i found might be useful while creating the converter.

1. option to disable certain indicator/experts/scripts temporarily without removing them,
to avoid losting of custom parameters.

2. a new catalogue in Navigator window to seperate script like indicator from the
custom indicator.
the script like indicator usually don't draw any line, and like the indicator,
start() will be called when new quotes income. also support more than one
running per chart. also, unlike indicator, they can call Print() function to
log message when needed.

3. option to enable reload scripts/indicators when changing server.

4. A possible bug:
MT4 don't confirm dll function call for indicators even when the option is checked and the indicator is calling a function.
 
This is pretty good, I like it. But 1 question...

Whats the effect of running an EA on an offline chart??
Since it is offline and doesn't have an incomming tick, will an attached EA still trigger??
 
This is pretty good, I like it. But 1 question...

Whats the effect of running an EA on an offline chart??
Since it is offline and doesn't have an incomming tick, will an attached EA still trigger??



EA won't trigger on offline chart, so it is still best if metaquotes decide to add some support in the client for the custom period timeframe.
 
MQ, you think you might be able to do something with this??? Maybe???
 
scripts can run on the offline charts. script can contain endless loop with RefreshRates function call
 
so you're saying write the EA as a script and just run it on an endless loop. hmm interesting.
 
Version 1.3 published, please update if you have an old version before reporting bugs :)


2005.12.04 1.3 Fixed missing data when there is large amount of data
loaded in several blocks, and support auto updating
when new history is loaded.
2005.11.29 1.2 Additional fix for missing data and server changing.
2005.11.29 1.1 Fixed missing partial data after restart.
Reinitialize after changing server or data corrupted.
2005.11.28 1.0 Initial release

 
so you're saying write the EA as a script and just run it on an endless loop. hmm interesting.

Have you try it?
How would you call indicator from the script to provide custom tick for the indicator?
 
Version 1.4 added, waiting to be approved.


2005.12.24 1.4 faster to detect if data changed by removing float point
operations, added support to output CSV file in real time.
OutputCSVFile = 0 means no CSV.
OutputCSVFile = 1 means CSV + HST
OutputCSVFile = 2 CSV only, no HST .
(useful if you want to generate CSV for builtin periods)
CSV Filename will be the same as HST file except the extension.
added safe checking for PeriodMultiplier.

 
wfy05 :
Version 1.4 added, waiting to be approved.


2005.12.24 1.4 faster to detect if data changed by removing float point
operations, added support to output CSV file in real time.
OutputCSVFile = 0 means no CSV.
OutputCSVFile = 1 means CSV + HST
OutputCSVFile = 2 CSV only, no HST .
(useful if you want to generate CSV for builtin periods)
CSV Filename will be the same as HST file except the extension.
added safe checking for PeriodMultiplier.

I am not a programmer but a trader so I don't have a deep understanding of code talk.

I want to create an ea using custom timeframe 10 mins 2hour etc. But as stated the price is not always live, and even when I refresh the offline chart it doesn't update to current market live price.

So is it possible to use custom timeframe to trade an ea?

Reason: