autorefresh_timer

Author: www.forex-tsd.com
0 Views
0 Downloads
0 Favorites
autorefresh_timer
//+------------------------------------------------------------------+
//|                                                      ProjectName |
//|                                      Copyright 2012, CompanyName |
//|                                       http://www.companyname.net |
//+------------------------------------------------------------------+
#property copyright "www.forex-tsd.com"
#property link      "www.forex-tsd.com"
//---
#property indicator_chart_window
#property strict
//---
extern int PeriodMiliSeconds=250;  // Period in miliseconds
//+------------------------------------------------------------------+
//|                                                                  |
//+------------------------------------------------------------------+
void OnInit()
  {
   EventSetMillisecondTimer((int)MathMax(PeriodMiliSeconds,16));
  }
//+------------------------------------------------------------------+
//|                                                                  |
//+------------------------------------------------------------------+
void OnDeinit(const int Des)
  {
   EventKillTimer();
  }
//+------------------------------------------------------------------+
//|                                                                  |
//+------------------------------------------------------------------+
int OnCalculate(const int rates_total,const int prev_calculated,const datetime &time[],const double &open[],const double &high[],const double &low[],const double &close[],const long &tick_volume[],const long &volume[],const int &spread[])
  {
   return(0);
  }
//+------------------------------------------------------------------+
#import "user32.dll"
int RegisterWindowMessageW(string lpString);
int PostMessageW(int hWnd,int Msg,int wParam,int lParam);
#import
#define WM_COMMAND 0x0111
//+------------------------------------------------------------------+
//|                                                                  |
//+------------------------------------------------------------------+
void OnTimer()
  {
   static bool inUpdate=false;
   if(inUpdate) return;
   inUpdate=true;
   static int handle=0;
   if(handle == 0) handle = RegisterWindowMessageW("MetaTrader4_Internal_Message");
   if(handle!=0)
     {
      int whandle=WindowHandle(Symbol(),Period());
      PostMessageW(whandle,WM_COMMAND,33324,0);
      PostMessageW(whandle,handle,2,1);
     }
   inUpdate=false;
  }
//+------------------------------------------------------------------+

Comments

Markdown supported. Formatting help

Markdown Formatting Guide

Element Markdown Syntax
Heading # H1
## H2
### H3
Bold **bold text**
Italic *italicized text*
Link [title](https://www.example.com)
Image ![alt text](image.jpg)
Code `code`
Code Block ```
code block
```
Quote > blockquote
Unordered List - Item 1
- Item 2
Ordered List 1. First item
2. Second item
Horizontal Rule ---