diff options
| author | Georg Brandl <georg@python.org> | 2021-01-18 21:24:00 +0100 |
|---|---|---|
| committer | Georg Brandl <georg@python.org> | 2021-01-18 22:08:36 +0100 |
| commit | 2a3d3a7d5b9c60dedf6638d876161d9563faebcf (patch) | |
| tree | 809c0b4a686db98f5954afa1944404cd9652c6b2 /tests/lexers/mql/example2.txt | |
| parent | f0445be718da83541ea3401aad882f3937147263 (diff) | |
| download | pygments-git-examplefiles.tar.gz | |
Move test_examplefiles to new tests/lexers scheme.examplefiles
Diffstat (limited to 'tests/lexers/mql/example2.txt')
| -rw-r--r-- | tests/lexers/mql/example2.txt | 1762 |
1 files changed, 1762 insertions, 0 deletions
diff --git a/tests/lexers/mql/example2.txt b/tests/lexers/mql/example2.txt new file mode 100644 index 00000000..c1ded432 --- /dev/null +++ b/tests/lexers/mql/example2.txt @@ -0,0 +1,1762 @@ +---input--- +//+------------------------------------------------------------------+ +//| PeriodConverter.mq4 | +//| Copyright 2006-2014, MetaQuotes Software Corp. | +//| http://www.metaquotes.net | +//+------------------------------------------------------------------+ +#property copyright "2006-2014, MetaQuotes Software Corp." +#property link "http://www.mql4.com" +#property description "Period Converter to updated format of history base" +#property strict +#property show_inputs +#include <WinUser32.mqh> + +input int InpPeriodMultiplier=3; // Period multiplier factor +int ExtHandle=-1; +//+------------------------------------------------------------------+ +//| script program start function | +//+------------------------------------------------------------------+ +void OnStart() + { + datetime time0; + ulong last_fpos=0; + long last_volume=0; + int i,start_pos,periodseconds; + int hwnd=0,cnt=0; +//---- History header + int file_version=401; + string c_copyright; + string c_symbol=Symbol(); + int i_period=Period()*InpPeriodMultiplier; + int i_digits=Digits; + int i_unused[13]; + MqlRates rate; +//--- + ExtHandle=FileOpenHistory(c_symbol+(string)i_period+".hst",FILE_BIN|FILE_WRITE|FILE_SHARE_WRITE|FILE_SHARE_READ|FILE_ANSI); + if(ExtHandle<0) + return; + c_copyright="(C)opyright 2003, MetaQuotes Software Corp."; + ArrayInitialize(i_unused,0); +//--- write history file header + FileWriteInteger(ExtHandle,file_version,LONG_VALUE); + FileWriteString(ExtHandle,c_copyright,64); + FileWriteString(ExtHandle,c_symbol,12); + FileWriteInteger(ExtHandle,i_period,LONG_VALUE); + FileWriteInteger(ExtHandle,i_digits,LONG_VALUE); + FileWriteInteger(ExtHandle,0,LONG_VALUE); + FileWriteInteger(ExtHandle,0,LONG_VALUE); + FileWriteArray(ExtHandle,i_unused,0,13); +//--- write history file + periodseconds=i_period*60; + start_pos=Bars-1; + rate.open=Open[start_pos]; + rate.low=Low[start_pos]; + rate.high=High[start_pos]; + rate.tick_volume=(long)Volume[start_pos]; + rate.spread=0; + rate.real_volume=0; + //--- normalize open time + rate.time=Time[start_pos]/periodseconds; + rate.time*=periodseconds; + for(i=start_pos-1; i>=0; i--) + { + if(IsStopped()) + break; + time0=Time[i]; + //--- history may be updated + if(i==0) + { + //--- modify index if history was updated + if(RefreshRates()) + i=iBarShift(NULL,0,time0); + } + //--- + if(time0>=rate.time+periodseconds || i==0) + { + if(i==0 && time0<rate.time+periodseconds) + { + rate.tick_volume+=(long)Volume[0]; + if(rate.low>Low[0]) + rate.low=Low[0]; + if(rate.high<High[0]) + rate.high=High[0]; + rate.close=Close[0]; + } + last_fpos=FileTell(ExtHandle); + last_volume=(long)Volume[i]; + FileWriteStruct(ExtHandle,rate); + cnt++; + if(time0>=rate.time+periodseconds) + { + rate.time=time0/periodseconds; + rate.time*=periodseconds; + rate.open=Open[i]; + rate.low=Low[i]; + rate.high=High[i]; + rate.close=Close[i]; + rate.tick_volume=last_volume; + } + } + else + { + rate.tick_volume+=(long)Volume[i]; + if(rate.low>Low[i]) + rate.low=Low[i]; + if(rate.high<High[i]) + rate.high=High[i]; + rate.close=Close[i]; + } + } + FileFlush(ExtHandle); + Print(cnt," record(s) written"); +//--- collect incoming ticks + datetime last_time=LocalTime()-5; + while(!IsStopped()) + { + datetime cur_time=LocalTime(); + //--- check for new rates + if(RefreshRates()) + { + time0=Time[0]; + FileSeek(ExtHandle,last_fpos,SEEK_SET); + //--- is there current bar? + if(time0<rate.time+periodseconds) + { + rate.tick_volume+=(long)Volume[0]-last_volume; + last_volume=(long)Volume[0]; + if(rate.low>Low[0]) + rate.low=Low[0]; + if(rate.high<High[0]) + rate.high=High[0]; + rate.close=Close[0]; + } + else + { + //--- no, there is new bar + rate.tick_volume+=(long)Volume[1]-last_volume; + if(rate.low>Low[1]) + rate.low=Low[1]; + if(rate.high<High[1]) + rate.high=High[1]; + //--- write previous bar remains + FileWriteStruct(ExtHandle,rate); + last_fpos=FileTell(ExtHandle); + //---- + rate.time=time0/periodseconds; + rate.time*=periodseconds; + rate.open=Open[0]; + rate.low=Low[0]; + rate.high=High[0]; + rate.close=Close[0]; + rate.tick_volume=(long)Volume[0]; + last_volume=rate.tick_volume; + } + //---- + FileWriteStruct(ExtHandle,rate); + FileFlush(ExtHandle); + //--- + if(hwnd==0) + { + hwnd=WindowHandle(Symbol(),i_period); + if(hwnd!=0) + Print("Chart window detected"); + } + //--- refresh window not frequently than 1 time in 2 seconds + if(hwnd!=0 && cur_time-last_time>=2) + { + PostMessageA(hwnd,WM_COMMAND,33324,0); + last_time=cur_time; + } + } + Sleep(50); + } +//--- + } +//+------------------------------------------------------------------+ +//| | +//+------------------------------------------------------------------+ +void OnDeinit(const int reason) + { +//--- + if(ExtHandle>=0) + { + FileClose(ExtHandle); + ExtHandle=-1; + } +//--- + } +//+------------------------------------------------------------------+ + +---tokens--- +'//+------------------------------------------------------------------+\n' Comment.Single + +'//| PeriodConverter.mq4 |\n' Comment.Single + +'//| Copyright 2006-2014, MetaQuotes Software Corp. |\n' Comment.Single + +'//| http://www.metaquotes.net |\n' Comment.Single + +'//+------------------------------------------------------------------+\n' Comment.Single + +'#' Comment.Preproc +'property copyright "2006-2014, MetaQuotes Software Corp."' Comment.Preproc +'\n' Comment.Preproc + +'#' Comment.Preproc +'property link "http:' Comment.Preproc +'//www.mql4.com"\n' Comment.Single + +'#' Comment.Preproc +'property description "Period Converter to updated format of history base"' Comment.Preproc +'\n' Comment.Preproc + +'#' Comment.Preproc +'property strict' Comment.Preproc +'\n' Comment.Preproc + +'#' Comment.Preproc +'property show_inputs' Comment.Preproc +'\n' Comment.Preproc + +'#' Comment.Preproc +'include' Comment.Preproc +' ' Text +'<WinUser32.mqh>' Comment.PreprocFile +'\n' Comment.Preproc + +'\n' Text + +'input' Keyword +' ' Text +'int' Keyword.Type +' ' Text +'InpPeriodMultiplier' Name +'=' Operator +'3' Literal.Number.Integer +';' Punctuation +' ' Text +'// Period multiplier factor\n' Comment.Single + +'int' Keyword.Type +' ' Text +'ExtHandle' Name +'=' Operator +'-1' Literal.Number.Integer +';' Punctuation +'\n' Text + +'//+------------------------------------------------------------------+\n' Comment.Single + +'//| script program start function |\n' Comment.Single + +'//+------------------------------------------------------------------+\n' Comment.Single + +'void' Keyword.Type +' ' Text +'OnStart' Name.Function +'(' Punctuation +')' Punctuation +'\n' Text + +' ' Text +'{' Punctuation +'\n' Text + +' ' Text +'datetime' Keyword.Type +' ' Text +'time0' Name +';' Punctuation +'\n' Text + +' ' Text +'ulong' Keyword.Type +' ' Text +'last_fpos' Name +'=' Operator +'0' Literal.Number.Integer +';' Punctuation +'\n' Text + +' ' Text +'long' Keyword.Type +' ' Text +'last_volume' Name +'=' Operator +'0' Literal.Number.Integer +';' Punctuation +'\n' Text + +' ' Text +'int' Keyword.Type +' ' Text +'i' Name +',' Punctuation +'start_pos' Name +',' Punctuation +'periodseconds' Name +';' Punctuation +'\n' Text + +' ' Text +'int' Keyword.Type +' ' Text +'hwnd' Name +'=' Operator +'0' Literal.Number.Integer +',' Punctuation +'cnt' Name +'=' Operator +'0' Literal.Number.Integer +';' Punctuation +'\n' Text + +'//---- History header\n' Comment.Single + +' ' Text +'int' Keyword.Type +' ' Text +'file_version' Name +'=' Operator +'401' Literal.Number.Integer +';' Punctuation +'\n' Text + +' ' Text +'string' Keyword.Type +' ' Text +'c_copyright' Name +';' Punctuation +'\n' Text + +' ' Text +'string' Keyword.Type +' ' Text +'c_symbol' Name +'=' Operator +'Symbol' Name.Function +'(' Punctuation +')' Punctuation +';' Punctuation +'\n' Text + +' ' Text +'int' Keyword.Type +' ' Text +'i_period' Name +'=' Operator +'Period' Name.Function +'(' Punctuation +')' Punctuation +'*' Operator +'InpPeriodMultiplier' Name +';' Punctuation +'\n' Text + +' ' Text +'int' Keyword.Type +' ' Text +'i_digits' Name +'=' Operator +'Digits' Keyword +';' Punctuation +'\n' Text + +' ' Text +'int' Keyword.Type +' ' Text +'i_unused' Name +'[' Punctuation +'13' Literal.Number.Integer +']' Punctuation +';' Punctuation +'\n' Text + +' ' Text +'MqlRates' Name +' ' Text +'rate' Name +';' Punctuation +'\n' Text + +'//--- \n' Comment.Single + +' ' Text +'ExtHandle' Name +'=' Operator +'FileOpenHistory' Name.Function +'(' Punctuation +'c_symbol' Name +'+' Operator +'(' Punctuation +'string' Keyword.Type +')' Punctuation +'i_period' Name +'+' Operator +'"' Literal.String +'.hst' Literal.String +'"' Literal.String +',' Punctuation +'FILE_BIN' Name.Constant +'|' Operator +'FILE_WRITE' Name.Constant +'|' Operator +'FILE_SHARE_WRITE' Name.Constant +'|' Operator +'FILE_SHARE_READ' Name.Constant +'|' Operator +'FILE_ANSI' Name.Constant +')' Punctuation +';' Punctuation +'\n' Text + +' ' Text +'if' Keyword +'(' Punctuation +'ExtHandle' Name +'<' Operator +'0' Literal.Number.Integer +')' Punctuation +'\n' Text + +' ' Text +'return' Keyword +';' Punctuation +'\n' Text + +' ' Text +'c_copyright' Name +'=' Operator +'"' Literal.String +'(C)opyright 2003, MetaQuotes Software Corp.' Literal.String +'"' Literal.String +';' Punctuation +'\n' Text + +' ' Text +'ArrayInitialize' Name.Function +'(' Punctuation +'i_unused' Name +',' Punctuation +'0' Literal.Number.Integer +')' Punctuation +';' Punctuation +'\n' Text + +'//--- write history file header\n' Comment.Single + +' ' Text +'FileWriteInteger' Name.Function +'(' Punctuation +'ExtHandle' Name +',' Punctuation +'file_version' Name +',' Punctuation +'LONG_VALUE' Name +')' Punctuation +';' Punctuation +'\n' Text + +' ' Text +'FileWriteString' Name.Function +'(' Punctuation +'ExtHandle' Name +',' Punctuation +'c_copyright' Name +',' Punctuation +'64' Literal.Number.Integer +')' Punctuation +';' Punctuation +'\n' Text + +' ' Text +'FileWriteString' Name.Function +'(' Punctuation +'ExtHandle' Name +',' Punctuation +'c_symbol' Name +',' Punctuation +'12' Literal.Number.Integer +')' Punctuation +';' Punctuation +'\n' Text + +' ' Text +'FileWriteInteger' Name.Function +'(' Punctuation +'ExtHandle' Name +',' Punctuation +'i_period' Name +',' Punctuation +'LONG_VALUE' Name +')' Punctuation +';' Punctuation +'\n' Text + +' ' Text +'FileWriteInteger' Name.Function +'(' Punctuation +'ExtHandle' Name +',' Punctuation +'i_digits' Name +',' Punctuation +'LONG_VALUE' Name +')' Punctuation +';' Punctuation +'\n' Text + +' ' Text +'FileWriteInteger' Name.Function +'(' Punctuation +'ExtHandle' Name +',' Punctuation +'0' Literal.Number.Integer +',' Punctuation +'LONG_VALUE' Name +')' Punctuation +';' Punctuation +'\n' Text + +' ' Text +'FileWriteInteger' Name.Function +'(' Punctuation +'ExtHandle' Name +',' Punctuation +'0' Literal.Number.Integer +',' Punctuation +'LONG_VALUE' Name +')' Punctuation +';' Punctuation +'\n' Text + +' ' Text +'FileWriteArray' Name.Function +'(' Punctuation +'ExtHandle' Name +',' Punctuation +'i_unused' Name +',' Punctuation +'0' Literal.Number.Integer +',' Punctuation +'13' Literal.Number.Integer +')' Punctuation +';' Punctuation +'\n' Text + +'//--- write history file\n' Comment.Single + +' ' Text +'periodseconds' Name +'=' Operator +'i_period' Name +'*' Operator +'60' Literal.Number.Integer +';' Punctuation +'\n' Text + +' ' Text +'start_pos' Name +'=' Operator +'Bars' Keyword +'-1' Literal.Number.Integer +';' Punctuation +'\n' Text + +' ' Text +'rate' Name +'.' Punctuation +'open' Name +'=' Operator +'Open' Keyword +'[' Punctuation +'start_pos' Name +']' Punctuation +';' Punctuation +'\n' Text + +' ' Text +'rate' Name +'.' Punctuation +'low' Name +'=' Operator +'Low' Keyword +'[' Punctuation +'start_pos' Name +']' Punctuation +';' Punctuation +'\n' Text + +' ' Text +'rate' Name +'.' Punctuation +'high' Name +'=' Operator +'High' Keyword +'[' Punctuation +'start_pos' Name +']' Punctuation +';' Punctuation +'\n' Text + +' ' Text +'rate' Name +'.' Punctuation +'tick_volume' Name +'=' Operator +'(' Punctuation +'long' Keyword.Type +')' Punctuation +'Volume' Keyword +'[' Punctuation +'start_pos' Name +']' Punctuation +';' Punctuation +'\n' Text + +' ' Text +'rate' Name +'.' Punctuation +'spread' Name +'=' Operator +'0' Literal.Number.Integer +';' Punctuation +'\n' Text + +' ' Text +'rate' Name +'.' Punctuation +'real_volume' Name +'=' Operator +'0' Literal.Number.Integer +';' Punctuation +'\n' Text + +' ' Text +'//--- normalize open time\n' Comment.Single + +' ' Text +'rate' Name +'.' Punctuation +'time' Name +'=' Operator +'Time' Keyword +'[' Punctuation +'start_pos' Name +']' Punctuation +'/' Operator +'periodseconds' Name +';' Punctuation +'\n' Text + +' ' Text +'rate' Name +'.' Punctuation +'time' Name +'*' Operator +'=' Operator +'periodseconds' Name +';' Punctuation +'\n' Text + +' ' Text +'for' Keyword +'(' Punctuation +'i' Name +'=' Operator +'start_pos' Name +'-1' Literal.Number.Integer +';' Punctuation +' ' Text +'i' Name +'>' Operator +'=' Operator +'0' Literal.Number.Integer +';' Punctuation +' ' Text +'i' Name +'-' Operator +'-' Operator +')' Punctuation +'\n' Text + +' ' Text +'{' Punctuation +'\n' Text + +' ' Text +'if' Keyword +'(' Punctuation +'IsStopped' Name.Function +'(' Punctuation +')' Punctuation +')' Punctuation +'\n' Text + +' ' Text +'break' Keyword +';' Punctuation +'\n' Text + +' ' Text +'time0' Name +'=' Operator +'Time' Keyword +'[' Punctuation +'i' Name +']' Punctuation +';' Punctuation +'\n' Text + +' ' Text +'//--- history may be updated\n' Comment.Single + +' ' Text +'if' Keyword +'(' Punctuation +'i' Name +'=' Operator +'=' Operator +'0' Literal.Number.Integer +')' Punctuation +'\n' Text + +' ' Text +'{' Punctuation +'\n' Text + +' ' Text +'//--- modify index if history was updated\n' Comment.Single + +' ' Text +'if' Keyword +'(' Punctuation +'RefreshRates' Name.Function +'(' Punctuation +')' Punctuation +')' Punctuation +'\n' Text + +' ' Text +'i' Name +'=' Operator +'iBarShift' Name.Function +'(' Punctuation +'NULL' Name.Constant +',' Punctuation +'0' Literal.Number.Integer +',' Punctuation +'time0' Name +')' Punctuation +';' Punctuation +'\n' Text + +' ' Text +'}' Punctuation +'\n' Text + +' ' Text +'//---\n' Comment.Single + +' ' Text +'if' Keyword +'(' Punctuation +'time0' Name +'>' Operator +'=' Operator +'rate' Name +'.' Punctuation +'time' Name +'+' Operator +'periodseconds' Name +' ' Text +'|' Operator +'|' Operator +' ' Text +'i' Name +'=' Operator +'=' Operator +'0' Literal.Number.Integer +')' Punctuation +'\n' Text + +' ' Text +'{' Punctuation +'\n' Text + +' ' Text +'if' Keyword +'(' Punctuation +'i' Name +'=' Operator +'=' Operator +'0' Literal.Number.Integer +' ' Text +'&' Operator +'&' Operator +' ' Text +'time0' Name +'<' Operator +'rate' Name +'.' Punctuation +'time' Name +'+' Operator +'periodseconds' Name +')' Punctuation +'\n' Text + +' ' Text +'{' Punctuation +'\n' Text + +' ' Text +'rate' Name +'.' Punctuation +'tick_volume' Name +'+' Operator +'=' Operator +'(' Punctuation +'long' Keyword.Type +')' Punctuation +'Volume' Keyword +'[' Punctuation +'0' Literal.Number.Integer +']' Punctuation +';' Punctuation +'\n' Text + +' ' Text +'if' Keyword +'(' Punctuation +'rate' Name +'.' Punctuation +'low' Name +'>' Operator +'Low' Keyword +'[' Punctuation +'0' Literal.Number.Integer +']' Punctuation +')' Punctuation +'\n' Text + +' ' Text +'rate' Name +'.' Punctuation +'low' Name +'=' Operator +'Low' Keyword +'[' Punctuation +'0' Literal.Number.Integer +']' Punctuation +';' Punctuation +'\n' Text + +' ' Text +'if' Keyword +'(' Punctuation +'rate' Name +'.' Punctuation +'high' Name +'<' Operator +'High' Keyword +'[' Punctuation +'0' Literal.Number.Integer +']' Punctuation +')' Punctuation +'\n' Text + +' ' Text +'rate' Name +'.' Punctuation +'high' Name +'=' Operator +'High' Keyword +'[' Punctuation +'0' Literal.Number.Integer +']' Punctuation +';' Punctuation +'\n' Text + +' ' Text +'rate' Name +'.' Punctuation +'close' Name +'=' Operator +'Close' Keyword +'[' Punctuation +'0' Literal.Number.Integer +']' Punctuation +';' Punctuation +'\n' Text + +' ' Text +'}' Punctuation +'\n' Text + +' ' Text +'last_fpos' Name +'=' Operator +'FileTell' Name.Function +'(' Punctuation +'ExtHandle' Name +')' Punctuation +';' Punctuation +'\n' Text + +' ' Text +'last_volume' Name +'=' Operator +'(' Punctuation +'long' Keyword.Type +')' Punctuation +'Volume' Keyword +'[' Punctuation +'i' Name +']' Punctuation +';' Punctuation +'\n' Text + +' ' Text +'FileWriteStruct' Name.Function +'(' Punctuation +'ExtHandle' Name +',' Punctuation +'rate' Name +')' Punctuation +';' Punctuation +'\n' Text + +' ' Text +'cnt' Name +'+' Operator +'+' Operator +';' Punctuation +'\n' Text + +' ' Text +'if' Keyword +'(' Punctuation +'time0' Name +'>' Operator +'=' Operator +'rate' Name +'.' Punctuation +'time' Name +'+' Operator +'periodseconds' Name +')' Punctuation +'\n' Text + +' ' Text +'{' Punctuation +'\n' Text + +' ' Text +'rate' Name +'.' Punctuation +'time' Name +'=' Operator +'time0' Name +'/' Operator +'periodseconds' Name +';' Punctuation +'\n' Text + +' ' Text +'rate' Name +'.' Punctuation +'time' Name +'*' Operator +'=' Operator +'periodseconds' Name +';' Punctuation +'\n' Text + +' ' Text +'rate' Name +'.' Punctuation +'open' Name +'=' Operator +'Open' Keyword +'[' Punctuation +'i' Name +']' Punctuation +';' Punctuation +'\n' Text + +' ' Text +'rate' Name +'.' Punctuation +'low' Name +'=' Operator +'Low' Keyword +'[' Punctuation +'i' Name +']' Punctuation +';' Punctuation +'\n' Text + +' ' Text +'rate' Name +'.' Punctuation +'high' Name +'=' Operator +'High' Keyword +'[' Punctuation +'i' Name +']' Punctuation +';' Punctuation +'\n' Text + +' ' Text +'rate' Name +'.' Punctuation +'close' Name +'=' Operator +'Close' Keyword +'[' Punctuation +'i' Name +']' Punctuation +';' Punctuation +'\n' Text + +' ' Text +'rate' Name +'.' Punctuation +'tick_volume' Name +'=' Operator +'last_volume' Name +';' Punctuation +'\n' Text + +' ' Text +'}' Punctuation +'\n' Text + +' ' Text +'}' Punctuation +'\n' Text + +' ' Text +'else' Keyword +'\n' Text + +' ' Text +'{' Punctuation +'\n' Text + +' ' Text +'rate' Name +'.' Punctuation +'tick_volume' Name +'+' Operator +'=' Operator +'(' Punctuation +'long' Keyword.Type +')' Punctuation +'Volume' Keyword +'[' Punctuation +'i' Name +']' Punctuation +';' Punctuation +'\n' Text + +' ' Text +'if' Keyword +'(' Punctuation +'rate' Name +'.' Punctuation +'low' Name +'>' Operator +'Low' Keyword +'[' Punctuation +'i' Name +']' Punctuation +')' Punctuation +'\n' Text + +' ' Text +'rate' Name +'.' Punctuation +'low' Name +'=' Operator +'Low' Keyword +'[' Punctuation +'i' Name +']' Punctuation +';' Punctuation +'\n' Text + +' ' Text +'if' Keyword +'(' Punctuation +'rate' Name +'.' Punctuation +'high' Name +'<' Operator +'High' Keyword +'[' Punctuation +'i' Name +']' Punctuation +')' Punctuation +'\n' Text + +' ' Text +'rate' Name +'.' Punctuation +'high' Name +'=' Operator +'High' Keyword +'[' Punctuation +'i' Name +']' Punctuation +';' Punctuation +'\n' Text + +' ' Text +'rate' Name +'.' Punctuation +'close' Name +'=' Operator +'Close' Keyword +'[' Punctuation +'i' Name +']' Punctuation +';' Punctuation +'\n' Text + +' ' Text +'}' Punctuation +'\n' Text + +' ' Text +'}' Punctuation +' \n ' Text +'FileFlush' Name.Function +'(' Punctuation +'ExtHandle' Name +')' Punctuation +';' Punctuation +'\n' Text + +' ' Text +'Print' Name.Function +'(' Punctuation +'cnt' Name +',' Punctuation +'"' Literal.String +' record(s) written' Literal.String +'"' Literal.String +')' Punctuation +';' Punctuation +'\n' Text + +'//--- collect incoming ticks\n' Comment.Single + +' ' Text +'datetime' Keyword.Type +' ' Text +'last_time' Name +'=' Operator +'LocalTime' Name +'(' Punctuation +')' Punctuation +'-5' Literal.Number.Integer +';' Punctuation +'\n' Text + +' ' Text +'while' Keyword +'(' Punctuation +'!' Operator +'IsStopped' Name.Function +'(' Punctuation +')' Punctuation +')' Punctuation +'\n' Text + +' ' Text +'{' Punctuation +'\n' Text + +' ' Text +'datetime' Keyword.Type +' ' Text +'cur_time' Name +'=' Operator +'LocalTime' Name +'(' Punctuation +')' Punctuation +';' Punctuation +'\n' Text + +' ' Text +'//--- check for new rates\n' Comment.Single + +' ' Text +'if' Keyword +'(' Punctuation +'RefreshRates' Name.Function +'(' Punctuation +')' Punctuation +')' Punctuation +'\n' Text + +' ' Text +'{' Punctuation +'\n' Text + +' ' Text +'time0' Name +'=' Operator +'Time' Keyword +'[' Punctuation +'0' Literal.Number.Integer +']' Punctuation +';' Punctuation +'\n' Text + +' ' Text +'FileSeek' Name.Function +'(' Punctuation +'ExtHandle' Name +',' Punctuation +'last_fpos' Name +',' Punctuation +'SEEK_SET' Name.Constant +')' Punctuation +';' Punctuation +'\n' Text + +' ' Text +'//--- is there current bar?\n' Comment.Single + +' ' Text +'if' Keyword +'(' Punctuation +'time0' Name +'<' Operator +'rate' Name +'.' Punctuation +'time' Name +'+' Operator +'periodseconds' Name +')' Punctuation +'\n' Text + +' ' Text +'{' Punctuation +'\n' Text + +' ' Text +'rate' Name +'.' Punctuation +'tick_volume' Name +'+' Operator +'=' Operator +'(' Punctuation +'long' Keyword.Type +')' Punctuation +'Volume' Keyword +'[' Punctuation +'0' Literal.Number.Integer +']' Punctuation +'-' Operator +'last_volume' Name +';' Punctuation +'\n' Text + +' ' Text +'last_volume' Name +'=' Operator +'(' Punctuation +'long' Keyword.Type +')' Punctuation +'Volume' Keyword +'[' Punctuation +'0' Literal.Number.Integer +']' Punctuation +';' Punctuation +' \n ' Text +'if' Keyword +'(' Punctuation +'rate' Name +'.' Punctuation +'low' Name +'>' Operator +'Low' Keyword +'[' Punctuation +'0' Literal.Number.Integer +']' Punctuation +')' Punctuation +'\n' Text + +' ' Text +'rate' Name +'.' Punctuation +'low' Name +'=' Operator +'Low' Keyword +'[' Punctuation +'0' Literal.Number.Integer +']' Punctuation +';' Punctuation +'\n' Text + +' ' Text +'if' Keyword +'(' Punctuation +'rate' Name +'.' Punctuation +'high' Name +'<' Operator +'High' Keyword +'[' Punctuation +'0' Literal.Number.Integer +']' Punctuation +')' Punctuation +'\n' Text + +' ' Text +'rate' Name +'.' Punctuation +'high' Name +'=' Operator +'High' Keyword +'[' Punctuation +'0' Literal.Number.Integer +']' Punctuation +';' Punctuation +'\n' Text + +' ' Text +'rate' Name +'.' Punctuation +'close' Name +'=' Operator +'Close' Keyword +'[' Punctuation +'0' Literal.Number.Integer +']' Punctuation +';' Punctuation +'\n' Text + +' ' Text +'}' Punctuation +'\n' Text + +' ' Text +'else' Keyword +'\n' Text + +' ' Text +'{' Punctuation +'\n' Text + +' ' Text +'//--- no, there is new bar\n' Comment.Single + +' ' Text +'rate' Name +'.' Punctuation +'tick_volume' Name +'+' Operator +'=' Operator +'(' Punctuation +'long' Keyword.Type +')' Punctuation +'Volume' Keyword +'[' Punctuation +'1' Literal.Number.Integer +']' Punctuation +'-' Operator +'last_volume' Name +';' Punctuation +'\n' Text + +' ' Text +'if' Keyword +'(' Punctuation +'rate' Name +'.' Punctuation +'low' Name +'>' Operator +'Low' Keyword +'[' Punctuation +'1' Literal.Number.Integer +']' Punctuation +')' Punctuation +'\n' Text + +' ' Text +'rate' Name +'.' Punctuation +'low' Name +'=' Operator +'Low' Keyword +'[' Punctuation +'1' Literal.Number.Integer +']' Punctuation +';' Punctuation +'\n' Text + +' ' Text +'if' Keyword +'(' Punctuation +'rate' Name +'.' Punctuation +'high' Name +'<' Operator +'High' Keyword +'[' Punctuation +'1' Literal.Number.Integer +']' Punctuation +')' Punctuation +'\n' Text + +' ' Text +'rate' Name +'.' Punctuation +'high' Name +'=' Operator +'High' Keyword +'[' Punctuation +'1' Literal.Number.Integer +']' Punctuation +';' Punctuation +'\n' Text + +' ' Text +'//--- write previous bar remains\n' Comment.Single + +' ' Text +'FileWriteStruct' Name.Function +'(' Punctuation +'ExtHandle' Name +',' Punctuation +'rate' Name +')' Punctuation +';' Punctuation +'\n' Text + +' ' Text +'last_fpos' Name +'=' Operator +'FileTell' Name.Function +'(' Punctuation +'ExtHandle' Name +')' Punctuation +';' Punctuation +'\n' Text + +' ' Text +'//----\n' Comment.Single + +' ' Text +'rate' Name +'.' Punctuation +'time' Name +'=' Operator +'time0' Name +'/' Operator +'periodseconds' Name +';' Punctuation +'\n' Text + +' ' Text +'rate' Name +'.' Punctuation +'time' Name +'*' Operator +'=' Operator +'periodseconds' Name +';' Punctuation +'\n' Text + +' ' Text +'rate' Name +'.' Punctuation +'open' Name +'=' Operator +'Open' Keyword +'[' Punctuation +'0' Literal.Number.Integer +']' Punctuation +';' Punctuation +'\n' Text + +' ' Text +'rate' Name +'.' Punctuation +'low' Name +'=' Operator +'Low' Keyword +'[' Punctuation +'0' Literal.Number.Integer +']' Punctuation +';' Punctuation +'\n' Text + +' ' Text +'rate' Name +'.' Punctuation +'high' Name +'=' Operator +'High' Keyword +'[' Punctuation +'0' Literal.Number.Integer +']' Punctuation +';' Punctuation +'\n' Text + +' ' Text +'rate' Name +'.' Punctuation +'close' Name +'=' Operator +'Close' Keyword +'[' Punctuation +'0' Literal.Number.Integer +']' Punctuation +';' Punctuation +'\n' Text + +' ' Text +'rate' Name +'.' Punctuation +'tick_volume' Name +'=' Operator +'(' Punctuation +'long' Keyword.Type +')' Punctuation +'Volume' Keyword +'[' Punctuation +'0' Literal.Number.Integer +']' Punctuation +';' Punctuation +'\n' Text + +' ' Text +'last_volume' Name +'=' Operator +'rate' Name +'.' Punctuation +'tick_volume' Name +';' Punctuation +'\n' Text + +' ' Text +'}' Punctuation +'\n' Text + +' ' Text +'//----\n' Comment.Single + +' ' Text +'FileWriteStruct' Name.Function +'(' Punctuation +'ExtHandle' Name +',' Punctuation +'rate' Name +')' Punctuation +';' Punctuation +'\n' Text + +' ' Text +'FileFlush' Name.Function +'(' Punctuation +'ExtHandle' Name +')' Punctuation +';' Punctuation +'\n' Text + +' ' Text +'//---\n' Comment.Single + +' ' Text +'if' Keyword +'(' Punctuation +'hwnd' Name +'=' Operator +'=' Operator +'0' Literal.Number.Integer +')' Punctuation +'\n' Text + +' ' Text +'{' Punctuation +'\n' Text + +' ' Text +'hwnd' Name +'=' Operator +'WindowHandle' Name.Function +'(' Punctuation +'Symbol' Name.Function +'(' Punctuation +')' Punctuation +',' Punctuation +'i_period' Name +')' Punctuation +';' Punctuation +'\n' Text + +' ' Text +'if' Keyword +'(' Punctuation +'hwnd' Name +'!' Operator +'=' Operator +'0' Literal.Number.Integer +')' Punctuation +'\n' Text + +' ' Text +'Print' Name.Function +'(' Punctuation +'"' Literal.String +'Chart window detected' Literal.String +'"' Literal.String +')' Punctuation +';' Punctuation +'\n' Text + +' ' Text +'}' Punctuation +'\n' Text + +' ' Text +'//--- refresh window not frequently than 1 time in 2 seconds\n' Comment.Single + +' ' Text +'if' Keyword +'(' Punctuation +'hwnd' Name +'!' Operator +'=' Operator +'0' Literal.Number.Integer +' ' Text +'&' Operator +'&' Operator +' ' Text +'cur_time' Name +'-' Operator +'last_time' Name +'>' Operator +'=' Operator +'2' Literal.Number.Integer +')' Punctuation +'\n' Text + +' ' Text +'{' Punctuation +'\n' Text + +' ' Text +'PostMessageA' Name +'(' Punctuation +'hwnd' Name +',' Punctuation +'WM_COMMAND' Name +',' Punctuation +'33324' Literal.Number.Integer +',' Punctuation +'0' Literal.Number.Integer +')' Punctuation +';' Punctuation +'\n' Text + +' ' Text +'last_time' Name +'=' Operator +'cur_time' Name +';' Punctuation +'\n' Text + +' ' Text +'}' Punctuation +'\n' Text + +' ' Text +'}' Punctuation +'\n' Text + +' ' Text +'Sleep' Name.Function +'(' Punctuation +'50' Literal.Number.Integer +')' Punctuation +';' Punctuation +' \n ' Text +'}' Punctuation +' \n' Text + +'//---\n' Comment.Single + +' ' Text +'}' Punctuation +'\n' Text + +'//+------------------------------------------------------------------+\n' Comment.Single + +'//| |\n' Comment.Single + +'//+------------------------------------------------------------------+\n' Comment.Single + +'void' Keyword.Type +' ' Text +'OnDeinit' Name.Function +'(' Punctuation +'const' Keyword +' ' Text +'int' Keyword.Type +' ' Text +'reason' Name +')' Punctuation +'\n' Text + +' ' Text +'{' Punctuation +'\n' Text + +'//---\n' Comment.Single + +' ' Text +'if' Keyword +'(' Punctuation +'ExtHandle' Name +'>' Operator +'=' Operator +'0' Literal.Number.Integer +')' Punctuation +'\n' Text + +' ' Text +'{' Punctuation +'\n' Text + +' ' Text +'FileClose' Name.Function +'(' Punctuation +'ExtHandle' Name +')' Punctuation +';' Punctuation +'\n' Text + +' ' Text +'ExtHandle' Name +'=' Operator +'-1' Literal.Number.Integer +';' Punctuation +'\n' Text + +' ' Text +'}' Punctuation +'\n' Text + +'//---\n' Comment.Single + +' ' Text +'}' Punctuation +'\n' Text + +'//+------------------------------------------------------------------+\n' Comment.Single |
