CCI_Woodies指标属于CCI指标的一种优化,在副图绘制另类CCI。
2 c- U; j. H' j1 A0 [
# N' u2 n" D- Y' T2 n% K# j" TCCI_Woodies指标图表效果:CCI_Woodies指标8 b! k0 P( H! S! |% ?0 \
/ K6 y$ C+ J9 U9 C" a
CCI_Woodies指标源码:
& x- c$ F9 V" L7 _- m) r- D7 p
) G: V: \- x5 ?( K; G- Z//+------------------------------------------------------------------+) d) L$ X: f3 y' R- O4 b
//| CCI_Woodies.mq4 |
% ~& j; F$ c8 f* |8 w: }//+------------------------------------------------------------------+6 q0 z, f1 X- Q) M% r
#property copyright ""
' Q/ F9 s2 p! ?4 k* O3 U2 R4 J#property link "http://www.125808047.com /"# n Y, @ G9 @- F2 o) w( J z
3 ]$ u* @( A% c& _: d5 Q- E#property indicator_separate_window* k7 E4 G( ?8 a4 z3 `+ V0 O
#property indicator_buffers 2
* g" D1 M0 c" x: f( P' \#property indicator_color1 SteelBlue6 N4 g+ R1 {0 p/ j9 a4 a0 Y( h
#property indicator_color2 Red1 t3 j" X% L }2 y' v
//---- input parameters# z. w. w. N$ R- ?7 q3 a' h! E( C
extern int CCIPeriod1=14;
# Q) y B( G! S4 U. Wextern int CCIPeriod2=6;) q0 }8 ~/ C2 K0 @9 {" S$ a
//---- buffers
N0 A) U6 V3 ~/ e! H: Mdouble CCIBuffer1[];; ~2 o" F3 D6 b" }$ l" E i
double CCIBuffer2[];
. }6 i+ Z. c$ m5 c//+------------------------------------------------------------------+
4 ~$ A+ s4 T# l6 t$ c//| Custom indicator initialization function |+ O, s5 d" v0 z" @* p
//+------------------------------------------------------------------+) y5 B/ B& F" q4 c
int init(). d4 S: n5 z0 c7 v) x3 W
{3 p( e8 e3 ^# N, T7 {3 M A
//---- indicator line
% D) P& J: y" y8 z SetIndexStyle(0,DRAW_LINE,STYLE_SOLID,2,SteelBlue);
6 v$ z# ^ F3 w5 g4 t1 }% l SetIndexStyle(1,DRAW_LINE);
- ?4 u. N4 r1 s5 P( w. a8 @ SetIndexBuffer(0,CCIBuffer1);- o/ \% H- v" _& J9 H& O& d
SetIndexBuffer(1,CCIBuffer2);+ d. S, k( N: ^0 I# {. [/ }; q
//----0 i1 K5 {5 U- i: d' y( i+ C
SetIndexDrawBegin(0,CCIPeriod1);
* y& n3 B% Z* g% _ SetIndexDrawBegin(1,CCIPeriod1);. @' @" M! d; B- {0 ]2 ^* p f
Comment("www.125808047.com");9 S1 J: I0 t) `
//----
+ e5 B0 B1 F- q# k return(0);
9 ?$ [* v. u5 b3 X: K }* P: V3 ]! U- |! X0 \3 ^# [
//+------------------------------------------------------------------+& T1 K; j% L5 n! j" t/ ]
//| CCI_Woodies |
+ M7 `! w6 L/ V9 V3 [* ~6 I//+------------------------------------------------------------------+; ^4 j/ ], d& K+ J% ]( w3 D
int start()
% m% p# M2 v( V1 G {
+ j7 C# V4 D" M& K) j int i,counted_bars=IndicatorCounted();2 j9 N, P7 L/ A' t4 ~: k1 E
//----
$ L* J0 c6 ^% A1 M if(Bars<=CCIPeriod1) return(0);' i, i H' k2 H+ p1 z9 m3 l
//---- initial zero" k/ c8 c) y/ S% i7 I
if(counted_bars<1)
. D5 q# b" X0 S1 Z for(i=1;i<=CCIPeriod1;i++) CCIBuffer1[Bars-i]=0.0;! n! c0 |& Z% a; a
//----9 @" |9 _* O0 I) O, n J+ ~
i=Bars-CCIPeriod1-1;7 B9 e# W3 p% n p9 U1 u
if(counted_bars>=CCIPeriod1) i=Bars-counted_bars-1;' q" e- V( c, W* M+ ?
while(i>=0)7 g2 Z& M0 @: S. ]( ]3 N
{2 F' I/ _8 _$ j6 g. T
CCIBuffer1[i]=iCCI(NULL,0,CCIPeriod1,PRICE_TYPICAL,i);+ d0 |# {6 H# I4 ]- w+ ~
CCIBuffer2[i]=iCCI(NULL,0,CCIPeriod2,PRICE_TYPICAL,i);
2 G2 O5 A0 u# C$ R8 w i--;, S( f8 ^% h% b5 Y
}
- q6 H7 H# j* z+ |' i return(0);
) P$ L q% K2 H- m6 i) [. U6 H }
1 Z5 H7 ?' P% A8 c% |2 f/ t//+------------------------------------------------------------------+ |