거래 로봇을 무료로 다운로드 하는 법을 시청해보세요
당사를 Twitter에서 찾아주십시오!
당사 팬 페이지에 가입하십시오
스크립트가 흥미로우신가요?
그렇다면 링크 to it -
하셔서 다른 이들이 평가할 수 있도록 해보세요
스크립트가 마음에 드시나요? MetaTrader 5 터미널에서 시도해보십시오
라이브러리

Class for set and check your trading time - MetaTrader 5용 라이브러리

조회수:
4664
평가:
(33)
게시됨:
2015.02.27 10:43
업데이트됨:
2016.11.22 07:32
TimeControl.mqh (19.99 KB) 조회
이 코드를 기반으로 한 로봇이나 지표가 필요하신가요? 프리랜스로 주문하세요 프리랜스로 이동

CTimeControl class for include to your EA for easy setting and checking your own trading time.

An example of usage:

Include:

#include "TimeControl.mqh"

Default constructor:

CTimeControl   timeControl;

Or constructor with days:

CTimeControl timeControl(false, true, true, false, false, false, false);

Or constructor with array of days settings and arrays for trading times in every day:

bool     arrDaysSetting[7] = { false, true, true, false, false, false, false};
int      
arrStartHours[7] = { 0, 15, 14, 0, 0, 0, 0};
double  
arrStartMinutes[7] = { 0, 15, 14, 0, 0, 0, 0};
int      
arrStopHours[7] = { 23, 13, 21, 23, 23, 23, 23};
double  
arrStopMinutes[7] = { 0, 15, 14, 0, 0, 0, 0};

CTimeControl timeControl2( arrDaysSetting, arrStartHours, arrStartMinutes, arrStopHours, arrStopMinutes);

For get/set parameter of every day u can use functions with ENUM_DAY_OF_WEEK index for day what u want to set/get:

bool bMonday = timeControl.GetDay(MONDAY);

timeControl.SetDay(MONDAY, true);// enable monday
timeControl.EnableDay(MONDAY);   // enable monday
timeControl.DisableDay(MONDAY);  // disable monday

int iStartHour, iStopHour;
double
dStartMinute, dStopMinute;

timeControl.GetTradingTime(MONDAY, iStartHour, dStartMinute, iStopHour, dStopMinute);

or you can check every day with defined functions:

bool bMonday = timeControl.GetMonday();

timeControl.SetMonday(true); //enable monday
timeControl.EnableMonday();  //disable monday
timeControl.DisableMonday(); //disable monday

 Main function for check if trading time is enabled (use current server time)

if ( timeControl.IsTradingTime() == true )

{
   //do something
}

else

{
   //do something
}

or you can check your own datetime:

datetime date = D'24.02.2015 12:30:27'

if ( timeControl.IsTradingTime(date) == true )
{
   //do something
}
else
{
   //do something
}

Indicator Arrows II Indicator Arrows II

Plots up/down buffer arrows in chart window.

CHashArrayStringString CHashArrayStringString

Example of implementation of lines hash array with a string key.

Smoothed_RSI and RSI_of_MA Smoothed_RSI and RSI_of_MA

Smoothed RSI indicator and RSI of Moving Average.

Fractal ZigZag Fractal ZigZag

This indicator is MQL5 version of FractalZigZagNoRepaint, it displays swing highs and lows.