MQL4 - automated forex trading   /  

Code Base

Code Base  MetaTrader 5  Trade Sessions Indicator in MQL5 (not an expert advisor). To post a new code, please log in or register

This script is for
MetaTrader 4
Download MT 4 - 5.5 Mb

Mobile trading!
Buy a license and be mobile in your trading!

Name:
Trade Sessions Indicator in MQL5 (not an expert advisor). [ ru ]
Author: vdv2001 (2009.11.05 13:12)
Downloaded: 516
Download:
 Trading Sessions Open Close.mq5 (8.5 Kb) View

Author:

vdv2001

Description:

Trade Sessions Indicator (it's an indicator, not an expert advisor).

It was interesting to work with DRAW_FILLING buffers in MQL5. The result is here ;)

There is no input parameters because of the functions TimeTradeServer(), TimeGMT().

The unaccuracy in the trade session times is possible, the values are from the first site I have found :))

It is possible to change its values in the block of constants, GMT time is used.

//    Time constants are specified across Greenwich
const int   AsiaOpen=0;
const int   AsiaClose=9;
const int   AsiaOpenSummertime=1;   // The Asian session taking into account summer and winter time
const int   AsiaCloseSummertime=10; // Asian session shifts while time changes to the summer time
const int   EuropaOpen=6;
const int   EuropaClose=15;
const int   AmericaOpen=13;
const int   AmericaClose=22;

There is an opportunity to use the time changes to the summer time, at present time it's a primitive and realized with the function TimeDaylightSavings();

//+--------------------------------------------------------------------+
// Summertime definition - is reserved for the future calculations
//+--------------------------------------------------------------------+
bool Summertime(datetime time)
{
   if(TimeDaylightSavings()!=0)
      return(true);
   else
      return(false);
}
...
...
   AsiaStart=_start+(Summertime(Start)?AsiaOpenSummertime:AsiaOpen)*PeriodSeconds(PERIOD_H1);
   AsiaEnd=_start+(Summertime(Start)?AsiaCloseSummertime:AsiaClose)*PeriodSeconds(PERIOD_H1)-1;
...

So, after the time change to the summer time, all of the history changes it's time and vice versa. If somebody want to correct it, let's discuss the ways to fix it.


Picture:

1 comment  To post a new comment, please log in or register

Is there a mq4 version?

31.01.2010 21:50 Jetcity4x