[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: On the Kase...



PureBytes Links

Trading Reference Links

Hello Ian,
     I've seen a few different versions. But, here's the best I could do
from reading a couple of her papers. If anyone sees anything wrong, please
correct it, as I'm still learning easylanguage.
I'm not sure about the Peakout line. That part of the code came from someone
else. Their code is below my version of the indicator. Wish I knew who it
was so I could give them credit.
Thanks,
Trey

{Function: Kase Serial Dependency Index Down-
	this version adapts for both volatility
	and cycle length}

	vars: mlval(0);

{version1- from the paper, "The Best Momenutm Indicators"}
{mlval=0;
for value99 = 5 to 65 begin
   mlval = maxlist(mlval,high[value99] - low);
end;

KSDId = mlval/(StdDev(log(C[1]/C),9)*SquareRoot(252));}


{version2- from the paper "Putting the odds on your side"}
mlval=0;
for value99 = 5 to 65 begin
	mlval = maxlist(mlval,(High[value99] - low)/SquareRoot(value99));
	end;

KSDId = mlval/AvgTrueRange(40);

{Function: Kase Serial Dependency Index Up-
	this version adapts for both volatility
	and cycle length}

	vars: mlval(0);

{version1- from the paper, "The Best Momentum Indicators"}
{mlval=0;
for value99 = 5 to 65 begin
   mlval = maxlist(mlval,high - low[value99]);
end;

KSDIu = mlval/(StdDev(log(C[1]/C),9)*SquareRoot(252));}


{version2- from the paper "Putting the odds on your side"}
mlval=0;
for value99 = 5 to 65 begin
	mlval = maxlist(mlval,(High - low[value99])/SquareRoot(value99));
	end;

KSDIu = mlval/AvgTrueRange(40);

{Cynthia Kase Peak Oscillator from "The Best Momentum Indicators"
 and "Putting the Odds on your side"}

	Inputs: Len(3); {lookback for smoothing}
	Vars: KPO(0), Av(0), SD(0);


	{Calculate the Kase Peak Oscillator, the difference between the the KSDIu
and KSDId, then smooth it}

	KPO=T3Average((KSDIu-KSDId),Len);

	Plot1(KPO,"KPO");

	{Calculate the Peakout Line}

Av = average(KPO,LEN);
Sd = StdDevS(KPO,LEN);

if (Av + (1.33 * Sd)) > 2.08 then value1 = (Av + (1.33 * Sd))
 else value1 = 2.08;

if (Av - (1.33 * Sd)) < -1.92 then value2 = (Av - (1.33 * Sd))
  else value2 = -1.92;

if KPO[1] >= 0 and KPO > 0 then plot2(value1,"PeakOut");
if KPO[1] <= 0 and KPO < 0 then plot2(value2,"PeakOut");

{{The following code is what I cobbled together after reading her articles
in Futures mag.}
{***************************
       Peak Osc.
***************************}

inputs:LEN(30), Smooth(3), Strength(1);
vars: RWH(0), RWL(0),PEAK(0), MEAN(0), STD(0);

RWH = (H[0] - L[LEN]) / (AvgTrueRange(LEN) * SquareRoot(LEN));
RWL = (H[LEN] - L[0]) / (AvgTrueRange(LEN) * SquareRoot(LEN));
PEAK = {WAverage}T3Average((RWH - RWL),3);
MEAN = average(PEAK,LEN);
STD = StdDevx(PEAK,LEN);

if (MEAN + (1.33 * STD)) > 2.08 then value1 = (MEAN + (1.33 * STD))
 else value1 = 2.08;

if (MEAN - (1.33 * STD)) < -1.92 then value2 = (MEAN - (1.33 * STD))
  else value2 = -1.92;

plot1(PEAK,"PeakOsc");
if PEAK[1] >= 0 and PEAK > 0 then plot2(value1,"+/-97.5%");
if PEAK[1] <= 0 and PEAK < 0 then plot2(value2,"+/-97.5%");}


-----Original Message-----
From: Ian Waugh [mailto:ianwaugh@xxxxxxxxx]
Sent: Friday, March 28, 2003 9:36 AM
To: omega-list@xxxxxxxxxx
Cc: ianwaugh@xxxxxxxxxxxxxxxxxxx
Subject: On the Kase...


I discovered the Kase Indicator on the eSignal site. It looks very
interesting and I'd like to plot it in TS (2000i) but I'm afraid I
find the eSignal language even more impenetrable than EL (which I can
almost understand. Sort of).

Anyway, I was wondering if this had been rendered into EL and if anyone
would be kind enough to send a copy.

The eSignal code is copied below should one of our wizzo programmers
feel like doing a conversion during a spare minute.

Thanks.

Ian



function preMain()
{
    setPriceStudy(true);
    setStudyTitle("Kase Indicator");
    setCursorLabelName("Low", 0);
    setCursorLabelName("High", 1);
    setCursorLabelName("Median", 2);
    setDefaultBarFgColor(Color.blue, 0);
    setDefaultBarFgColor(Color.red, 1);
    setDefaultBarFgColor(Color.green, 2);
}
var KSDIUP = 0.0;
var KSDIDN = 0.0;
function main(N1)
{
    if (N1 == null) N1 = 10;
    var Volume = getValue("Volume", 0, -(N1 + 1));
    var High = getValue("High", 0, -(N1 + 1));
    var Low = getValue("Low", 0, -(N1 + 1));
    var Close = getValue("Close", 0, -(N1 + 1));
    var i = 0;
    var TrueHigh = 0.0;
    var TrueLow = 0.0;
    var TrueRange = 0.0;
    var AvgVol = 0.0;
    var AvgTR = 0.0;
    for (i = 0; i < N1; i++)
    {
        AvgVol += Volume[i];
        if (Close[i + 1] > High[i]) TrueHigh = Close[i + 1];
        else TrueHigh = High[i];
        if (Close[i + 1] < Low[i]) TrueLow = Close[i + 1];
        else TrueLow = Low[i];
        TrueRange = TrueHigh - TrueLow;
        AvgTR += TrueRange;
    }
    AvgVol /= N1;
    AvgTR /= N1;
    if (AvgTR > 0)
    {
        KSDIUP = (High[N1] / Low[0]) / (AvgVol * Math.sqrt(N1));
        KSDIDN = (High[0] / Low[N1]) / (AvgVol * Math.sqrt(N1));
    }
    var Plot1 = null;
    var Plot2 = null;
    var Plot3 = null;
    if (KSDIUP > KSDIDN) Plot1 = Low[0];
    if (KSDIUP < KSDIDN) Plot2 = High[0];
    if (KSDIUP == KSDIDN) Plot3 = (High[0] + Low[0]) / 2;
    return new Array(Plot1, Plot2, Plot3);
}