Code for first indic:-
Inputs: Length(9),Length2(20),Vollength(3);
Variables: CCIU(0),CCIU2(0),Condition1(false),Condition2(fals e),Condition3(false),Val1(0);
Condition1 = CCI(Length) > 0;
Condition2 = CCI(Length) < 0;
Condition3 = CCI(Length) = 0;
Val1 = average(close,4);
If Condition1 = true then CCIU = ((CCI(Length))/40)+val1;
If Condition2 = true then CCIU = val1 - ((CCI(Length))/-40);
If Condition3 = true then CCIU = val1;
CCIU2 = SmoothedAverage(CCIU, Length2);
Plot1(CCIU, "CCI");
Plot2(CCIU2,"CCI2");
Plot3(Close of Data(1),"priceline");
(This is the code for the indic itself. below is the TS CCI function code):
Inputs: Length(NumericSimple);
Variables: Sum(0), Counter(0), MD(0), Avg(0);
If Length > 0 Then Begin
Avg = Average(High + Low + Close, Length);
MD = 0;
For counter = 0 To Length - 1 Begin
MD = MD + AbsValue(High[counter] + Low[counter] + Close[counter] - Avg);
End;
MD = MD / Length;
If MD = 0 Then
CCI = 0
Else
CCI = (High + Low + Close - Avg) / (0.015 * MD);
End
Else
CCI = 0;
The indicator plots normall cci lines, but instead of plotting them around a 0 line, treats the price line as the 0 line.
Inputs: Length(9),Length2(20),Vollength(3);
Variables: CCIU(0),CCIU2(0),Condition1(false),Condition2(fals e),Condition3(false),Val1(0);
Condition1 = CCI(Length) > 0;
Condition2 = CCI(Length) < 0;
Condition3 = CCI(Length) = 0;
Val1 = average(close,4);
If Condition1 = true then CCIU = ((CCI(Length))/40)+val1;
If Condition2 = true then CCIU = val1 - ((CCI(Length))/-40);
If Condition3 = true then CCIU = val1;
CCIU2 = SmoothedAverage(CCIU, Length2);
Plot1(CCIU, "CCI");
Plot2(CCIU2,"CCI2");
Plot3(Close of Data(1),"priceline");
(This is the code for the indic itself. below is the TS CCI function code):
Inputs: Length(NumericSimple);
Variables: Sum(0), Counter(0), MD(0), Avg(0);
If Length > 0 Then Begin
Avg = Average(High + Low + Close, Length);
MD = 0;
For counter = 0 To Length - 1 Begin
MD = MD + AbsValue(High[counter] + Low[counter] + Close[counter] - Avg);
End;
MD = MD / Length;
If MD = 0 Then
CCI = 0
Else
CCI = (High + Low + Close - Avg) / (0.015 * MD);
End
Else
CCI = 0;
The indicator plots normall cci lines, but instead of plotting them around a 0 line, treats the price line as the 0 line.
Comment