//+------------------------------------------------------------------+
//| ChartRefresh.mq4 |
//| sanyooooook |
//| http://sn-bot.ru |
//+------------------------------------------------------------------+
#property copyright "sanyooooook"
#property link "http://sn-bot.ru"
#property version "1.00"
#property strict
#include <WinUser32.mqh>
int hwnd=0,cnt=0;
//+------------------------------------------------------------------+
//| Script program start function |
//+------------------------------------------------------------------+
void OnStart()
{
//---
datetime last_time=LocalTime()-5;
while(!IsStopped())
{
datetime cur_time=LocalTime();
if(hwnd==0)
{
hwnd=WindowHandle(Symbol(),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(100);
}
}
//+------------------------------------------------------------------+
Comments