The Stochastic Oscillator is a centered momentum oscillator. It is a percentile that shows a recent close in relationship to a high and low over a certain period of time. Stochastics were originally designed for stocks in a trading market. Although the parameters can be tweaked to give good results in almost any market, the default values reflect good results with stocks over the past 10 years.

Our built-in stochastic system uses convergence for signals. Positive convergence of a certain strength (called a swing factor), during a certain number of bars, and rising generate a long signal. The opposite exits a long position. Our system does not take short trades at all.

The conditions used to generate a long signal are as follows:

•There is a positive convergence that develops below a %K(Full) of 22.

•The %K(Full) is above 22 (this can be customized) and has started rising above %K(Slow) over the past 4 days.

•The convergence must take place over a certain time.

•The convergence must include highs and lows of a certain profundity to avoid meaningless signals.

The conditions for selling are much the same, except the convergence must be negative and falling below 78 (also customizable). Below are examples of both signals. Note the positive and negative convergences and rising or falling %K(Full).

The following values are used for the Stochastic System. The values shown are the default values.

%K Days

The number of days used to determine %K(Fast).

%D Days

The number of days used to determine %D, a moving average of %K.

%K Full MA Days

The number of days used to smooth %K(Full).

ATR Days

The number of days used to calculate average true range.

ATR Stop

A factor used to determine stops based on ATR.

Stochastic Swing Factor (Days)

The number of days high and low stochastics are considered in determining convergence.

Stochastic Swing Factor

The depth, in stochastic units, that highs and lows must be from each other. If this is too high, only very large fluctuations will produce signals. If this is too small, insignificant variations will generate signals.

Overbought Level

The range, in stochastic units, that is considered overbought.

Oversold Level

The range, in stochastic units, that is considered oversold.

Maximum Units

The maximum units that may be in the long position at any one time.

Crossover Lookback (Days)

The number of days that a crossover between %K(Slow) and %K(Full) is looked for.

Swing Exit Bars (Days)

Akin to Stochastic Swing Factor (Days), except only used to exit a long position.

Entry Script

' We are looking for a specific pattern here

' A convergence at a certain over-sold level, with a cross over

IF stochasticHigh2 > overSoldLevel AND

stochasticHigh1 > overSoldLevel AND

stochasticLow1 < overSoldLevel AND

stochasticLow2 < overSoldLevel AND

stochasticKSlow > stochasticKFull AND

stochasticKSlow[crossoverLookback] < stochasticKFull[crossoverLookback] AND

stochasticLow1 > stochasticLow2 AND

stochasticHigh1 < stochasticHigh2 AND

instrument.bar - stochasticLow2Bar < swingEntryBars THEN

IF instrument.totalUnits < maxUnits THEN

IF useATRStops THEN

broker.EnterLongOnOpen( instrument.close - averageTrueRange * atrStop )

ELSE

broker.EnterLongOnOpen

ENDIF

ENDIF

ENDIF

Exit Script

' We are looking for an exit point -- opposite logic to the entry point

IF stochasticHigh2 > overBoughtLevel AND

stochasticHigh1 > overBoughtLevel AND

stochasticLow1 < overBoughtLevel AND

stochasticLow2 < overBoughtLevel AND

stochasticKSlow < stochasticKFull AND

stochasticKSlow[crossoverLookback] > stochasticKFull[crossoverLookback] AND

stochasticLow1 > stochasticLow2 AND

stochasticHigh1 < stochasticHigh2 AND

instrument.bar - stochasticLow2Bar < swingExitBars THEN

broker.ExitAllUnitsOnOpen

ENDIF

Adjust Stops

' ---------------------------------------------

' Enter stop if "Use ATR Stops" is true

' ---------------------------------------------

IF useATRStops THEN

FOR unitIndex = 1 to instrument.totalUnits

broker.ExitUnitOnStop( unitIndex, instrument.unitExitStop[ unitIndex ] )

NEXT

ENDIF

After Instrument Day Script

IF lookingForHigh = TRUE THEN

IF stochasticKFull > stochasticHigh1 THEN

'Finds new high

stochasticHigh1 = stochasticKFull

stochasticHigh1Bar = instrument.bar

ENDIF

IF stochasticHigh1 - stochasticKFull > swingFactor THEN

'The high found is significant based on swingFactor

lookingForLow = TRUE

lookingforHigh = FALSE

stochasticLow2 = stochasticLow1

stochasticLow2Bar = stochasticLow1Bar

stochasticLow1 = stochasticKFull

stochasticLow1Bar = instrument.bar

ENDIF

ENDIF

IF lookingForLow = TRUE THEN

IF stochasticKFull < stochasticLow1 THEN

stochasticLow1 = stochasticKFull

stochasticLow1Bar = instrument.bar

ENDIF

IF stochasticKFull - stochasticLow1 > swingFactor THEN

lookingForHigh = TRUE

lookingForLow = FALSE

stochasticHigh2 = stochasticHigh1

stochasticHigh2Bar = stochasticHigh1Bar

stochasticHigh1 = stochasticKFull

stochasticHigh1Bar = instrument.bar

ENDIF

ENDIF

Edit Time: 5/9/2017 11:13:16 AM |
Topic ID#: 208 |