PureBytes Links
Trading Reference Links
|
Here is code I googled on Woodie's CCI.
I don't know how to CreateParameterInteger and if Vars were initialized
correctly:
Please help,
Thomas J. Festa, CMT
Technical Analysis Systems Developer
Proprietary Trader - Equities & Russell 2000 Futures
Hold Brothers, LLC
Cell: (908) 581-8880
======================================
Vars:
CCILength(0), {Integer}
TCCILength(0), LRLength(0), {Integer}
i(0), Maxbars(0), Timebar(0), Dncnt(0), Upcnt(0), {Integer}
_CCI(0), CCI_histo(0), TCCI(0), ZL1(0), ZL2(0), {TSeries}
LSMA(0), YBar(0), GBar(0), RBar(0), {TSeries}
TTrendType(0), ttUnknown(0), ttUp(0), ttDown(0);
TTrendType = (ttUnknown, ttUp, ttDown);
begin
CCILength := CreateParameterInteger('CCI
Length' , 1, 999, 14, true);
TCCILength := CreateParameterInteger('TCCI
Length', 1, 999 , 6, true);
LRLength := CreateParameterInteger('LR
Length' , 1, 999, 25, true);
Maxbars :=
CreateParameterInteger('Maxbars' , 1, 999 , 6, true);
with Indicator do
begin
ShortName :='Woodies CCI';
RequiredBars := MaxInt(MaxInt(CCILength,
TCCILength),LRLength);
end;
ZL1 := CreateSeries(BarCount);
ZL2 := CreateSeries(BarCount);
YBar := CreateSeries(BarCount);
GBar := CreateSeries(BarCount);
RBar := CreateSeries(BarCount);
_CCI := CCI(High, Low, Close,
CCILength, CCILength);
CCI_histo := CCI(High, Low, Close,
CCILength, CCILength);
TCCI := CCI(High, Low, Close,
TCCILength, TCCILength);
LSMA :=
MovingRegression(Close,LRLength);
Dncnt := 0;
Upcnt := 0;
Timebar := Maxbars-1;
TrendType := ttUnknown;
for i:=FirstValidIndex(LSMA) to BarCount-1 do begin
if Close[i] > LSMA[i] then ZL1[i] := 0 else ZL1[i] := NAN;
if Close[i] < LSMA[i] then ZL2[i] := 0 else ZL2[i] := NAN;
if (CCI_histo[i] > 0) then begin
Dncnt := 0;
Upcnt := Upcnt+1;
if Upcnt = Timebar then YBar[i] := CCI_histo[i] else YBar[i]:=
NAN;
if Upcnt >= MaxBars then TrendType := ttUp;
end;
if (TrendType = ttUp) and (CCI_histo[i] > 0) then GBar[i]:=
CCI_histo[i] else GBar[i]:= NAN;
if (CCI_histo[i] < 0) then begin
Upcnt := 0;
Dncnt := Dncnt+1;
if Dncnt = Timebar then YBar[i] := CCI_histo[i] else YBar[i]:=
NAN;
if Dncnt >= MaxBars then TrendType := ttDown;
end;
if (TrendType = ttDown) and (CCI_histo[i] < 0) then RBar[i]:=
CCI_histo[i] else RBar[i]:= NAN;
end;
with CreateLine(CCI_histo) do
begin
Name :='CCI Histogram';
Color := RGB(193,193,193);
LineType := ltBar;
end;
with CreateLine(YBar) do
begin
Name :='TimeBar ';
Color := clYellow;
LineType := ltBar;
end;
with CreateLine(GBar) do
begin
Name :='Green Bar';
Color := clGreen;
LineType := ltBar;
end;
with CreateLine(RBar) do
begin
Name :='Red Bar ';
Color := clRed
LineType := ltBar;
end;
with CreateLine(_CCI) do
begin
Name :='CCI ';
Color := RGB(124,124,124);
Width := 2;
end;
with CreateLine(TCCI) do
begin
Name :='Turbo CCI ';
Color := clYellow;
Width := 2;
end;
with CreateLine(ZL1) do
begin
Name :='LSMA Up';
LineType := ltCandlestick;
color := RGB(13,255,13);
Width := 4;
end;
with CreateLine(ZL2) do
begin
Name :='LSMA Dn';
LineType := ltCandlestick;
color := clRed;
Width := 4;
end;
CreateLine(FillSeries(CreateSeries(BarCount), -200)).Color := clWhite;
CreateLine(FillSeries(CreateSeries(BarCount), -100)).Color := clWhite;
CreateLine(FillSeries(CreateSeries(BarCount), 100)).Color := clWhite;
CreateLine(FillSeries(CreateSeries(BarCount), 200)).Color := clWhite;
END.
========================================================================
=
Confidentiality Notice: The information contained in this e-mail and any
attachments may be legally privileged and confidential. If you are not
an intended recipient, you are hereby notified that any dissemination,
distribution, or copying of this e-mail is strictly prohibited. If you
have received this e-mail in error, please notify the sender and
permanently delete the e-mail and any attachments immediately. You
should not retain, copy or use this e-mail or any attachment for any
purpose, nor disclose all or any part of the contents to any other
person.
|