CCI_Woodies指标属于CCI指标的一种优化,在副图绘制另类CCI。
: N8 Y0 I! }0 s) f6 h
( j4 K) S1 s5 X6 J: B* B: P9 G# o# UCCI_Woodies指标图表效果:CCI_Woodies指标
$ W: s6 `9 M" H/ i G5 w# Z
4 P3 s9 j& W) t7 h" K) r: zCCI_Woodies指标源码:% ?. J1 J$ u" \! V" X. M- Q
, f+ r5 T1 K. @! {" }. f4 W4 _
//+------------------------------------------------------------------+
/ `3 v) J4 f6 x5 V" ]4 K# P//| CCI_Woodies.mq4 |
* `6 Z* w8 d+ d) H//+------------------------------------------------------------------+
( |5 Z% k; H0 b$ T. _/ m7 W#property copyright ""/ s2 e) u$ {. t) e# I" Y
#property link "http://www.125808047.com /"' Z: \3 Q9 I N9 g: a3 d' r
$ d; Z4 O% y! ]# D( L8 q
#property indicator_separate_window
" f+ \, R% c& z4 l$ Q! W#property indicator_buffers 2
& h! Q! u* d' i7 H/ U9 H#property indicator_color1 SteelBlue
; A% U/ W( ]% y6 r' q/ X#property indicator_color2 Red
; \# z7 }6 [6 h//---- input parameters& U+ J: s0 M' c2 M4 [5 [3 l; K$ N
extern int CCIPeriod1=14;
; x9 m9 @3 W. d( O3 {extern int CCIPeriod2=6;
1 r5 h- d, K1 X( G" t: X//---- buffers
* f7 P2 O( [, |7 H8 edouble CCIBuffer1[];
! `6 H1 O: u3 A' w( C+ U1 Jdouble CCIBuffer2[];5 {& @8 p* v# W
//+------------------------------------------------------------------+1 U& l# m0 D3 V- p5 S3 E. {4 [
//| Custom indicator initialization function |6 {: J9 j1 B% M6 |
//+------------------------------------------------------------------+
- T# t# f2 w: p% D7 L2 ?int init()) U! T3 Z# m% @. p0 S# v
{8 y+ S# z7 f; h/ k+ h
//---- indicator line/ b$ S9 X0 @! b: {$ K y
SetIndexStyle(0,DRAW_LINE,STYLE_SOLID,2,SteelBlue);$ U1 K' Z2 y: s: L$ Y+ r3 n
SetIndexStyle(1,DRAW_LINE);
. {. n: f7 { d( e' m. L SetIndexBuffer(0,CCIBuffer1);
5 Y' Z6 H* n! z) K- g+ U SetIndexBuffer(1,CCIBuffer2);! t9 M- \5 j' Z+ h5 C7 I, i
//----& w& f( _0 l. t8 R
SetIndexDrawBegin(0,CCIPeriod1);
3 B; B; \7 P. O SetIndexDrawBegin(1,CCIPeriod1);
6 Y% x; x: c( J3 u# n8 v2 v Comment("www.125808047.com");/ }2 U8 U( ?/ a, B. e# X; ?
//----' k# ^3 ^4 z9 J' B
return(0);- b' {: g! x2 e4 R# j' P# Z
}
$ z7 o9 K$ v& `% o6 T& w j//+------------------------------------------------------------------+
+ x+ J. W( E) A# p4 ?//| CCI_Woodies |7 u- {6 A4 k& p0 @, q
//+------------------------------------------------------------------+
$ o1 i3 {5 m; z* ]3 V6 \; mint start(): B0 k8 p- s: }
{
( y/ `; [2 f% W3 B9 ~ int i,counted_bars=IndicatorCounted();
& J( o6 k3 X/ I" s//----
/ L, J' p. t+ @& L% I$ _ if(Bars<=CCIPeriod1) return(0);! y8 E4 W" r7 `! A y: a. V
//---- initial zero
0 k: {7 Z+ ]0 N& X+ O4 E, O if(counted_bars<1)" L4 e- R! V6 J' P0 B1 `4 s3 z
for(i=1;i<=CCIPeriod1;i++) CCIBuffer1[Bars-i]=0.0;6 N: O6 T7 c6 ?, O
//----
. n$ E' R0 Q2 f _ ]" _+ j9 v i=Bars-CCIPeriod1-1;
7 n0 l/ |7 |- s( D" A- O if(counted_bars>=CCIPeriod1) i=Bars-counted_bars-1;8 l3 g3 _6 I' C4 a
while(i>=0)
: E6 N7 u; X5 l {7 \! f2 @$ q6 f) \) _2 P6 d: l; R, |
CCIBuffer1[i]=iCCI(NULL,0,CCIPeriod1,PRICE_TYPICAL,i);
' T/ R- R4 V+ f+ m; a CCIBuffer2[i]=iCCI(NULL,0,CCIPeriod2,PRICE_TYPICAL,i);# P9 R) W+ _; W, I U: f4 R
i--;/ j( ^! O: n) T; A* T3 N
}/ |% j6 O n9 }& K
return(0);
) f" r% L6 j8 ~+ a/ G% S1 _ }/ }2 o8 k" b* R( i' W
//+------------------------------------------------------------------+ |