CCI_Woodies指标属于CCI指标的一种优化,在副图绘制另类CCI。- p( C1 @* c+ c* z2 g2 c
" ~+ {+ j. [2 I6 c9 d; ]# _/ L3 c4 XCCI_Woodies指标图表效果:CCI_Woodies指标: p& B/ E: F7 T4 l- g0 V: u
# E/ r; l7 R& M: ^+ r vCCI_Woodies指标源码:# }$ a* M. u3 z- f8 j" N
) w7 r6 W, a, s9 ?. O" e3 j
//+------------------------------------------------------------------+& Y2 P+ _2 o+ I Q5 g0 ^ [4 A
//| CCI_Woodies.mq4 |
$ w3 ^: A. M6 P2 n% y//+------------------------------------------------------------------+
* O% N: ~4 M) Q; K; y5 ~#property copyright ""
0 T, P2 ~* A2 p% G/ T$ h#property link "http://www.125808047.com /"
1 E* j% V: z6 u6 O0 _
; t( F% ?! d @#property indicator_separate_window
1 H6 b. L" Z) Z! O' r6 e+ T6 ]#property indicator_buffers 2 |. q e( F6 t+ f6 p' |3 Y9 O7 T
#property indicator_color1 SteelBlue
9 ^5 x' }' A, d: d! Y: A8 G#property indicator_color2 Red
6 J$ }; m, a% p; v* X8 K//---- input parameters+ k+ T% V" N- J# U( [3 F
extern int CCIPeriod1=14;
6 j' U% V9 D. r! E# d# L0 C6 q! q: rextern int CCIPeriod2=6;
6 W- _* \4 D8 d( l//---- buffers
0 L: S. G; r4 X6 p* ^- ddouble CCIBuffer1[];5 ^' h& i* ^3 \
double CCIBuffer2[]; S3 ]" V. z3 c8 n4 K
//+------------------------------------------------------------------+ F% L2 R. Y3 b6 g9 U: c
//| Custom indicator initialization function |
0 n1 ]7 @; w3 c# b) c//+------------------------------------------------------------------+- o$ H4 }& d# x4 e7 x; v# p* r
int init()
" E- {/ C% B5 Y G {1 s3 o3 C+ b/ t+ v, m7 a
//---- indicator line
5 O- J3 M- ?7 m7 w. J SetIndexStyle(0,DRAW_LINE,STYLE_SOLID,2,SteelBlue);5 ], G# X$ _8 [( j: k" }
SetIndexStyle(1,DRAW_LINE);
5 M0 R& |6 |- ^% ]" H SetIndexBuffer(0,CCIBuffer1);4 K/ v, s* j" W! x3 Z9 j0 t
SetIndexBuffer(1,CCIBuffer2);
1 F0 I* L$ E6 E//----
2 w# g7 U6 j" s0 N4 `, D9 m SetIndexDrawBegin(0,CCIPeriod1); u7 h* z Q6 k* {0 i$ k' ?$ K, @- U
SetIndexDrawBegin(1,CCIPeriod1);, z8 P& P7 B/ E4 O
Comment("www.125808047.com");
/ c$ {0 p1 _6 W1 X//----. |8 b# M: @, j' F, @; \- Y
return(0);7 I. K" l& k4 M+ m$ O% f1 _
}; M/ x& n1 E+ P' I& |
//+------------------------------------------------------------------+
- R/ Z6 m! P _7 v/ A//| CCI_Woodies |
7 w; V# ]! r: ~//+------------------------------------------------------------------+# ^* U; c! H# A+ t; k# B; a
int start()
% z" S8 c( ~; T: p5 R {
) f5 _4 X& A1 y. H int i,counted_bars=IndicatorCounted();2 F. b+ X6 J8 w, ?; Y4 I# J& J+ u
//----" M' T: ]8 v: j& \& p. }' ~
if(Bars<=CCIPeriod1) return(0); w. t% `+ @/ q- P- F, u( p( z
//---- initial zero. D c; n8 k7 V5 V
if(counted_bars<1) ]! i* l* v, b" b% p; s$ F
for(i=1;i<=CCIPeriod1;i++) CCIBuffer1[Bars-i]=0.0;* {4 J) d( Z+ |3 K/ v& M3 D
//----
0 n7 w# V. Q4 H$ C: F i=Bars-CCIPeriod1-1;
. `. a9 g4 h1 m- |& W if(counted_bars>=CCIPeriod1) i=Bars-counted_bars-1;0 L9 P; N* F" F
while(i>=0)0 z0 t% i8 E! o9 F
{
8 Y8 n E. ~. ~2 f. h8 s& K CCIBuffer1[i]=iCCI(NULL,0,CCIPeriod1,PRICE_TYPICAL,i);4 S. B' C6 x4 }. u
CCIBuffer2[i]=iCCI(NULL,0,CCIPeriod2,PRICE_TYPICAL,i);& D' T8 M$ h p5 R4 x
i--;
1 J* o6 S7 U5 C }
. @3 C8 x# o: A1 Y6 f+ d1 h return(0);
5 k9 [( P3 ^5 C0 J' a- A* D! ` }' H% u) d- q2 j* l% l$ n4 ^4 U
//+------------------------------------------------------------------+ |