CCI_Woodies指标属于CCI指标的一种优化,在副图绘制另类CCI。
2 c8 P. \, }8 G2 n3 ^* O1 l% C
) g0 b Q7 i* v$ q1 c1 M( cCCI_Woodies指标图表效果:CCI_Woodies指标& Q) u4 i( [0 @9 Y
; ?/ C/ K m6 P% J* l6 qCCI_Woodies指标源码:
# U$ D! i0 L$ X4 Z, H7 |1 [0 H3 h# E3 l
//+------------------------------------------------------------------+7 f& Z! ^& {. F" \
//| CCI_Woodies.mq4 |
6 j8 T$ \* ~* }8 w q- T5 f( d//+------------------------------------------------------------------+
: v4 ~' x0 s% J( E' L9 r _3 D#property copyright "") f7 F# `1 T2 t2 {6 v2 i
#property link "http://www.125808047.com /"
( e+ c; {* ?4 y) L M& V5 g( e- U
0 |) v1 c' z3 M7 u/ s4 M5 N1 K#property indicator_separate_window
- E9 K8 E5 I: u#property indicator_buffers 2
* W/ k( R. C" F: E1 E* ~( N+ G8 s#property indicator_color1 SteelBlue+ n1 B. r# T3 j
#property indicator_color2 Red$ R+ F: ]& N( u2 E5 l2 U
//---- input parameters
9 Z/ o- Y* }+ M) t/ T# Yextern int CCIPeriod1=14;
9 h2 I+ Q$ {2 F/ \8 @extern int CCIPeriod2=6;
' K5 L8 d4 ^$ H4 a. z1 I0 G: a//---- buffers3 ^$ m& M6 n8 ^* c" |6 z
double CCIBuffer1[];
3 h' @7 U/ O$ Wdouble CCIBuffer2[];- |4 f* {2 L- m b* m
//+------------------------------------------------------------------+
0 G8 D1 a, a8 f1 [/ H: {5 M- M8 h//| Custom indicator initialization function |
, D4 S( @$ X' j//+------------------------------------------------------------------+
" L3 e2 M% o0 M5 [int init()8 @9 N s( T+ B3 ]: A' U5 v) F
{
! m n% a# T: Z: p4 E) M//---- indicator line$ U; L- s2 b2 X0 Z) A) w
SetIndexStyle(0,DRAW_LINE,STYLE_SOLID,2,SteelBlue);
9 h& V& |2 l _- Y- C SetIndexStyle(1,DRAW_LINE);
& s0 O& q4 q$ X$ G4 j+ f SetIndexBuffer(0,CCIBuffer1);
! A9 _2 q! a$ @: B' `6 R+ h SetIndexBuffer(1,CCIBuffer2);6 |$ m8 f$ C, n. Q2 R
//----
: A7 J0 k% u) b1 H+ v. ? SetIndexDrawBegin(0,CCIPeriod1);9 P' L; U) K3 ^& \% J( k
SetIndexDrawBegin(1,CCIPeriod1);
0 z6 a0 k1 O& Y, U* V1 f Comment("www.125808047.com");9 v: E; j0 ]( d8 T3 F
//----7 D( G. ?: t' O. F& q
return(0);) J/ L* ]" Y' F
}
/ @$ S- G I: m3 D& O//+------------------------------------------------------------------+
) w7 ~( ^4 k. h//| CCI_Woodies |5 `- B Y2 s( h+ R3 S
//+------------------------------------------------------------------+
1 X3 `/ T. Q& \8 q: o4 |" D; E( k- Uint start(): H* U. r7 s4 J+ \' t( S2 ?/ K8 c
{
% u' R! e' Z' _: H9 f I- Z int i,counted_bars=IndicatorCounted();8 P j3 S* s1 g
//----& j$ x) M0 K$ o& R) c6 ]
if(Bars<=CCIPeriod1) return(0);( v2 S# M- _- U# l0 [) l U
//---- initial zero2 p# s5 K- b$ [) E; Q& K
if(counted_bars<1)
6 M+ W- V1 I- c& G0 x for(i=1;i<=CCIPeriod1;i++) CCIBuffer1[Bars-i]=0.0;
9 q& [5 } {& g: B& h//----3 @0 l5 Y9 E P' _
i=Bars-CCIPeriod1-1; y& T. q9 A* D$ t
if(counted_bars>=CCIPeriod1) i=Bars-counted_bars-1;
7 A5 t) C& I2 X. J1 E while(i>=0)
; s! ^) {5 w# q) P$ Z {) l7 a- I) b6 K( T/ `7 g
CCIBuffer1[i]=iCCI(NULL,0,CCIPeriod1,PRICE_TYPICAL,i);5 M& `" A# i/ _# a3 O9 h
CCIBuffer2[i]=iCCI(NULL,0,CCIPeriod2,PRICE_TYPICAL,i);% @( B C0 }* A$ C: F
i--;9 Y6 {: V& O& ~( f( o' E3 o7 `
}
2 @. Z( h. ?& ^ return(0);: t' b# i' [8 Y) g& i& L8 N5 x6 F
}, {) N3 O# A& B( ^( R
//+------------------------------------------------------------------+ |