作者:拉斐尔·希门尼斯·托西诺
RJTX_Matches_Smoothed 指标,支持手机推送通知、邮件提醒等功能,助您在交易中更轻松地捕捉信号。
为了实现提醒、邮件和推送通知,本指标的代码进行了以下修改:
- 新增输入变量:
- 新增三个函数:BuySignal()、SellSignal() 和 GetStringTimeframe():
- 在 OnCalculate() 计算周期中,新增了对 BuySignal() 和 SellSignal() 函数的调用:
input uint NumberofBar=1; // 激活信号的柱数 input bool SoundON=true; // 启用声音提醒 input uint NumberofAlerts=2; // 提醒次数 input bool EMailON=false; // 启用邮件发送信号 input bool PushON=false; // 启用手机推送信号
//+------------------------------------------------------------------+ //| 买入信号函数 | //+------------------------------------------------------------------+ void BuySignal(string SignalSirname, // 指标名称文本,用于邮件和推送消息 double &BuyArrow[], // 买入信号的指标缓冲区 const int Rates_total, // 当前柱数 const int Prev_calculated, // 上一根柱的数量 const double &Close[], // 收盘价 const int &Spread[]) // 点差 {
//--- BuySignal("RJTX_Matches_Smoothed_Alert",BuyBuffer,rates_total,prev_calculated,close,spread); SellSignal("RJTX_Matches_Smoothed_Alert",SellBuffer,rates_total,prev_calculated,close,spread); //---
其中,BuyBuffer 和 SellBuffer 是存储买入和卖出信号的指标缓冲区。空值应以零或 EMPTY_VALUE 添加到指标缓冲区。
在指标代码中的 OnCalculate() 中假定只调用一次 BuySignal() 和 SellSignal() 函数。
该指标使用了 SmoothAlgorithms.mqh 库类(需复制到 <terminal_data_directory>\MQL5\Include 文件夹)。类的使用已在文章 《无额外缓冲区的中间计算的平均价格序列》 中详细描述。
这个指标最初是用 MQL4 实现的,并于 2015 年 12 月 23 日发布在 代码库。

图1. RJTX_Matches_Smoothed_Alert 指标在图表上的表现
图2. RJTX_Matches_Smoothed_Alert 指标的提醒

评论 0