CCI_Woodies指标属于CCI指标的一种优化,在副图绘制另类CCI。6 S2 J- w% h0 | m
6 U& ^3 O1 Q T$ C
CCI_Woodies指标图表效果:CCI_Woodies指标
/ i) |7 ]$ [ e3 k2 _* t
2 [/ k Y7 p+ q4 N$ ZCCI_Woodies指标源码:
5 d' \4 L! G2 }# c- q7 S+ r9 ?9 i5 g9 F% o0 r, X) K. E
//+------------------------------------------------------------------+
# ?' t' B8 }% m5 }9 y3 P$ g0 [//| CCI_Woodies.mq4 |
9 }9 y9 J% w9 h+ v1 \//+------------------------------------------------------------------+
p% L# O1 }$ g# U0 O#property copyright ""
5 F" o, V' f7 f#property link "http://www.125808047.com /"& L/ F7 h% ^& K6 i" r( A/ H/ h
& k, ]4 o" Q9 `) X- N
#property indicator_separate_window
! m) j! l& p+ w' F* n#property indicator_buffers 25 \& ], {1 e- P* t% s( O; T" V' N j
#property indicator_color1 SteelBlue8 _3 l6 x: s3 l# N/ ~
#property indicator_color2 Red( B0 w, e' `+ a: |, R
//---- input parameters) Q: |9 {7 d$ g. E/ d2 F
extern int CCIPeriod1=14;- F- A& j @# y9 Y9 F& ~
extern int CCIPeriod2=6;
+ R% \- {; `3 B s, l. G* i$ H$ _//---- buffers% ~2 T1 h0 G. j% x1 u3 w
double CCIBuffer1[];, N! p1 z) x& E. d; N
double CCIBuffer2[];
6 }6 D+ e% ?7 ~& `1 Q//+------------------------------------------------------------------+
8 R& h7 Y' u/ x$ @; K* X3 Q//| Custom indicator initialization function |
9 R' s( m( {9 y//+------------------------------------------------------------------+) q2 y# R8 c `+ ]# E' s e
int init()$ U+ l9 K0 i s: w! T1 y
{* M' l3 T" Y. `0 r
//---- indicator line
+ ~. q5 s3 g& @- W% ]1 ` SetIndexStyle(0,DRAW_LINE,STYLE_SOLID,2,SteelBlue);
' Q$ A8 L, \( ?! e SetIndexStyle(1,DRAW_LINE);$ q& r8 o6 a0 n1 [5 T) w* Y* p
SetIndexBuffer(0,CCIBuffer1);
5 R! _% s9 r3 L# x( t SetIndexBuffer(1,CCIBuffer2);/ }4 o2 s# ~ X; s- q/ Y
//----% a" G( |. W1 t' P7 r! e# e! V+ |
SetIndexDrawBegin(0,CCIPeriod1);
& c+ E" Y# N5 K, y, e SetIndexDrawBegin(1,CCIPeriod1);
4 f) |& P, G+ Z) b& O2 s2 K Comment("www.125808047.com");8 n6 s0 I- {6 }+ T" Y5 O
//----- b2 s$ g2 w* w1 t. k! ~ f
return(0);; h) C7 Y% q N3 `1 s; K' I0 \
}
$ s3 ^+ W/ ]$ F: B//+------------------------------------------------------------------+1 S; `& i9 B9 m. d. \; A& ?8 ~
//| CCI_Woodies |
R6 d& K1 P% Z( R# U//+------------------------------------------------------------------+, k. M$ K2 t- V
int start()
2 r- @, t: v' X9 p( H. D: I& w {
B( E- t# @9 U0 ^1 v int i,counted_bars=IndicatorCounted();
C8 C' m ]2 t% e9 K//----& H( ]# T; }. c+ _+ `/ j1 s
if(Bars<=CCIPeriod1) return(0);) [, j' Z( A. g. z. _& A ^ s
//---- initial zero
7 i0 N$ H+ _& @$ k* E/ N if(counted_bars<1) s2 S4 O5 ^6 T' h& ?, k- o
for(i=1;i<=CCIPeriod1;i++) CCIBuffer1[Bars-i]=0.0;
. A: ]. t# O" M$ p0 Z4 V//----
* N7 @' j2 F/ W% V i=Bars-CCIPeriod1-1;
7 G" `1 O9 K* H6 _ if(counted_bars>=CCIPeriod1) i=Bars-counted_bars-1; \1 d* g2 N' N u1 }# g8 q
while(i>=0)
. Y0 w, ]2 A+ u! w ^. ~- f2 p( Q3 r0 p {
! A. R9 \4 h7 d# r CCIBuffer1[i]=iCCI(NULL,0,CCIPeriod1,PRICE_TYPICAL,i);0 L; r: x" `) E) f/ p4 ~/ J
CCIBuffer2[i]=iCCI(NULL,0,CCIPeriod2,PRICE_TYPICAL,i);
9 d b2 Y4 x1 i i--;
5 v y, F# O, { }1 p, H- a. \9 c2 {% g
return(0);" R) Q; J5 i4 ~3 N# u1 o J+ p
}
# c/ z2 L! d' Y//+------------------------------------------------------------------+ |