Black Friday great discounts start today Learn more
+1 888 340 6572

Stochastic S&C

Article/Author: "Tales from the Front: Rober Zellner", Thom Hartle, S&C Magazine, Traders Tips, 03/1999

Download: Stochsc.ela

File Includes:
Signal - Stochastic S&C
Function - StochasticCustom
Indicator - Stochastic S&C

Category: Strategy > Stochastic S&C

Description:

Inputs:

Signal Stochastic S&C ELA Code:
INPUT: KPERIODS(7), DPERIODS(12), KSLOW(3), EXITBARS(5);

VARIABLES: KVAL(0), DVAL(0);

KVAL = STOCHASTICCUSTOM(KPERIODS, KSLOW);
DVAL = AVERAGE(KVAL, DPERIODS);
CONDITION1 = DVAL > DVAL[1] AND DVAL[1] > DVAL[2];
CONDITION2 = DVAL < DVAL[1] AND DVAL[1] < DVAL[2];


IF CONDITION1 AND SWINGLOW(1, KVAL, 1, 2) <> -1 THEN
BUY THIS BAR ON CLOSE;
IF CONDITION2 AND SWINGHIGH(1, KVAL, 1, 2) <> -1 THEN
SELL THIS BAR ON CLOSE;

IF MARKETPOSITION = 1 AND BARSSINCEENTRY = EXITBARS THEN
EXITLONG THIS BAR ON CLOSE;
IF MARKETPOSITION = -1 AND BARSSINCEENTRY = EXITBARS THEN
EXITSHORT THIS BAR ON CLOSE;