 | |  | | 这个composite index 复合指标 简称CMB复合指标 是我在 专业交易人士技术分析 一书中看到的 是和RSI配合使用的指标 这个复合指标背离效果非常的好 对波浪理论的 波浪研判有很大的作用
这张图表里的就是CMB复合指标 我在一本书里找到了这个指标的源码 希望有高手能改写成MT4能用的指标源码 造福大家 谢谢!!
指标源码如下 (照书上扒下来的)
Tradestation Format:
Create two functions in EasyLanguage first. The first is a 9-period momentum study of RSI. This can be written as
RSIDelta = MOMENTUM(RSI(CLOSE,14),9)
Then a smoothed short period RSI is created,
RSIsma = AVERAGE(RSI(CLOSE,3),3)
The indicator can then be created:
INDICATOR: MY INDICATOR
Plot1(RSIDelta+RSIsma,"Plot1");
Plot2(average((plot1),13),"Plot2");
Plot3(average((plot1),33),"Plot3");
MetaStock Format:
A = RSI(14)-Ref(RSI(14),-9)+Mov(RSI(3),3,S);
Plot1 = Mov(A,13,S);
Plot2 = Mov(A,33,S);
A;Plot1;Plot2;
Here's what I've gotten so far:
#property indicator_separate_window
#property indicator_buffers 3
#property indicator_color1 DodgerBlue
#property indicator_color2 Lime
#property indicator_color3 Yellow
//---- buffers
double PlotBuffer1[];
double PlotBuffer2[];
double PlotBuffer3[];
int counted_bars;
//+------------------------------------------------------------------+
//| Custom indicator initialization function |
//+------------------------------------------------------------------+
int init()
{
//---- indicators
SetIndexStyle(0,DRAW_LINE); // Plot1
SetIndexBuffer(0,PlotBuffer1);
SetIndexStyle(1,DRAW_LINE); // Plot2
SetIndexBuffer(1,PlotBuffer2);
SetIndexStyle(2,DRAW_LINE); // Plot3
SetIndexBuffer(2,PlotBuffer3);
SetIndexDrawBegin(0,0);
SetIndexDrawBegin(1,0);
SetIndexDrawBegin(2,0);
IndicatorShortName("MyIndicator");
counted_bars=IndicatorCounted();
//----
return(0);
}
//+------------------------------------------------------------------+
//| Custom indicator deinitialization function |
//+------------------------------------------------------------------+
int deinit()
{
//----
//----
return(0);
}
//+------------------------------------------------------------------+
//| Custom indicator iteration function |
//+------------------------------------------------------------------+
int start()
{
double RSIDelta;
double RSIsma;
int pos = counted_bars;
//----
// Alert("position: " + pos);
// Alert("current bar close: " + Close[pos]);
// Alert("bars: " + Bars);
RSIDelta = iMomentum(NULL,0,9,iRSI(NULL,0,14,PRICE_CLOSE,0),0);
RSIsma = iMA(NULL,0,3,0,MODE_SMMA,iRSI(NULL,0,3,PRICE_CLOSE,0),0);
PlotBuffer1[counted_bars] = RSIDelta+RSIsma;
PlotBuffer2[counted_bars] = iMA(NULL,0,13,0,MODE_SMA,PlotBuffer1,0);
PlotBuffer3[counted_bars] = iMA(NULL,0,33,0,MODE_SMA,PlotBuffer1,0);
pos--;
//----
return(0);
}
//+------------------------------------------------------------------+ |  |  |  |  |
|