Skip to content

Latest commit

 

History

History
171 lines (121 loc) · 6.13 KB

momentum_indicators.md

File metadata and controls

171 lines (121 loc) · 6.13 KB

Momentum Indicators

Momentum indicators measure the speed of movement.

Awesome Oscillator

The AwesomeOscillator function calculates the awesome oscillator based on low and high daily prices for a given stock. It is an indicator used to measure market momentum.

Median Price = ((Low + High) / 2)
AO = 5-Period SMA - 34-Period SMA.
result := indicator.AwesomeOscillator(low, high)

Chaikin Oscillator

The ChaikinOscillator function measures the momentum of the Accumulation/Distribution (A/D) using the Moving Average Convergence Divergence (MACD) formula. It takes the difference between fast and slow periods EMA of the A/D. Cross above the A/D line indicates bullish.

CO = Ema(fastPeriod, AD) - Ema(slowPeriod, AD)
co, ad := indicator.ChaikinOscillator(fastPeriod, slowPeriod, high, low, closing)

Most frequently used fast and short periods are 3 and 10. The DefaultChaikinOscillator function calculates Chaikin Oscillator with those periods.

Ichimoku Cloud

The IchimokuCloud, also known as Ichimoku Kinko Hyo, calculates a versatile indicator that defines support and resistence, identifies tred direction, gauges momentum, and provides trading signals.

Tenkan-sen (Conversion Line) = (9-Period High + 9-Period Low) / 2
Kijun-sen (Base Line) = (26-Period High + 26-Period Low) / 2
Senkou Span A (Leading Span A) = (Conversion Line + Base Line) / 2
Senkou Span B (Leading Span B) = (52-Period High + 52-Period Low) / 2
Chikou Span (Lagging Span) = Closing plotted 26 days in the past.
conversionLine, baseLine, leadingSpanA, leadingSpanB, laggingLine := indicator.IchimokuCloud(high, low, closing)

Percentage Price Oscillator (PPO)

The PercentagePriceOscillator function calculates a momentum oscillator for the price It is used to indicate the ups and downs based on the price. A breakout is confirmed when PPO is positive.

PPO = ((EMA(fastPeriod, prices) - EMA(slowPeriod, prices)) / EMA(longPeriod, prices)) * 100
Signal = EMA(9, PPO)
Histogram = PPO - Signal
ppo, signal, histogram := indicator.PercentagePriceOscillator(
    fastPeriod, 
    slowPeriod, 
    signalPeriod, 
    price
)

The DefaultPercentagePriceOscillator function calculates it with the default periods of 12, 26, 9.

ppo, signal, histogram := indicator.DefaultPercentagePriceOscillator(price)

Percentage Volume Oscillator (PVO)

The PercentageVolumeOscillator function calculates a momentum oscillator for the volume It is used to indicate the ups and downs based on the volume. A breakout is confirmed when PVO is positive.

PVO = ((EMA(fastPeriod, volumes) - EMA(slowPeriod, volumes)) / EMA(longPeriod, volumes)) * 100
Signal = EMA(9, PVO)
Histogram = PVO - Signal
pvo, signal, histogram := indicator.PercentageVolumeOscillator(
    fastPeriod, 
    slowPeriod, 
    signalPeriod, 
    volume
)

The DefaultPercentageVolumeOscillator function calculates it with the default periods of 12, 26, 9.

pvo, signal, histogram := indicator.DefaultPercentageVolumeOscillator(volume)

Relative Strength Index (RSI)

The Rsi function calculates a momentum indicator that measures the magnitude of recent price changes to evaluate overbought and oversold conditions.

RS = Average Gain / Average Loss
RSI = 100 - (100 / (1 + RS))
rs, rsi := indicator.Rsi(closing)

RSI 2

The Rsi2 function calculates a calculates a RSI with 2 period that provides a mean-reversion trading strategy. It is developed by Larry Connors.

rs, rsi := indicator.Rsi2(closing)

RSI Period

The RsiPeriod allows to calculate the RSI indicator with a non-standard period.

rs, rsi := indicator.RsiPeriod(period, closing)

Stochastic Oscillator

The StochasticOscillator function calculates a momentum indicator that shows the location of the closing relative to high-low range over a set number of periods.

K = (Closing - Lowest Low) / (Highest High - Lowest Low) * 100
D = 3-Period SMA of K
k, d := indicator.StochasticOscillator(high, low, closing)

Williams R

The WilliamsR function calculates the Williams R based on low, high, and closing prices. It is a type of momentum indicator that moves between 0 and -100 and measures overbought and oversold levels.

WR = (Highest High - Closing) / (Highest High - Lowest Low)
result := indicator.WilliamsR(low, high, closing)

Disclaimer

The information provided on this project is strictly for informational purposes and is not to be construed as advice or solicitation to buy or sell any security.

License

Copyright (c) 2021 Onur Cinar. All Rights Reserved.

The source code is provided under MIT License.