logo
Welcome Guest! To enable all features please Login or Register.

Notification

Icon
Error

Options
Go to last post Go to first unread
FormulaPrimer  
#1 Posted : Saturday, May 17, 2014 10:00:53 AM(UTC)
FormulaPrimer

Rank: Advanced Member

Groups: Registered, Registered Users, Unverified Users
Joined: 8/12/2005(UTC)
Posts: 73

Anyone have the Klinger Oscillator formula?
I want to modify the periods.

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;
Once the 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 Osc
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 Begin
Plot1(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;

mstt  
#2 Posted : Tuesday, May 20, 2014 10:19:03 PM(UTC)
mstt

Rank: Advanced Member

Groups: Registered, Registered Users, Subscribers
Joined: 7/25/2005(UTC)
Posts: 1,042

Was thanked: 57 time(s) in 54 post(s)
Hi FormulaPrimer

I hope you're not expecting an AB version because this is strictly for MetaStock.

{Klinger Oscillator}
P1:=Input("Klinger Oscillator, Fast Periods",9,39,34);
P2:=Input("Slow Periods",40,99,55);
{Trend}
A:=Typ(); Trend:=If(A>ValueWhen(2,1,A),1,-1);
{Cumulative measurement}
F:=2+BarsSince(Trend<>ValueWhen(2,1,Trend));
DM:=H-L;
CM:=ExtFml("Forum.Sum",DM,F);
CM:=ValueWhen(1,CM>0,CM);
{Volume force}
VF:=V*Abs(2*(DM/CM)-1)*Trend*100;
{Klinger Oscillator}
M1:=Mov(VF,P1,E); M2:=Mov(VF,P2,E); M1-M2;

Roy
FormulaPrimer  
#3 Posted : Wednesday, May 21, 2014 12:17:23 AM(UTC)
FormulaPrimer

Rank: Advanced Member

Groups: Registered, Registered Users, Unverified Users
Joined: 8/12/2005(UTC)
Posts: 73

Thank you Roy.
I stopped using AB awhile back. Just wanted to transfer some formulas over to MS without using the PREV function. Thank you for the elegant code.


Laisze  
#4 Posted : Wednesday, May 21, 2014 11:25:27 AM(UTC)
Laisze

Rank: Advanced Member

Groups: Registered, Registered Users, Subscribers
Joined: 11/18/2007(UTC)
Posts: 96
Location: HK

Hi FP - I'm curious as to why you've stopped using AmiBroker...
FormulaPrimer  
#5 Posted : Wednesday, May 21, 2014 1:46:00 PM(UTC)
FormulaPrimer

Rank: Advanced Member

Groups: Registered, Registered Users, Unverified Users
Joined: 8/12/2005(UTC)
Posts: 73

MS is just more robust platform and for me I'm just a novice programmer so MS easy language is better for me. Like all things it is personal preference.
Users browsing this topic
Guest (Hidden)
Forum Jump  
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.