标签:
杂谈 |
查看原文:http://www.125808047.com/?p=2088
凯尔特纳通道指标 Keltner Channel是根据特定的算法在图表中绘制价格波动通道,图表效果如下:http://www.125808047.com/fgp/wp-content/uploads/2016/03/2016032004-300x109.jpgKeltner
凯尔特通道是由两根围绕线性加权移动平均线波动的环带组成的,其中线性加权均线的参数通道是20。
价格突破带状的上轨和下轨时,通常会产生做多或做空的交易信号。类同于所有的包络线或环带状系统,价格倾向于在凯尔特通道环带内运动,当汇价突破环带时,通常意味着会产生做多或做空的机会。
分析方法的共同点就是找出市场的特点和此时此刻给我们提供的交易机会,在进行交易的时候一定不能忽视了自己所使用的分析方法对市场的指示作用,分析方法使用的越是综合越是周到对分析的结果就越有利。
凯尔特纳通道指标 Keltner Channel源码如下:
//+------------------------------------------------------------------+
//| Keltner Channel.mq4 |
//| Copyright 2016, QQ:125808047 |
//+------------------------------------------------------------------+
#property copyright "www.125808047.com"
#property link "http://www.125808047.com/"
#property indicator_chart_window
#property indicator_buffers 3
#property indicator_color1 Red
#property indicator_color2 Blue
#property indicator_color3 Red
extern int period = 10;
double g_ibuf_80[];
double g_ibuf_84[];
double g_ibuf_88[];
int init() {
SetIndexBuffer(0, g_ibuf_80);
SetIndexStyle(0, DRAW_LINE);
SetIndexShift(0, 0);
SetIndexDrawBegin(0, 0);
SetIndexBuffer(1, g_ibuf_84);
SetIndexStyle(1, DRAW_LINE, STYLE_DASHDOT);
SetIndexShift(1, 0);
SetIndexDrawBegin(1, 0);
SetIndexBuffer(2, g_ibuf_88);
SetIndexStyle(2, DRAW_LINE);
SetIndexShift(2, 0);
SetIndexDrawBegin(2, 0);
SetIndexLabel(0, "KChanUp(" + period + ")");
SetIndexLabel(1, "KChanMid(" + period + ")");
SetIndexLabel(2, "KChanLow(" + period + ")");
return (0);
}
int deinit() {
return (0);
}
int start() {
double ld_4;
int li_12 = IndicatorCounted();
if (li_12 < 0) return (-1);
if (li_12 > 0) li_12--;
int li_0 = Bars - li_12;
for (int li_16 = 0; li_16 < li_0; li_16++) {
g_ibuf_84[li_16] = iMA(NULL, 0, period, 0, MODE_SMA, PRICE_TYPICAL, li_16);
ld_4 = findAvg(period, li_16);
g_ibuf_80[li_16] = g_ibuf_84[li_16] + ld_4;
g_ibuf_88[li_16] = g_ibuf_84[li_16] - ld_4;
}
return (0);
}
double findAvg(int ai_0, int ai_4) {
double ld_ret_8 = 0;
for (int li_16 = ai_4; li_16 < ai_4 + ai_0; li_16++) ld_ret_8 += High[li_16] - Low[li_16];
ld_ret_8 /= ai_0;
return (ld_ret_8);
}
[download id="36"]
后一篇:火车轨道指标

加载中…