I am trying to code the above indicator. I found a copy of it at Gftforex in their Chart
Manual . I need some help in doing this and would greatly appreciate any
assistance.
This is what Gtforex have:
/* Klinger oscillator
indicator */
indicator Klinger;
input signal_period = 13;
draw
kvo("KVO"), kvosig("KVO sig");
vars cm(number), vf(series), i(number),
hlc(series), dm(series), trend(number), newtrend(number);
begin
hlc := high + low + close;
dm := high - low;
cm := 0;
trend := 0;
for i := front(hlc) + 1 to
back(hlc) do begin
newtrend := trend;
if
hlc > hlc[i - 1] then
newtrend := 1;
if hlc < hlc[i - 1] then
newtrend := -1;
if trend = newtrend then
cm := cm +
dm
else
cm := dm[i - 1] + dm;
trend := newtrend;
if cm = 0 then
vf := 0
else
vf := volume * abs(2 * dm / cm - 1) * trend * 100;
end;
kvo := ema(vf, 34) - ema(vf, 55);
kvosig :=
ema(kvo, signal_period);
end.
This is what I am upto. I am fairly
new to Amibroker programming:
/* Klinger Volume Oscillator - KVO*/
signal_period = 13;
hlc = AVG;
dm = H-L;
cm = 0;
trend = 0;
for (i = 0; i <
barcount; i++)
newtrend = trend;
if (hlc[i] > hlc[i -
1])
newtrend = 1;
if
(hlc[i] < hlc[i - 1])
; newtrend = -1;
if (trend = newtrend)
cm = (cm + dm[i]);
cm = (dm[i - 1] + dm[i]);
trend = newtrend;
if (cm =
0);
vf[i] = 0;
vf[i] = volume[i] * abs(2 * dm[i] / cm - 1)
* trend * 100;
kvo = ema(vf, 34) - ema(vf, 55);
kvosig =
ema(kvo, signal_period);
plot (kvo, "KVO", styleline,
colorred);
plot (kvosig, "KVO Sig", colorgreen, styleline);
Tradestation
Code:
Type: Function, Name: VForce
Vars: TSum(0), Trend(0), DM(0), CM(0);
TSum = High + Low + Close; IF TSum > TSum[1] Then
Trend = 1 Else Trend = -1; IF Trend = Trend[1] Then CM =
CM + Range Else CM = Range + Range[1]; IF CM <> 0
Then VForce = Volume * AbsValue(2 * (DM/CM) -1) * Trend * 100;
|
|
Type: Function, Name:
KVO
Inputs: FastX(Numeric), SlowX(Numeric); Vars:
FXAvg(0), SXAvg(0);
FXAvg = XAverage(VForce, FastX); SXAvg = XAverage(VForce,
SlowX); KVO = FXAvg - SXAvg;
|
|
Oncethe two functions
have been created and verified, the indicator can then be created. The
indicator should be scaled to "screen." |
|
Type: Indicator, Name: Klinger
Volume Oscillator
Inputs: FastX(34), SlowX(55), TrigLen(13),
Smooth(1);
Vars: Trigger(0);Trigger =
XAverage(KVO(FastX, SlowX), TrigLen);IF Smooth <= 1 Then
Begin Plot1(KVO(FastX, SlowX), "KVO"); Plot2(Trigger, "KVO
Trigger"); End Else BeginPlot1(Summation(KVO(FastX, SlowX),
Smooth), "KVO"); Plot2(Summation(Trigger, Smooth), "KVO
Trigger"); End;
Plot3(0, "Zero"); IF Plot1 Crosses Above
Plot2 OR Plot1 Crosses Below Plot2 OR Plot2 Crosses Above Plot3 OR
Plot2 Crosses Below Plot3 Then Alert =
True; |