MetaTrader5
自定义布林带指标 - MetaTrader 5 的新选择
大家好!今天给大家介绍一个我开发的 自定义布林带指标,它为 MetaTrader 5 的标准布林带指标提供了一个新选择。传统的布林带指标只支持简单移动平均方法,而我的这个指标则允许用户选择更多的移动平均方法,包括 指数移动平均、平滑移动平均 和 线性加权移动平均。
要使用这个指标,你需要将它放置在 Windows 系统中类似以下的目录下:
C:\Users\你的用户名\AppData\Roaming\MetaQuotes\Terminal\Indicators\Examples
新增功能:
默认情况下,参数设置为零:
以下是选择线性加权平均的执行示例:
代码示例:
//+------------------------------------------------------------------+
//| 自定义布林带指标 |
//| Lucas Vidal |
//+------------------------------------------------------------------+
#property copyright "Lucas Vidal"
#property link "https://www.mql5.com/en/users/lucasmoura00"
#property description "自定义布林带指标"
#include <MovingAverages.mqh>
//---
#property indicator_chart_window
#property indicator_buffers 4
#property indicator_plots 3
#property indicator_type1 DRAW_LINE
#property indicator_color1 LightSeaGreen
#property indicator_type2 DRAW_LINE
#property indicator_color2 LightSeaGreen
#property indicator_type3 DRAW_LINE
#property indicator_color3 LightSeaGreen
//--- 输入参数
enum MovingAverageMethod {
Simple, // 0
Exponential, // 1
Smoothed, // 2
LinearWeighted // 3
};
input MovingAverageMethod InpMaMethod = Simple; // 移动平均方法
input int InpBandsPeriod=20; // 周期
input int InpBandsShift=0; // 移动
input double InpBandsDeviations=2.0; // 偏差
//+------------------------------------------------------------------+
希望这个自定义布林带指标能够帮助到大家,提升你们的交易体验!如果有任何问题,欢迎在评论区留言交流!
2024.04.28