31.07.2021 Views

Ultimate Algorithmic Trading System

Using automated systems for trading in stock markets

Using automated systems for trading in stock markets

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

indicator of trend and it will put you into the market in the direction it thinks the

trend is going. It is self-adapting. The following is the pseudocode used in the testing

of these three simplistic methodologies:

‘Trend Following with Different Averaging Methods

‘Simple Price MAV Cross Over

myAVG = SMA(C,80) ‘Comment out the two you do not want to use

‘myAVG = WMA(C,80)

‘myAVG = EMA(C,80)

If close of today > myAVG then

Buy this bar on close

If close of today < myAVG then

‘by placing a single quote at the

start of the line

SellShort this bar on close

62

STOCHASTICS AND AVERAGES AND RSI! OH, MY!

Bollinger Bands

John Bollinger is the originator of this volatility-based channel indicator. It is

considered a channel because the indicator consists of two lines that never intersect.

The channel width is based on a standard deviation value, which is derived from an

N-length moving average. Most Bollinger Bands are one or two standard deviations

above/below the moving average. In a perfectly ‘‘normal’’ world, 95 percent

of values from a sample will stay within two standard deviations of its mean.

Theoretically speaking, would it not make sense that once price rises to the upper

channel/band there exists a higher probability of price reverting to its mean? Or

does it make more sense that a penetration of a band indicates strong momentum

and the beginning of a trend. Like many indicators, Bollinger Bands can be used

as mean reversion as well as trend following. The most successful trend-following

systems use a longer-length Bollinger Band penetration algorithm for trade entry.

Mean-reversion traders use a much shorter length input for this indicator.

If the market demonstrates enough momentum to carry price through two

standard deviations, it seems there is a real good chance it has enough gusto to

continue on in that direction. Well, this is what the trend followers of the 1990s

thought, and they turned out to be right.

Figure 2.14 shows a 60-day two-standard-deviation (SD) Bollinger Band on crude

oil. The Bollinger Bands are the outside lines and the centerline is the moving

average. This is a perfect example of why this trend entry technique gained so much

popularity in the 1990s and in the new millennium. Crude penetrated the lower

band and never looked back until the trend entered into a congestive phase—a $50

move or $50,000 per contract. That’s right, $50,000! And you thought I wasn’t

going to reveal the Holy Grail! Remember, one monster trade doesn’t make a

trading algorithm.

www.rasabourse.com

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!