For everyone who is interested to know about HST format here example which reads it. I ll later post an update which will write this info to a CSV file
//+------------------------------------------------------------------+ //| History viewer.mq4 | //| Copyright © 2007, MetaQuotes Software Corp. | //| http://www.metaquotes.net | //+------------------------------------------------------------------+ #property copyright "Copyright © 2007, MetaQuotes Software Corp." #property link "http://www.metaquotes.net" //+------------------------------------------------------------------+ //| script program start function | //+------------------------------------------------------------------+ int start() { //---- double varray[10]; int temp[13]; int handle=FileOpenHistory("USDJPY1.HST",FILE_BIN|FILE_READ); if(handle<1) { Print("Cannot create file USDX240.HST"); return(false); } Print ("File opened successfully"); int HistoryHandle = handle; int ver = FileReadInteger ( HistoryHandle, 400); Print ("Version = "+ver); string s1,s2; int i = 0; s1=FileReadString ( HistoryHandle, 64 ); s2=FileReadString ( HistoryHandle, 12 ); Print ("Symbol: "+s2); int period = FileReadInteger ( HistoryHandle, LONG_VALUE ); Print ("Period="+period); int digits = FileReadInteger ( HistoryHandle, LONG_VALUE ); Print ("Digits="+digits); FileReadInteger ( HistoryHandle, LONG_VALUE ); //timesign FileReadInteger ( HistoryHandle, LONG_VALUE ); //last_sync i= FileReadArray ( HistoryHandle, temp, 0, 13 ); Print ("Array returned="+i); // for (int k=0;k<i;k++) { Print ("Array["+k+"]="+temp[k]); } int exit = 0; int cnt = 0; while (exit == 0) { // read line int _time = FileReadInteger ( HistoryHandle, LONG_VALUE ); if (_time == 0 ) { exit =1; } double _open = FileReadDouble ( HistoryHandle, DOUBLE_VALUE); double _high = FileReadDouble ( HistoryHandle, DOUBLE_VALUE); double _low = FileReadDouble ( HistoryHandle, DOUBLE_VALUE); double _close = FileReadDouble ( HistoryHandle, DOUBLE_VALUE); int _volume = FileReadDouble ( HistoryHandle, DOUBLE_VALUE); string timestring = TimeYear(_time)+""+TimeMonth(_time)+""+TimeDay(_time)+""+TimeHour(_time)+""+TimeMinute(_time); if (_time > 0 ) { string line = timestring+";"+_open+";"+_high+";"+_low+";"+_close+";"+_volume; } if (cnt<5) { Print ("["+cnt+"]"+line); } cnt++; } Print ("total = "+cnt+" Bars read"); Print ("Last line="+line); FileClose(handle); //---- return(0); } //+------------------------------------------------------------------+
You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
i have downloaded M1 history which contains millions of bars (from alpari history center). They only offer M1 and D1 data as history. On Mt4 i press F2 and it only show 65535 and can only expoert 65535 M1 bars. This is not enough. 65535 bars at M1 only contains 3 months back data which is too less for my purphose. Also on graphic it only can visualise 65535 bars.
Since i cannot export neither with F2 nor with MQ4 i decided to understand the .hst file format which contains all data. can someone help me to find internal info about this format please?