CCI_Woodies指标属于CCI指标的一种优化,在副图绘制另类CCI。$ x+ y! Y7 V G
# k4 @2 ^1 C* }( B
CCI_Woodies指标图表效果:CCI_Woodies指标: J$ G5 D3 x, o* u1 A
* l% p( V+ ^5 |# J
CCI_Woodies指标源码:
: o8 e* R+ C5 m. ?
, a3 z* Q: k0 [% d" C: A2 Y% C//+------------------------------------------------------------------+
3 }. \, k2 p* J! l4 l% B& f//| CCI_Woodies.mq4 |6 [6 E* B* \- C4 f
//+------------------------------------------------------------------+) \- I( I6 b9 `1 @5 I" \
#property copyright ""
6 @# ]2 g6 M: ~9 [' f#property link "http://www.125808047.com /"/ W3 ~ K4 L* o$ }% e/ A
+ ~4 {' l7 |5 r8 e: }3 k6 h9 K#property indicator_separate_window
3 u. P% o* M5 ~3 _8 x2 q t+ V#property indicator_buffers 2
: w- N! k1 q# O% t4 ?: c. a#property indicator_color1 SteelBlue8 k9 ~0 E% e7 X* z8 `6 y8 b$ k( T
#property indicator_color2 Red
- k7 a& t8 d9 a# q& _- @ c7 i( I9 e& Y//---- input parameters6 Y0 S3 A' S7 s
extern int CCIPeriod1=14;! q2 Y- k/ S ~) S
extern int CCIPeriod2=6;$ a% P2 h, |5 X( f/ \: }8 ~
//---- buffers ^: t- y- \! h5 g& G
double CCIBuffer1[];; |8 q, D1 ^9 r
double CCIBuffer2[];
" Y7 f5 G& [9 L: A2 S//+------------------------------------------------------------------+6 M; F* @2 d! D" u- L0 W
//| Custom indicator initialization function |* S: r7 k& B0 c
//+------------------------------------------------------------------+
# `4 V0 x4 U' ~2 d7 h) z( y: o! aint init() b. K7 O# a8 A$ \- c3 Z6 m
{
, I) F1 Q9 g' A+ s, |- D//---- indicator line' i# k" i, \' S$ z
SetIndexStyle(0,DRAW_LINE,STYLE_SOLID,2,SteelBlue);9 m. d& |$ S* n4 p. _3 t4 s( i9 C' s
SetIndexStyle(1,DRAW_LINE);* N! J( w' D3 \; x$ I% W
SetIndexBuffer(0,CCIBuffer1);
7 |2 O- ~3 _8 ]! r SetIndexBuffer(1,CCIBuffer2);
6 o F4 H) D& N* A$ |8 n- X//----
$ ], _& L4 z. F& n$ |$ I. M. h, K SetIndexDrawBegin(0,CCIPeriod1);
, |4 V- G$ ^ u6 \: ? SetIndexDrawBegin(1,CCIPeriod1);
/ ]- E$ Q3 }) U1 G3 C! @' q Comment("www.125808047.com");
( Q2 D3 b6 a( O2 l$ w//----( y3 Z- K7 E' V0 {: N6 q
return(0);% Z+ W! N7 J! ?! o9 T4 s: u
}
; M# A0 ?' ^$ B3 w! \//+------------------------------------------------------------------+% E* }: Q( R( F3 y2 S$ z* G
//| CCI_Woodies |
/ |7 H2 t+ q9 R' |2 Y, J//+------------------------------------------------------------------+
+ d' t7 I( R4 a. Z8 _int start()
$ J, S; y* O, Z3 `; G! T {
# ]/ t9 {8 o, G- a m, u" L# F* I int i,counted_bars=IndicatorCounted();8 i+ M X* }' x8 d6 E, y$ {2 W$ ]6 k
//----$ n+ r$ }2 `4 P! j. K7 u
if(Bars<=CCIPeriod1) return(0);: Z) y7 L4 J" A3 y1 g2 l1 ]
//---- initial zero
9 D5 U; s. j: ^( U/ l if(counted_bars<1)! c) m1 E' ]! s2 I1 Q5 m
for(i=1;i<=CCIPeriod1;i++) CCIBuffer1[Bars-i]=0.0;* B& l+ Z7 B( C0 n( D+ F0 h
//----% W' Y8 H$ ^" ]9 U! j9 x. v
i=Bars-CCIPeriod1-1;- b. Q5 L, @6 e$ K- `. h2 \
if(counted_bars>=CCIPeriod1) i=Bars-counted_bars-1;( ]# h- K# s. K7 g& M! N0 c( M% m
while(i>=0)
& j8 j0 G/ W+ [' ] {- l1 \+ ~8 ^& H) X' c7 }; `0 P/ O
CCIBuffer1[i]=iCCI(NULL,0,CCIPeriod1,PRICE_TYPICAL,i);
+ O6 w9 k' x5 z0 d$ M CCIBuffer2[i]=iCCI(NULL,0,CCIPeriod2,PRICE_TYPICAL,i);
7 O/ R+ z5 g9 e8 y/ @1 R3 J i--;3 O" h8 L$ Q$ r M# Y
}
8 _8 m) u9 J$ N( [ return(0);4 n6 _5 a! v3 s1 G
}
. v% k& Q$ ~, l, C//+------------------------------------------------------------------+ |