Type: Function, Name: rainbow
Inputs: Price(Numeric), Length(Numeric), Level(Numeric);
Vars: LVLAvg(0);
Array: Avg[10](0);
Avg[1] = Average(Price, Length);
Avg[2] = Average(Avg[1], Length);
Avg[3] = Average(Avg[2], Length);
Avg[4] = Average(Avg[3], Length);
Avg[5] = Average(Avg[4], Length);
Avg[6] = Average(Avg[5], Length);
Avg[7] = Average(Avg[6], Length);
Avg[8] = Average(Avg[7], Length);
Avg[9] = Average(Avg[8], Length);
Avg[10] = Average(Avg[9], Length);
For value1 = 1 To 10 Begin
IF value1 = Level Then
LVLAvg = Avg[value1];
End;
Rainbow = LVLAvg;
Type: Function, Name: RainbowBW
Inputs: Price(Numeric), Length(Numeric), Level(Numeric);
Vars: LVLAvg(0), HiPrice(0), LoPrice(0), HiAvg(0), LoAvg(0);
Array: Avg[10](0);
Avg[1] = Average(Price, Length);
Avg[2] = Average(Avg[1], Length);
Avg[3] = Average(Avg[2], Length);
Avg[4] = Average(Avg[3], Length);
Avg[5] = Average(Avg[4], Length);
Avg[6] = Average(Avg[5], Length);
Avg[7] = Average(Avg[6], Length);
Avg[8] = Average(Avg[7], Length);
Avg[9] = Average(Avg[8], Length);
Avg[10] = Average(Avg[9], Length);
HiPrice = Highest(Price, Level);
LoPrice = Lowest(Price, Level);
HiAvg = Avg[1];
LoAvg = Avg[1];
For value1 = 2 To Level Begin
IF Avg[value1] > HiAvg Then
HiAvg = Avg[value1];
IF Avg[value1] < LoAvg Then
LoAvg = Avg[value1];
End;
IF HiPrice — LoPrice <> 0 Then Begin
IF Price > HiAvg Then
HiAvg = Price;
IF Price < LoAvg Then
LoAvg = Price;
RainbowBW = 100 * ((HiAvg — LoAvg) / (HiPrice — LoPrice));
End;
Type: Function, Name: RainbowOsc
Inputs: Price(Numeric), Length(Numeric), Level(Numeric);
Vars: AvgAvgs(0), HiPrice(0), LoPrice(0), AvgVal(0);
Array: Avg[10](0);
AvgAvgs = 0;
Avg[1] = Average(Price, Length);
Avg[2] = Average(Avg[1], Length);
Avg[3] = Average(Avg[2], Length);
Avg[4] = Average(Avg[3], Length);
Avg[5] = Average(Avg[4], Length);
Avg[6] = Average(Avg[5], Length);
Avg[7] = Average(Avg[6], Length);
Avg[8] = Average(Avg[7], Length);
Avg[9] = Average(Avg[8], Length);
Avg[10] = Average(Avg[9], Length);
HiPrice = Highest(Price, Level);
LoPrice = Lowest(Price, Level);
For value1 = 1 To Level Begin
AvgAvgs = AvgAvgs + Avg[value1];
End;
AvgVal = AvgAvgs / Level;
IF HiPrice — LoPrice <> 0 Then
RainbowOsc = 100 * ((Close — AvgVal) / (HiPrice — LoPrice));
Type: Indicator, Name: Rainbow_a
Inputs: P(Close), Len(2);
IF CurrentBar > Len * 10 Then Begin
Plot1(Rainbow(P, Len, 10), «Avg10»);
Plot2(Rainbow(P, Len, 9), «Avg9»);
End;
«Style:
Plot Name Type Color Weight
Plot1 Avg10 Line Dk Blue medium
Plot2 Avg9 Line Dk Magenta medium
Scaling: Same as Price Data»
Type: Indicator, Name: Rainbow_b
Inputs: P(Close), Len(2);
IF CurrentBar > Len *10 Then Begin
Plot1(Rainbow(P, Len, 8), «Avg8»);
Plot2(Rainbow(P, Len, 7), «Avg7»);
Plot3(Rainbow(P, Len, 6), «Avg6»);
Plot4(Rainbow(P, Len, 5), «Avg5»);
End;
«Style:
Plot Name Type Color Weight
Plot1 Avg8 Line Dk Green medium
Plot2 Avg7 Line Dk Cyan medium
Plot3 Avg6 Line Blue
Plot4 Avg5 Line Cyan
Scaling: Same as Price Data»
Type: Indicator, Name: Rainbow_c
Inputs: P(Close), Len(2);
IF CurrentBar > Len *10 Then Begin
Plot1(Rainbow(P, Len, 4), «Avg4»);
Plot2(Rainbow(P, Len, 3), «Avg3»);
Plot3(Rainbow(P, Len, 2), «Avg2»);
Plot4(Rainbow(P, Len, 1), «Avg1»);
End;
«Style:
Plot Name Type Color Weight
Plot1 Avg4 Line Green medium
Plot2 Avg3 Line Yellow medium
Plot3 Avg2 Line Magenta medium
Plot4 Avg1 Line Red medium»
Type: Indicator, Name: Rainbow Oscillator
Inputs: P(Close), Len(2), Levels(10);
Vars: PosNeg(0);IF CurrentBar > Len * Levels Then Begin
Plot1(RainbowBW(P, Len, Levels), «URB»);
Plot2(-RainbowBW(P, Len, Levels), «LRB»);
PosNeg = RainbowOsc(P, Len, Levels);IF PosNeg > 0 Then
Plot3(PosNeg, «RainbowOsc»)
Else
Plot4(PosNeg, «RainbowOsc»);
End;
«Style:
Plot Name Type Color Weight
Plot1 URB Line Red medium
Plot2 LRB Line Blue medium
Plot3 RainbowOsc Histogram Red medium
Plot4 RainbowOsc Histogram Blue medium»