PureBytes Links
Trading Reference Links
|
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);
}
|