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

Re: [amibroker] Re: Stochastic Indicator



PureBytes Links

Trading Reference Links

Hello,

From: <dorothy.bradbury@xxxx>
To: <amibroker@xxxxxxxxxxxxxxx>
Sent: Saturday, March 03, 2001 3:50 AM
Subject: [amibroker] Re: Stochastic Indicator


> I too (!) was puzzled about the implementation of Stochastics
> (and indeed MACD etc). I use Stochastics in a mix with MACD,
> along with 5 other indicators, 1 own, in varying weights.
> All my software uses the following format.
> o 3 vars for Stochastics:
> >>> Period/SK-Period/SD-Period + Exponential smoothing (usually)
> o 3 vars for MACD:
> >>> Short/Long/Period + Exponential smoothing (usually)

As I already wrote built-in stochastic %K line is calculated using Wilders
smoothing which is not the same as exponential smoothing. Moreover
built-in stochastic uses closing prices only.

so stochk( 14) is equivalent to:

period =14;
smoothing=2;
graph0 = wilders( 100*( (close-llv(close, period ))/(hhv(close,period )-llv(close,period ))), smoothing );

If you want EMA based Stochastic %K line and LOW/HIGH/CLOSE use:

period = 14;
smoothing = 3;
StochKEmaBased= ema( 100* ( ( close-llv(low, period))/(hhv(high,period)-llv(low,period))), smoothing);

graph0 = StochKEmabased;

As I see this causes a lot of confusion so I guess I will change built-in functions to support
different versions of Stochastics.
------
Stochastic %D line could be calculated as a moving average of %K line: AmiBroker uses for
its built in %D line again Wilders smoothing ( StochD() is equivalen to wilders( stochk(), 3 ); )
but you can use exponential smoothing here:

StochDEmaBased= ema( StochKEmaBased, 3 );
graph1 = StochDEmabased;

--------

As for MACD it is calculated using exponential moving averages so:

macd( 12, 26 );

is equivalent to:

ema( close, 12 ) - ema( close, 26 );

and signal is a 9-period ema of macd( 12, 26 ):

signal( 12, 26, 9 );

is equivalent to:

ema( macd( 12, 26 ), 9 );

--------


> Q: Does anyone have any tips on implementing such a
> 3-variable Stochastic (with EMA, that looks easy).
Ema -smoothed 3 variable stochastic %D line:

period = 14;
Ksmoothing = 3;
Dsmoothing = 3;
StochKEmaBased= ema( 100* ( ( close-llv(low, period))/(hhv(high,period)-llv(low,period))), Ksmoothing);
StochDEmaBased= ema( StochKEmaBased, Dsmoothing );
graph1 = StochDEmabased;


> I'm not versed even in the mathematical derivation of
> Stochastics, just in years of their use & optimising.
> Never have I seen a tool so useful as this, in the old
> days it was manual paper blind testing... T.E.D.I.O.U.S.
> 
> Many thanks.
> (Actually once cracked this program will gain a big boost
> in the flexibility of its technical indicators - and that
> will result in better optimisation to each equity & profit.
> It has everything else to shame many hi-$ subscription pkgs).
> 
> PS: Is there a help file of the language library/syntax?

Thank you for taking a look at AmiBroker. 

As for the language reference please
check on-line help: F1 from AmiBroker (or Help->Help topics menu) 
then AmiBroker Formula language:
- Language reference manual 
- Function reference 
- AFL Tools 


Best regards,
Tomasz Janeczko
===============
AmiBroker - the comprehensive share manager.
http://www.amibroker.com