This method calculates the Stochastic.
var STOCH(fastKPeriod, slowKPeriod, slowKMAType, slowDPeriod, slowDMAType, highPricesArray, lowPricesArray, closePricesArray, calculatedSlowKArray, calculatedSlowDArray);
fastKPeriod
Fast K period integer value.
slowKPeriod
Slow K period integer value.
slowKMAType
One of the Moving Average constants for Slow K.
slowDPeriod
Slow D period integer value.
slowDMAType
One of the Moving Average constants for Slow D.
highPricesArray
Array object filled with high prices.
lowPricesArray
Array object filled with low prices.
closePricesArray
Array object filled with close prices.
calculatedSlowKArray
Empty Array object that will be filled with slow K calculated data.
calculatedSlowDArray
Empty Array object that will be filled with slow D calculated data.
Returns true if calculation was completed successfully, or false otherwise.
The following example demonstrates how to use STOCH method.
function calculate(beginIndex, endIndex)
{
var fastKPeriod = 15;
var slowKPeriod = 5;
var slowKMAType = TechnicalAnalysis.MA_EMA;
var slowDPeriod = 2;
var slowDMAType = TechnicalAnalysis.MA_SMA;
var highPricesArray = new Array();
var lowPricesArray = new Array();
var closePricesArray = new Array();
//populate arrays..
..
..
..
var calculatedSlowKArray = new Array();
var calculatedSlowDArray = new Array();
var rc = TechnicalAnalysis.STOCH(fastKPeriod, slowKPeriod, slowKMAType, slowDPeriod, slowDMAType,
highPricesArray, lowPricesArray, closePricesArray, calculatedSlowKArray, calculatedSlowDArray);
}
Copyright © 2006-2009 ActiveTick LLC