CCI_Woodies指标属于CCI指标的一种优化,在副图绘制另类CCI。( P" F4 O& m/ ?9 _7 u3 x4 z' d$ T
7 e8 v/ X% }$ |. b& B6 m7 _
CCI_Woodies指标图表效果:CCI_Woodies指标
4 L$ Q( u( ^- \) V' I/ ?8 E( V9 |" F, \( O% P
CCI_Woodies指标源码:9 ]. m3 J e6 y, ?
& m, ~- m5 Y; r/ C1 C1 E# a& a
//+------------------------------------------------------------------+
6 B0 }$ u$ g' |& x% r. ]//| CCI_Woodies.mq4 |5 t+ \: @; j4 T" d; U K _
//+------------------------------------------------------------------+
& h3 X4 o" t1 U `7 N/ `#property copyright ""
/ s) {: C0 ]* X1 X#property link "http://www.125808047.com /"
c# V, ]& P0 j" A
9 M; P6 S: K' W& ]9 K$ i4 H5 L#property indicator_separate_window
4 k& V! X, I( F0 b$ ?! W+ h$ b#property indicator_buffers 2" ?$ `1 Z- l$ t) u* r# k7 t
#property indicator_color1 SteelBlue
: E/ I7 P8 d4 N% W#property indicator_color2 Red! E4 u, y$ h _4 r
//---- input parameters9 h- U5 V9 P' l+ L5 z& \- K
extern int CCIPeriod1=14; x1 J+ S- w% v% b2 y7 V
extern int CCIPeriod2=6;7 Y( c4 a3 u, w/ h( K0 N
//---- buffers
- j( V5 ?& X/ p) u( ldouble CCIBuffer1[];" y4 O, C; _6 ~
double CCIBuffer2[];
?) }! x! }9 F4 X( u//+------------------------------------------------------------------+- F# \) I- x& C
//| Custom indicator initialization function |) |% H" [. [3 v1 }5 D" C
//+------------------------------------------------------------------+& I2 o. Q" u) Q* z
int init()
" r& j, {+ i# X( y; t: o H: T {' A+ \! V0 g$ G2 z% m' H( J
//---- indicator line2 z; t! e2 k% D. ^! x
SetIndexStyle(0,DRAW_LINE,STYLE_SOLID,2,SteelBlue);3 [7 }4 \4 |, c* E
SetIndexStyle(1,DRAW_LINE);- a; q) h: ]5 m' m+ D( t
SetIndexBuffer(0,CCIBuffer1);7 ^- ?% u, i8 R5 z
SetIndexBuffer(1,CCIBuffer2);
4 c& d- Z# L% g! d9 b+ M) K//----" s' X1 J5 `4 r) O) J2 e
SetIndexDrawBegin(0,CCIPeriod1);! o+ Z" M; v, H n6 U* |
SetIndexDrawBegin(1,CCIPeriod1);
% T, N4 s% c/ ]" d6 r: _ Comment("www.125808047.com");
: O! _! m; R$ w//----
; w! p; L, W; J/ ?1 R; F! D return(0);
* o/ T `8 {) H5 P) X }
! S+ [' C! \( O0 A% K$ E//+------------------------------------------------------------------+) F3 H5 d- d( E! G* h
//| CCI_Woodies |
& m% v* Q' K- @. r$ P- {' N//+------------------------------------------------------------------+1 M: G% X8 D+ V& W0 D5 i
int start()' c! s0 ~7 z5 E
{
: ?# x3 `0 |) l% P int i,counted_bars=IndicatorCounted();
7 ?: i) u% }5 o6 o! ]6 S//----# s8 t0 k$ c1 x! P
if(Bars<=CCIPeriod1) return(0);
H* ]2 ?, _! Z4 f" H//---- initial zero
, v+ n/ k9 V5 y& @9 Q- f0 { if(counted_bars<1)
, R/ W4 c' M% ]& i9 Q& c for(i=1;i<=CCIPeriod1;i++) CCIBuffer1[Bars-i]=0.0;
6 v* G6 i; e! O//----
: U8 t4 b6 d0 v. W3 o i=Bars-CCIPeriod1-1;
; ~. _( |0 b E, P+ R6 L6 A6 N if(counted_bars>=CCIPeriod1) i=Bars-counted_bars-1;& z+ `0 F0 f# J
while(i>=0)0 i3 _& O6 ~3 O- _
{
& L0 E: }# A6 T8 \ CCIBuffer1[i]=iCCI(NULL,0,CCIPeriod1,PRICE_TYPICAL,i);
2 X- ]# j& k$ l" l% F CCIBuffer2[i]=iCCI(NULL,0,CCIPeriod2,PRICE_TYPICAL,i);
9 g. I' J$ f" T i--;* l+ v- X8 p) c
}
: A1 M/ O9 P4 t" G- d) Q5 K; [ return(0);
* D0 ^- M' K6 T7 I9 d9 |7 S4 P }
$ r; M3 Z+ {+ ]% g//+------------------------------------------------------------------+ |