Historical data clean

 

HI all

I see in option the field max bars in history and I have set it to 1440.

Using F2 I see that the bars loaded are always greater then 1440, is there a way to keep only this number of bars in the history? Is there any MQL4 command to use to clear the history?

 

Press Ctrl+o

Then tab History.

 
Marco vd Heijden:

Press Ctrl+o

Then tab History.

In MT4 I do not have tab history

I need to write a code inside my EA script to perform this task

 
Pier Gaetano Novara:

In MT4 I do not have tab history

I need to write a code inside my EA script to perform this task


Sorry i meant tab charts.

 
Marco vd Heijden:


Sorry i meant tab charts.

i set this number to 1440 but the number of charts is always greater, the charts are added and not removed,  so I need o make a script that remove the older charts, is it possible?

 
Pier Gaetano Novara:

i set this number to 1440 but the number of charts is always greater, the charts are added and not removed,  so I need o make a script that remove the older charts, is it possible?

Well if you want to remove a chart it's

ChartClose()


But im not totally understand what you are trying to do and why you want to remove bars.

 
Marco vd Heijden:

Well if you want to remove a chart it's


But im not totally understand what you are trying to do and why you want to remove bars.

Marco vd Heijden:

Well if you want to remove a chart it's


But im not totally understand what you are trying to do and why you want to remove bars.


ChartClose close a chart I want to remove the history bar because the tester that run every hour should always use last 1440 bars 
 

Pier Gaetano Novara:

ChartClose close a chart I want to remove the history bar because the tester that run every hour should always use last 1440 bars 
Pier Gaetano Novara:

i set this number to 1440 but the number of charts is always greater, the charts are added and not removed,  so I need o make a script that remove the older charts, is it possible?

Sorry i don't get it.

if you want to use less bars just count less bars.

 
Marco vd Heijden:

Sorry i don't get it.

if you want to use less bars just count less bars.

the problem is that I launch the optimizer with a parameter file without date so the data used is all the history present at that moment. (modify the parameter file setting start date equal to today - 7 days would be quite complex but is also a possibility)

I wonder if exist a way to remove older bars like this:

if (iBars(Symbol(),PERIOD_M5)>x)

   removeOlderBars(Symbol(),PERIOD_M5,iBars(Symbol(),PERIOD_M5)-x)

this removeOlderBars functionality should remove from the older iBars(Symbol(),PERIOD_M5)-x bars from Symbol() with PERIOD_M5

Another option is to rebuild the file hst but this is the most complex option I think

 
Pier Gaetano Novara:

the problem is that I launch the optimizer with a parameter file without date so the data used is all the history present at that moment. (modify the parameter file setting start date equal to today - 7 days would be quite complex but is also a possibility)

I wonder if exist a way to remove older bars like this:

if (iBars(Symbol(),PERIOD_M5)>x)

   removeOlderBars(Symbol(),PERIOD_M5,iBars(Symbol(),PERIOD_M5)-x)

this removeOlderBars functionality should remove from the older iBars(Symbol(),PERIOD_M5)-x bars from Symbol() with PERIOD_M5

Another option is to rebuild the file hst but this is the most complex option I think

solved with option 1: parameter file recreated all the time with start date = now - 7 days
Reason: