CCI_Woodies指标属于CCI指标的一种优化,在副图绘制另类CCI。
1 B _& ~3 z: j0 d- J, }1 m8 q$ G9 ?+ C0 ^5 }
CCI_Woodies指标图表效果:CCI_Woodies指标, v8 D" c5 ]( Q8 C5 A$ M
2 d# f4 T; Z/ j
CCI_Woodies指标源码:3 G4 C9 S8 V: A% `
7 u2 ^% y! ]$ z
//+------------------------------------------------------------------+6 P9 H- K0 N$ v- Y$ r
//| CCI_Woodies.mq4 |7 O6 `3 R# [0 `" \' W; R( x; l: A; [, ?- Z
//+------------------------------------------------------------------+) v2 L; z' b( C i# }* c
#property copyright ""& g I' } [7 D' B6 h2 A6 O I D
#property link "http://www.125808047.com /"& j" `; S, V7 F" C
/ ]4 X+ W R: y) k; k3 z( z+ d7 E#property indicator_separate_window
8 i: m# J; I7 k# W0 L7 C/ t#property indicator_buffers 2
! C: n; R& r/ Y( S. P+ O! j7 O#property indicator_color1 SteelBlue
# T' |9 R& \5 \5 P: j' H4 C#property indicator_color2 Red
1 F3 s- @" L8 m% g, T/ u% \1 Z//---- input parameters
" I2 y! z" q# [- W( D1 m2 l7 Lextern int CCIPeriod1=14;
$ N- u+ @7 D' K) w# R Xextern int CCIPeriod2=6;0 S) g d' k% U8 F( X9 |
//---- buffers
1 U. i5 D3 O- I& Ddouble CCIBuffer1[];* k) n$ {3 B' v! a' o
double CCIBuffer2[];
C0 }- a1 d1 }, `7 P6 ]+ o# W//+------------------------------------------------------------------+! G( R: i5 e( z2 m- [
//| Custom indicator initialization function |. T+ f2 K1 j3 q
//+------------------------------------------------------------------+& {) n' v$ Z' @( N
int init()
4 c* E7 a, N4 K# S+ ^( C( R9 a8 d- I {
1 Q9 V4 D; R7 r* X//---- indicator line
' T4 ~( n, u* M+ ?4 f1 ? SetIndexStyle(0,DRAW_LINE,STYLE_SOLID,2,SteelBlue);& P+ T! w6 K" T
SetIndexStyle(1,DRAW_LINE);1 | H5 \, n" ?9 ~' U
SetIndexBuffer(0,CCIBuffer1);
& h% ]& l- Z' X0 L% c2 i7 R% j7 Y2 w SetIndexBuffer(1,CCIBuffer2);0 z, t; u% \6 n; r/ ?
//----& @# L& O6 L" G+ C
SetIndexDrawBegin(0,CCIPeriod1);
- @% `7 J0 l* {+ F0 m/ w1 | SetIndexDrawBegin(1,CCIPeriod1);
_0 R; F5 M. Z1 U. P! V% \ Comment("www.125808047.com");
7 v' W8 T8 D$ `3 @4 f. I" }9 J" L' Y//----
, x3 p# v k! Y" L return(0);; [& u2 I/ e y0 A
}
5 U: F( Z3 A+ G O5 z R) S//+------------------------------------------------------------------+
: D7 T2 Y! @4 {% d0 d ~//| CCI_Woodies |1 c! J3 v7 b0 x8 n# Z {
//+------------------------------------------------------------------+
, g7 Z" M7 ]4 o9 P8 Bint start()
, X/ q5 s" k2 Q: Z2 k# o; X n {
. Z8 u2 b0 w5 e- s) Q$ C int i,counted_bars=IndicatorCounted();" m9 c& X# M( J U+ z
//----
9 V, L& _4 Z& r4 V8 A& } if(Bars<=CCIPeriod1) return(0);
+ L, E0 X2 q" q. `% A$ W( }4 G2 H//---- initial zero
% J& B/ W6 }; r8 ~4 T/ N0 X& k. L) J if(counted_bars<1)' @1 L( D' _8 ^4 d7 o1 W
for(i=1;i<=CCIPeriod1;i++) CCIBuffer1[Bars-i]=0.0;
3 A& M, f1 ^3 V+ p0 j- s: d//----9 N+ p M$ h7 a. e0 S
i=Bars-CCIPeriod1-1;
8 f u" J, i. l3 ^4 V Q' ` if(counted_bars>=CCIPeriod1) i=Bars-counted_bars-1;' [# Z/ O$ W; Q5 Z* w. a$ b
while(i>=0)8 K1 y3 S$ [+ `# L% t9 K5 Y
{
, s- u7 o/ b# V CCIBuffer1[i]=iCCI(NULL,0,CCIPeriod1,PRICE_TYPICAL,i);
+ L3 x1 N9 n; @- C. N8 r ] CCIBuffer2[i]=iCCI(NULL,0,CCIPeriod2,PRICE_TYPICAL,i);! M. P- V- B& j
i--;
, Q2 E/ K+ k3 m }0 [) |7 T, {) V1 t3 l
return(0);
* G. j& t' `* _8 K9 }, N0 W }
1 M' w% M# b% r" l) ^//+------------------------------------------------------------------+ |