指标名称:自动交易时段
版本:MT4 ver. 6.02
自动交易时段是一款用于自动标记和管理不同金融市场交易时段的软件工具。它能够帮助交易者识别各大市场(如纽约、伦敦、东京和悉尼)的开盘和收盘时间,从而更好地规划交易策略和时间。
功能特点:
-
多市场识别:自动识别并显示最多五个不同的交易市场时段。
-
高亮显示:交易时段将以不同颜色高亮显示,便于用户快速识别当前活跃市场。
-
时间校准:根据用户的地理位置调整市场开闭市时间,确保时间显示的准确性。
-
用户自定义:用户可以自定义要显示的市场、颜色及其他显示设置。
-
实时更新:软件将根据市场变动实时更新交易时段的开始和结束时间。
参数说明:
sinput ENUM_TimeMethod TimeMethod = Broker_Eastern_Offset
默认使用经纪商东部时间偏移方式来确定交易时段的开始和结束时间。
sinput int BrokerEasternOffset 设置经纪商的东部时间偏移量,默认为7。
Manual_SessionBegins 手动设置每个交易时段的开始时间。
Manual_SessionEnds 手动设置每个交易时段的结束时间。
sinput string SessionNames = SESS_NAMES_DEFAULT
可以自定义设置显示的交易时段名称。
sinput color Color1 = clrBlue
第一个交易时段的显示颜色为蓝色。
sinput ENUM_SessionStyle Style1 = Rectangle_Fill
第一个交易时段的显示风格为填充矩形。
sinput bool PipsRounded = true
是否对显示的点数进行四舍五入。
sinput bool PipsWord = false
是否在点数后添加“pips”文字说明。
用户可以通过修改参数来自定义指标的显示风格和行为,如调整时间偏移、选择显示的交易时段、改变颜色和风格等。
所有设置都可以在MetaTrader平台的指标设置界面中进行调整。
该指标非常适合需要关注多个交易时段开闭市时间的交易者,帮助他们更好地把握交易机会。
部分代码展示:
// +--------------------------------------------------------------------+
// | 自动交易时段 |
//| Copyright © 2009-2024, www.QChaos.com |
//| https://www.qchaos.com/ |
//+------------------------------------------------------------------+
#property copyright "Copyright © 量化混沌, www.qchaos.com"
#property link "https://www.qchaos.com"
#property version "6.02"
#property description "---------------------------------------------"
#property description "EA、指标公式分享"
#property description "EA、指标编写业务承接"
#property description "---------------------------------------------"
#property description "---------------------------------------------"
#property indicator_chart_window
#property indicator_buffers 0
//#property indicator_color1 clrNONE //CornflowerBlue
#define PROPERTY_DESCRIPTION_1 "高亮显示交易时段"
#define PROPERTY_DESCRIPTION_2 " "
#define PROPERTY_DESCRIPTION_3 "最多显示5个不同的交易时段"
#ifdef __MQL4__
#define MQL4(x) x
#else
#define MQL4(x)
#endif
//#ifdef __MQL5__
//#define MQL5(x) x
//#else
//#define MQL5(x)
//#endif
#define DEBUG 0 // #define DEBUG 1 // Print useful info in the Experts tab.
#define DbugInfo(x) x // define as x for informational debugging 4
#define INPUTVARDELIMITER "================================"
#define ONEHOURsecs 3600 // 1 hour in seconds
#define ONEDAYsecs 86400 // 1 day in seconds
#define ONEDAYmins 1440 // 1 day in minutes
#define NAMEPIPDELIMITER " " // String between Session Name and Session Pips
#define NAMEPIPMARGIN " " // Pad the Session Text with this string
#define REASON_USER_INIT 2021 // Custom OnDeinit() reason
#define WINMAXVAL 1.5 //100.0 // Sufficiently large Window Minimum/Maximum that will ever be visible during whole Timeseries scroll
// June 2021 MT5 version didn't display objects when 10000.0 and above
#define MAX_SESSIONS 5 // This should be equal to the number of input colors and >= the number of sessions in $SESS_NAMES_DFAULT
#define SESS_NAMES_DEFAULT "Sydney/Tokyo/Frankfurt/London/NY" // The