KST Indicator 0

Posted on 14, March 2014

in Category SID


Description for KST SID 412

Martin Pring’s KST Indicator

KST Indicator/sid The logic for this technical analysis indicator:

#
# Martin Pring's KST Indicator
#

my ($ROCPeriod1, $ROCPeriod2, $ROCPeriod3, $ROCPeriod4, 
	$AvgLength1, $AvgLength2, $AvgLength3, $AvgLength4, 
	$SignalLength) = @_;

# Validate Periods
ValidatePeriods($ROCPeriod1, $ROCPeriod2, $ROCPeriod3, $ROCPeriod4);
ValidatePeriods($AvgLength1, $AvgLength2, $AvgLength3, $AvgLength4);
ValidatePeriods($SignalLength);
	
# Get the Rate of Change for all periods
my $ROC1 = ROC(Close, $ROCPeriod1);
my $ROC2 = ROC(Close, $ROCPeriod2);
my $ROC3 = ROC(Close, $ROCPeriod3);
my $ROC4 = ROC(Close, $ROCPeriod4);

# Average out the ROCs
my $ROCAvg1 = SMA($ROC1, $AvgLength1);
my $ROCAvg2 = SMA($ROC2, $AvgLength2);
my $ROCAvg3 = SMA($ROC3, $AvgLength3);
my $ROCAvg4 = SMA($ROC4, $AvgLength4);

# Calculate the KST and Signal
my $KST = ($ROCAvg1 * 1) + ($ROCAvg2 * 2) + ($ROCAvg3 * 3) + ($ROCAvg4 * 4); 
my $Signal = SMA($KST, $SignalLength);

SetColumnName($KST, 'KST');
SetColumnName($Signal, 'Signal');

return ($KST, $Signal);

0 Comments

Leave a Message