Cannot see an offline chart - page 2

 
lingwuchung:


Hi,

I've resolved all the compilation errors but find the EA's OnTick (simplified to testOffline.mq4 as attached) cannot be triggered on offline chart (generating by PeriodConvertor). It doesn't have problem with normal M1 chart though. So I wonder what's wrong?



There are no incoming ticks on the offline chart.

Try OnTimer instead of OnTick

See example of EA worked on offline chart refreshed from PeriodConverter

int ExtCounter;
int ExtTickCount;
int ExtBars;
//+------------------------------------------------------------------+
//| expert initialization function                                   |
//+------------------------------------------------------------------+
int OnInit()
  {
//----
   ExtCounter=0;
   ExtTickCount=GetTickCount();
   ExtBars=Bars;
   Print("init  ExtBars=",ExtBars,"  Time[0]=",TimeToString(Time[0]));
   EventSetTimer(1);
//----
   return(INIT_SUCCEEDED);
  }
//+------------------------------------------------------------------+
//| expert deinitialization function                                 |
//+------------------------------------------------------------------+
void OnDeinit(const int reason)
  {
   ExtTickCount=GetTickCount()-ExtTickCount;
   Print("ExtTickCount=",ExtTickCount,"   ExtCounter=",ExtCounter);
  }
//+------------------------------------------------------------------+
//| expert start function                                            |
//+------------------------------------------------------------------+
void OnTick()
  {
   if(ExtBars!=Bars)
     {
      ExtBars=Bars;
      Print("start  ExtBars=",ExtBars,"  Time[0]=",TimeToString(Time[0]));
     }
  }
//+------------------------------------------------------------------+
//|                                                                  |
//+------------------------------------------------------------------+
void OnTimer()
  {
   if(RefreshRates())
      OnTick();
//----
   if(ExtCounter%15==0)
      Print("OnTimer  ExtCounter=",ExtCounter,"  Time[0]=",TimeToString(Time[0]));
   ExtCounter++;
  }
 
stringo:

There are no incoming ticks on the offline chart.

Try OnTimer instead of OnTick

See example of EA worked on offline chart refreshed from PeriodConverter


OK, got the offline chart's tick now. But does it mean that EA can be triggered at every 1 second only the fastest? (since EventSetTimer() can set up to unit of seconds only).

If so, this is a degrade in the new mql4 and I wonder why.

 

Degrade? Why?

experts have never worked on offline charts

 
RaptorUK:

Can you get the Documentation for FileOpenHistory() updated please . . .

. . there is no mention of the other flags.


Try to update your Help please


 
Rosh:

Try to update your Help please

Sorry but I didn't say FileOpen() . . . I said FileOpenHistory()

 
stringo:

Degrade? Why?

experts have never worked on offline charts


Please don't joke. I have been trading with experts on offline chart for a year. Latest version I used (before being forced upgrade to 600) was build 509.
 
lingwuchung:

Please don't joke. I have been trading with experts on offline chart for a year. Latest version I used (before being forced upgrade to 600) was build 509.
Isn't with a hack, not supported by Metaquotes ?
 
angevoyageur:
Isn't with a hack, not supported by Metaquotes ?


Since the Metaquotes have not revealed the structure of hst files to public (they keep it for their own purposes), then every use of the *.hst files is a hack.
 
Ovo:

Since the Metaquotes have not revealed the structure of hst files to public (they keep it for their own purposes), then every use of the *.hst files is a hack.

y do you say that ? who is behind the script PeriodConverter ?

hint : try find out the author of this article

 
Ovo:

Since the Metaquotes have not revealed the structure of hst files to public (they keep it for their own purposes), then every use of the *.hst files is a hack.
Nope, the .hst file format is published in the terminal help file . . . i assume it will be updated in due course. mql4 also provides a function for reading and writing .hs files . . . no hack involved.

Historical File Format (HST Files)

The database header is the first

struct HistoryHeader
{
int version; // database version
char copyright[64]; // copyright info
char symbol[12]; // symbol name
int period; // symbol timeframe
int digits; // the amount of digits after decimal point in the symbol
time_t timesign; // timesign of the database creation
time_t last_sync; // the last synchronization time
int unused[13]; // to be used in future
};

then goes the bars array (single-byte justification)

#pragma pack(push,1)
//---- standard representation of the quote in the database
struct RateInfo
{
time_t ctm; // current time in seconds
double open;
double low;
double high;
double close;
double vol;
};
#pragma pack(pop)





Reason: