Download MetaTrader 5
To add comments, please log in or register
Do you need OpenCL? MQL5 can provide it!
Pier Gaetano Novara
236
Pier Gaetano Novara 2016.07.07 09:00 

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?

Marco vd Heijden
Moderator
4505
Marco vd Heijden 2016.07.07 09:58  

Press Ctrl+o

Then tab History.

Pier Gaetano Novara
236
Pier Gaetano Novara 2016.07.07 10:05  
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

Marco vd Heijden
Moderator
4505
Marco vd Heijden 2016.07.07 10:12  
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.

Pier Gaetano Novara
236
Pier Gaetano Novara 2016.07.07 10:41  
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?

Marco vd Heijden
Moderator
4505
Marco vd Heijden 2016.07.07 10:51  
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.

Pier Gaetano Novara
236
Pier Gaetano Novara 2016.07.07 11:11  
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 
Marco vd Heijden
Moderator
4505
Marco vd Heijden 2016.07.07 11:47  

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.

Pier Gaetano Novara
236
Pier Gaetano Novara 2016.07.07 12:20  
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
236
Pier Gaetano Novara 2016.07.07 15:49  
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
/
To add comments, please log in or register