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

CIsSession - class to set time intervals (sessions) - MetaTrader 5용 라이브러리

조회수:
6634
평가:
(34)
게시됨:
2016.01.20 09:51
업데이트됨:
2016.11.22 07:32
\MQL5\Include\
issession.mqh (10.15 KB) 조회
\MQL5\Experts\
이 코드를 기반으로 한 로봇이나 지표가 필요하신가요? 프리랜스로 주문하세요 프리랜스로 이동

I decided to publish this class after reading this publication. This topic looks interesting. My approach does not solve every problem as well. Therefore, suggest what can be improved.

The class usage example was made similar to this variant. That way it is easier to see the advantages and disadvantages.

The advantages:

  1. Possibility of standard input of date and time. See the picture. Less likelihood of mistakes.
  2. The possibility to optimize the time intervals in the strategy tester is preserved.
  3. All the settings can be quickly changed anywhere in program.
  4. More usage options. Details after the picture.
  5. Easier to use in the code. At least for me.

Options for setting the time

1. Daily session. For example, it allows the trading every day in the specified time interval. Conditions:

  • The session start and end dates are equal to 1970.01.01.
  • The session start time is less than the session end time.

2. Night session. For example, the trading through the night is allowed: start today, end tomorrow. And so every day. Conditions:

  • The session start and end dates are equal to 1970.01.01.
  • The session start time is greater than the session end time.

3. Within the range of dates. For example, the trading is allowed from the session start date up to the session end date. Conditions:

  • The session start date is less than the session end date.
  • Any time, but it is also considered.

4. Out of the range of dates. The session start date is greater than the session end date. Thus, the trading is allowed until the session end date and after the new session start date. Conditions:

  • The session start date is greater than the session end date.
  • Any time, but it is also considered.

5. Disabling/enabling the trading on a week day. It is sufficient to set "true" in the parameters for each of the week days, if you want to trade. Or "false" to disable trading.

6. All the setting can be changed anywhere in program using the Init() methods.


P.S. The class was created for the MetaTrader 5, but it also works for the MetaTrader 4. The only difference is that the MetaTrader 4 strategy tester does not support the optimization of the time intervals in the datеtime format. But it is solved by replacing the datеtime to long in the EA input parameters.

MetaQuotes Ltd에서 러시아어로 번역함.
원본 코드: https://www.mql5.com/ru/code/14305

VWAP Lite - Volume Weighted Average Price VWAP Lite - Volume Weighted Average Price

VWAP is an intra-day calculation used primarily by algorithms and institutional traders to assess where a stock is trading relative to its volume weighted average for the day.

ManualTradeOnStrategyTester ManualTradeOnStrategyTester

A simple way on how EA can link a manual order command from outside to use it in MetaTrader 5 Strategy Tester.

Sentiment Sentiment

Robot that trades the open sentiment of the market.

TradeState - the EA trading mode switcher depending on the time TradeState - the EA trading mode switcher depending on the time

The class restricts the EA trading by time. It has flexible configuration options, which allow to set a custom number of the time zones, and also to allow trading only on the specified week days.