当前位置: 首页 > article >正文

ZigZagOnParabolic,MetaTrader 免费公式!(指标教程)

ZigZagOnParabolic 是一款适用于 MetaTrader 4 和 MetaTrader 5 的指标,结合了 ZigZag 和抛物线转向指标(Parabolic SAR),旨在改进传统 ZigZag 指标,通过更精确的图表极值标记和减少延迟来提升性能。传统 ZigZag 通过监测价格相对前一个极值的偏差百分比来识别新极值,而新版本的 ZigZagOnParabolic 则结合了抛物线转向指标的优势,使极值的捕捉更加可靠。该指标在 MetaTrader 平台上绘制 ZigZag 和抛物线转向线,方便用户识别关键价格点。

输入参数

  • -步长 (默认 = 0.02):抛物线转向指标的标准参数之一。
  • -最大值 (默认 = 0.2):抛物线转向指标的另一参数。
  • - ExtremumsShift (默认 = 图表时间):控制极值显示的位置。如果设为图表时间,极值会显示在价格达到的实际位置;若设为检测时间,极值会显示在被检测到的时间点,可以用于观察检测延迟。
  • -历史 (默认 = 0):用于计算的 K 线数量。如果性能出现问题,可设为非零值来减少计算量;0 表示所有 K 线都会用于计算。
  • -EnableNativeAlerts (默认 = false):如设为 true,当检测到新的极值时会弹出 MetaTrader 提醒。
  • -EnableEmailAlerts (默认 = false):如设为 true,当检测到新的极值时会发送邮件通知(需在 MetaTrader 中正确配置邮件设置)。
  • -EnablePushAlerts (默认 = false):如设为 true,当检测到新的极值时会发送推送通知(需在 MetaTrader 中正确配置通知设置)。

图表中的 ZigZagOnParabolic 示例展示了 ExtremumsShift 参数设为图表时间的情况,极值与实际高低点一致。虽然 ZigZag 指标通常不用于生成直接交易信号,但它可以作为最大值和最小值的参考点来开仓。同时,它在构建通道、支撑位、阻力位等方面有重要用途,还能为其他图表形态提供参考。

下图例图中,ExtremumsShift 参数设为检测时间,这导致极值标记稍有延迟,与抛物线转向指标的反转保持一致。这样可以更好地反映指标识别信号的时间特性。

部分代码展示

//+------------------------------------------------------------------+//|                                              ZigZag on Parabolic |//|                                Copyright © 2009-2022, www.QChaos.com |//|                                          https://www.qchaos.com/ |//+------------------------------------------------------------------+#property copyright "Copyright © 2009-2024, www.qchaos.com"#property link      "https://www.qchaos.com"#property version   "1.03"#property strict#property description "---------------------------------------------"#property description "EA、指标公式分享"#property description "EA、指标编写业务承接"#property description "---------------------------------------------"#property description "更多资源,关注公众号:量化程序"#property description "微  信:QChaos001"#property description "手机号:134-8068-5281"#property description "---------------------------------------------"

#property indicator_chart_window#property indicator_buffers 3#property indicator_color1 clrAqua#property indicator_type1  DRAW_ZIGZAG#property indicator_label1 "Peak"#property indicator_color2 clrAqua#property indicator_type2  DRAW_ZIGZAG#property indicator_label2 "Trough"#property indicator_color3 clrBlue#property indicator_type3  DRAW_ARROW#property indicator_label3 "SAR"
enum enum_extremum_position{    DetectionTime, // Detection time    ChartTime // Chart time};
input double Step = 0.02;input double Maximum = 0.2;input enum_extremum_position ExtremumsShift = ChartTime;input int History = 0; // History: number of bars to look at. 0 - all.input bool EnableNativeAlerts = false;input bool EnableEmailAlerts = false;input bool EnablePushAlerts = false;
double ZigUp[],       ZigDn[],       SAR[];
void OnInit(){    SetIndexBuffer(0, ZigUp);    SetIndexEmptyValue(0, 0);
    SetIndexBuffer(1, ZigDn);    SetIndexEmptyValue(1, 0);
    SetIndexBuffer(2, SAR);    SetIndexArrow(2, 159);    SetIndexEmptyValue(2, 0);}
int OnCalculate(const int rates_total,                const int prev_calculated,                const datetime &time[],                const double &open[],                const double &high[],                const double &low[],                const double &close[],                const long &tick_volume[],                const long &volume[],                const int &spread[]){    static int j = 0; // Counter for the shift between the extremum detection and it's position.    static bool dir = false; // Direction: false - down, true - up.    static double h = -DBL_MAX, l = DBL_MAX; // Current extremums.
    if (prev_calculated == 0) // Recalculating everything from the beginning.    {        j = 0;        dir = false;        h = -DBL_MAX;        l = DBL_MAX;    }        int counted_bars = IndicatorCounted();    int limit = Bars - counted_bars;    if (limit == Bars) limit -= 2; // Need a previous value too.        if ((History != 0) && (limit > History)) limit = History - 1; // Normalizing with the History input parameter.


http://www.kler.cn/news/358269.html

相关文章:

  • 【力扣打卡系列】滑动窗口与双指针(乘积小于K的子数组)
  • Spring boot 控制台输出大佛
  • QT 对话框
  • [k8s理论知识]3.docker基础(二)隔离技术
  • 百度SEO前10关键词排名波动跟用户行为反馈有很大关系
  • UG NX12.0建模入门笔记:1.2 鼠标的基本操作
  • 【VUE小型网站开发】初始环境搭建
  • RNN,LSTM,GRU的区别和联系? RNN的梯度消失问题?如何解决?
  • Widget结构(一)
  • 基于SpringBoot+Vue的厨艺交流系统的设计与实现(源码+定制开发)厨艺知识与美食交流系统开发、在线厨艺分享与交流平台开发、智能厨艺交流与分享系统开发
  • 【文心智能体 | AI大师工坊】如何使用智能体插件,完成一款购物类智能体的开发,来体验一下我的智能体『科技君Tom』
  • 爬虫实现验证码登录古诗文网【爬虫学习day.02】
  • 【高等数学】无穷级数
  • Win11 安装 PostgreSQL 报错解决方案
  • 【小洛的VLOG】Web 服务器高并发压力测试(Reactor模型测试)
  • 【环境搭建】Windows系统中使用VScode在虚拟机ubuntu系统中进行开发的方法
  • C++ 算法学习——1.9 Kruskal算法
  • 平安养老险深圳分公司:创新养老服务,深入践行金融为民
  • SQLite数据库在Android中的应用及操作方式
  • Python | Leetcode Python题解之第486题预测赢家