OFFLINE chart does not show. it only gives "waiting for update" - page 2

 
HarriMQL4:

Hello RaptorUK

Im experiencing the same problem as strive23. I have a commercial rangebar generator and I can display the offline charts it generates. However, because its commercial the source code is not available.

When I open the offline charts that I generate, it shows "Waiting for Update".

Show your code.

 
strive23:

Fix your array declarations: https://www.mql5.com/en/forum/146260

Instead of this:

string filesarray[25]={"xxx.csv","xxx1.csv"} ;
int itimeframe_array[7]={6,11,16};

do this:

string filesarray[]={"xxx.csv","xxx1.csv"} ;
int itimeframe_array[]={6,11,16};

I think you also need to use a valid Symbol or the symbol properties won't be found in the symbols.sel file . . .

string c_symbol = "xhist";
 

HarriMQL4:

By the way, I cannot see the code posted by the OP - has it been deleted?

When I open the offline charts that I generate, it shows "Waiting for Update".

  1. Apparently.
  2. There was a bug in mql4 that even new online charts sometimes showed "Waiting for Update" The IBFX advise was to drag the Market Watch pair to the corresponding chart.
 
RaptorUK:

Show your code.

This is my code for generating offline charts, not the commercial. And as I said, when I read back the file that is generated, it all looks good. Just displaying the offline chart in the terminal is the problem.

//+------------------------------------------------------------------+
bool writeBar()
{   
    int rs = 0;
    datetime tm;

    tm = rbTime[0];
    rs = FileWriteInteger(rbHndl, tm, LONG_VALUE);
    if(rs < 0) { logError("writeBar", "Error writing TIME to rangebar file", GetLastError()); return(rs > 0); }
    rs = FileWriteDouble(rbHndl, rbOpen[0],DOUBLE_VALUE);
    if(rs < 0) { logError("writeBar", "Error writing OPEN to rangebar file", GetLastError()); return(rs > 0); }
    rs = FileWriteDouble(rbHndl, rbHigh[0],DOUBLE_VALUE);
    if(rs < 0) { logError("writeBar", "Error writing HIGH to rangebar file", GetLastError()); return(rs > 0); }
    rs = FileWriteDouble(rbHndl, rbLow[0],DOUBLE_VALUE);
    if(rs < 0) { logError("writeBar", "Error writing LOW to rangebar file", GetLastError()); return(rs > 0); }
    rs = FileWriteDouble(rbHndl, rbClose[0],DOUBLE_VALUE);
    if(rs < 0) { logError("writeBar", "Error writing CLOSE to rangebar file", GetLastError()); return(rs > 0); }
    rs = FileWriteDouble(rbHndl, rbVol[0],DOUBLE_VALUE);
    if(rs < 0) { logError("writeBar", "Error writing VOL to rangebar file", GetLastError()); return(rs > 0); }

    filePos = FileTell(rbHndl);
    FileFlush(rbHndl);
    
//    printRBar("writeBar"); //FOR DEBUGGING
          
    return(rs > 0);
}

and for the header


string          c_copyright="(C)opyright 2013, Harrison FX";
int             i_unused[30], i_period = 5;

.....
        rbHndl = FileOpenHistory(path+".hst", FILE_BIN|FILE_READ|FILE_WRITE);
        if (rbHndl < 0) {
            logError("fileInit", "Could not open file "+path+".hst"+" for writing", GetLastError());
            return(-1);
        }
        //---- write history file header if necessary
        int    version=400;
        int    i_digits=Digits;
        rs = FileWriteInteger(rbHndl, version, LONG_VALUE);
        rs = FileWriteString(rbHndl, c_copyright, 64);
        rs = FileWriteString(rbHndl, path, 12);

        FileWriteInteger(rbHndl, i_period, LONG_VALUE);
        FileWriteInteger(rbHndl, i_digits, LONG_VALUE);
        FileWriteInteger(rbHndl, 0, LONG_VALUE);       
        FileWriteInteger(rbHndl, 0, LONG_VALUE);
        FileWriteArray(rbHndl, i_unused, 0, 13);
.....
 
HarriMQL4:

This is my code for generating offline charts, not the commercial. And as I said, when I read back the file that is generated, it all looks good. Just displaying the offline chart in the terminal is the problem.

and for the header

What is the value of path ?

Also the order you are writing the data looks wrong, shouldn't it be Open, Low, High, Close, Volume ?

 
RaptorUK:

What is the value of path ?

Also the order you are writing the data looks wrong, shouldn't it be Open, Low, High, Close, Volume ?

Thanks for replying.


path is constructed as follows:

    c_symbol = Symbol()+pRange+"r";
    i_period = 5;
    string filePath = c_symbol+i_period;

where pRange is an int representing the range of the bars. I have tried playing around with the filename (path) and the values for the fields c_symbol and i_period, but still the same result. Is there a correlation? What is correct?

And is the order of fields wrong? I thought it was OHLC, based on what is displayed on a live chart, but even then, I dont understand how the order of the price values can affect whether its displayed or not.

 
HarriMQL4:

Thanks for replying.


path is constructed as follows:

where pRange is an int representing the range of the bars. I have tried playing around with the filename (path) and the values for the fields c_symbol and i_period, but still the same result. Is there a correlation? What is correct?

And is the order of fields wrong? I thought it was OHLC, based on what is displayed on a live chart, but even then, I dont understand how the order of the price values can affect whether its displayed or not.

You should look at the code in period_converter, it shows you what you need to do.

Regarding path, you code says this . . .

rs = FileWriteString(rbHndl, path, 12);

. . . isn't path meant to be the symbol name ? so what is the value of path ?

 
RaptorUK:

You should look at the code in period_converter, it shows you what you need to do.

Regarding path, you code says this . . .

. . . isn't path meant to be the symbol name ? so what is the value of path ?

I think path can contain the Symbol name, and judging by the commercial range bars, it can be different. Their HST file names, and the value of path field inside are different, I guess so as not to conflict with the standard HST charts. E.g. if you want to generate a range bar chart with 15pip range, you dont want the standard M15 chart to be overwritten, right?


Anyway, I followed your hint about the order of fields (OHLC - which is definitely how its displayed on a chart), and changed it to OLHC when generating the custom chart. And hey presto! The custom chart now loads. Thank you very much Raptor, for your help. I guess the terminal must have some sanity checking whenever it loads price data from a hst file. But I do think its naughty that the display order is not the same as how the prices are stored.

Thanks again