refreshchart_and_tiks

0 Views
0 Downloads
0 Favorites
refreshchart_and_tiks
//+------------------------------------------------------------------+
//|                                         refreshchart_and_tiks.mq4|
//+------------------------------------------------------------------+
#property link      "https://www.mql5.com/ru/users/yurecwach/"
#property version   "1.00"
#property script_show_inputs
#property strict
//+------------------------------------------------------------------+
input int Step=100;
//+------------------------------------------------------------------+
#include <WinUser32.mqh>
   int    hwnd=0,MT4InternalMsg=0;
#import "user32.dll"
   int PostMessageW(int hWnd, int Msg, int wParam, int lParam);
	int RegisterWindowMessageW(string lpString); 
#import

//+------------------------------------------------------------------+
void OnStart()
  {
   if(MT4InternalMsg == 0) 
   MT4InternalMsg = RegisterWindowMessageW("MetaTrader4_Internal_Message");
   datetime last_time=LocalTime()-5;
   while(!IsStopped())
     {
      datetime cur_time=LocalTime();
      if(hwnd==0)
        {
         hwnd=WindowHandle(Symbol(),Period());
        }
      if(hwnd!=0 && cur_time-last_time>=0&& MT4InternalMsg != 0)
        {
         PostMessageW(hwnd,WM_COMMAND,33324,0);
         PostMessageW(hwnd,MT4InternalMsg,2,1);
         last_time=cur_time;
        }
      Sleep(Step);
     }
  }
//+------------------------------------------------------------------+

Comments