#
A
B
C
D
E
F
G
H
I
J
K
L
M
N
O
P
Q
R
S
T
U
V
W
X
Y
Z
Home
Forex Forum
+ Add Script
Metastock
Expert Advisors
Explorations
Indicators
Trading Systems
Metatrader
MQL Experts
MQL Indicators
MQ4 Experts
MQ4 Indicators
MQ4 Scripts
Tradestation
Functions
Indicators
PaintBars
ShowMe
Trading Systems
Amibroker
Commentaries
Explorations
Functions
Indicators
Trading Systems
Contact us
Newsletter
Group: Metatrader MQL Indicators
Title: CCI + Turbo CCI + bar and time counting
Description:
CCI + Turbo CCI + bar and time counting
/*[[ Name := CCI Author := Luis Damiani Separate Window := Yes First Color := blue First Draw Type := Line First Symbol := 217 Use Second Data :=yes Second Color := red Second Draw Type := Line Second Symbol := 218 ]]*/ Input : CCIperiod(14),TCCIperiod(6),num_bars(550),count_bars(1),compose(0); Variable : shift(0),bar_count(0),CCI(0),TCCI(0),trend("NONO"); Variable : init(true),minu(0),seco(0); Variables : bar(0), prevbars(0), start(0), cs(0), prevcs(0),commodt("nonono"),frame(0); cs= CCIperiod+TCCIperiod+num_bars; //checksum used to see if parameters have been changed if cs=prevcs and (commodt=symbol)and frame=t[4]-t[5] and bars-prevbars<2 then start=Bars-prevbars //params haven't changed only need to calculate new bar else start=-1; commodt=symbol; frame=t[4]-t[5]; prevbars = Bars; prevcs = cs; if (start=1 | start=0) then bar=start else init = true; if init then { SetIndexValue(num_bars-1, 0); SetIndexValue2(num_bars-1, 0); bar=num_bars-2; init=false; }; SetLoopCount(0); For shift = bar Downto 0 Begin CCI=iCCIEx(CCIperiod,PRICE_TYPICAL,shift); TCCI=iCCIEx(TCCIperiod,PRICE_TYPICAL,shift); if count_bars=1 and !shift=0 then { if CCI>0 then if trend="UP" then bar_count+=1 else {bar_count=1;trend="UP";} else if trend="DOWN" then bar_count+=1 else {bar_count=1;trend="DOWN";} ; }; if count_bars=1 then { seco= t[4]-t[5]-mod(CurTime,t[4]-t[5]); minu=seco/60; seco=(minu-floor(minu))*60; minu=floor(minu); Comment("CCI is trending ",trend," during last ",bar_count, " bar(s) Time for next bar: ", minu," min ",seco," sec"); } if compose!= 0 then CCI=CCI+TCCI/compose; SetIndexValue(shift,CCI); SetIndexValue2(shift,TCCI); End;
Author/Source:
Luis Damiani
Forex Directory
|
Forex Trading Systems
|
Privacy
|
Disclaimer
|
Contact