'//+------------------------------------------------------------------+\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 '' 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