OSC NORMALIZATION

OSC NORMALIZATION

Type: Function, Name: NormAvg

Inputs: OscValue(Numeric), NormPrice(Numeric), NormLength(Numeric);
Variable: AvgValue(0);

AvgValue = Average(NormPrice, NormLength);

If AvgValue <> 0 Then
NormAvg = OscValue / AvgValue
Else
NormAvg = 0;

Type: Function, Name: NormStdDev

Inputs: OscValue(Numeric), NormPrice(Numeric), NormLength(Numeric);
Variable: StdDevVal(0);

StdDevVal = StdDev(NormPrice, NormLength);

If StdDevVal <> 0 Then
NormStdDev = OscValue / StdDevVal
Else
NormStdDev = 0;

Type: Function, Name: NormATR

Inputs: OscValue(Numeric), NormLength(Numeric);
Variable: ATR(0);

ATR = AvgTrueRange(NormLength);

If ATR <> 0 Then
NormATR = OscValue / ATR
Else
NormATR = 0;

Type: Function, Name: NormRange

Inputs: OscValue(Numeric), NormLength(Numeric);
Variable: HiHi(0), LoLo(0), HighLowDiff(0);

HiHi = Highest(OscValue, NormLength);
LoLo = Lowest(OscValue, NormLength);
HighLowDiff = HiHi — LoLo;

If HighLowDiff <> 0 Then
NormRange = ((OscValue — LoLo) / HighLowDiff) * 100
Else
NormRange = 0;

 

Type: Indicator, Name: Osc Normalization

Inputs: NormType(1), OscValue(Momentum(Close, 10)), NormPrice(Close), NormLength(8);
Variable: NormOsc(0);

If NormType = 1 Then Begin
NormOsc = NormAvg(OscValue, NormPrice, NormLength);
Plot1(NormOsc, «Norm Osc»);
Plot2(0, «Balance»);
End;
If NormType = 2 Then Begin
NormOsc = NormStdDev(OscValue, NormPrice, NormLength);
Plot1(NormOsc, «Norm Osc»);
Plot2(0, «Balance»);
End;
If NormType = 3 Then Begin
NormOsc = NormATR(OscValue, NormLength);
Plot1(NormOsc, «Norm Osc»);
Plot2(0, «Balance»);
End;
If NormType = 4 Then Begin
NormOsc = NormRange(OscValue, NormLength);
Plot1(NormOsc, «Norm Osc»);
Plot2(50, «Balance»);
End;

Николай Солабуто
Оцените автора
Николай Солабуто
Добавить комментарий