History data is not getting loaded programmatically

To add comments, please log in or register
Avinash
13
Avinash  

Hi,

I have made a program to covert the stock data to hst files and move them to history folders. History files are fine when opened they are getting plotted on chart . My main objective is to run my report script on all the imported symbols and generate a report. Here I have a problem. If I try to access the data of newly imported history file it always gives me Zero. But If I manually open the history file i.e.,(-->Open Offline--Select the symbol) and load them to a chart and then run the script the MetaTrader recognizes the data. I even tried using OpenHistoryFile () This function is opening the hst file and I have verified the return value of OpenHistoryFile, its not -1.

This is the sequence of steps

1) Create hst and move them to <metatrader>/History/<vendorhistory>/

2) Run a script to check the Open value of the newly imported symbol. The following line popsout a zero.

int handle = OpenHistoryFile("A1440.hst",.........etc

if(handle==-1)

{

Alert("HST not opened");

}

Alert(iOpen("A",PERIOD_D1,1));

3) File --Open offline -- Select the symbol "A", chart of "A" is displayed.

4) Run the same script of step2. Now the correct open price gets popped out.

So could let me know how to get the value of Open programmaticaly. I dont want to follow the manual step 3.

Ray
2646
Ray  

"So could let me know how to get the value of Open programmaticaly. I dont want to follow the manual step 3."

Maybe step 3 is necessary.

Maybe not, don't really know. Offline files are "different".

Try restart MT4 after adding the history file to the folder.

To add comments, please log in or register