- Online community for Indian investors & traders!

Some TA Indicator Formulae

Discuss Some TA Indicator Formulae at the Technical Analysis within the - Online community for Indian investors & traders!; Hope this helps 1) Simple Moving Average: The simple moving average sums the prices (you ...

Go Back - Online community for Indian investors & traders! > METHODS & STRATEGIES > Technical Analysis

Technical Analysis Discussion of all the principles involved in technical analysis.

Thread Tools
Old 18th August 2005, 12:49 AM
Join Date: Jul 2005
Posts: 167
Thanks: 0
Thanked 4 Times in 2 Posts
nautilus is on a distinguished road
Default Some TA Indicator Formulae

Hope this helps

1) Simple Moving Average:

The simple moving average sums the prices (you can choose from the closing price, the VWAP time-weighted price or the high/low/close average price) for a specific number of data points and divides by that number. The calculation for a 3-bar simple moving average is:
(price_1) + (price_2) + (price_3) divided by 3

2) Weighted Moving Average:

The weighted moving average gives each data point a weight proportionate to its number in the sequence and divides by the sum of its weights. The calculation for a 3-bar weighted moving average is:
(1 x price_1) + (2 x price_2) + (3 x price_3) divided by 6, where 6 is the sum of the weights (1 + 2 + 3).

3) Exponential Moving Average:

The exponential moving average gives more weight to the latest prices and includes all of the price data in the life of the instrument. It is defined by taking:
(previous period's exponential moving average)/(N+1) and adding (current price)*2/(N+1). For the first period we take the simple average as above.

4) Envelope:

SMA/WMA/EMA Envelopes plot a band composed of two moving averages, one which is shifting upwards, the other shifting downwards, to help define a stock's upper and lower boundaries. The bands of an envelope are calculated as follows:

Upper Band = MA(CLOSE, N)*[1+K/100]
Lower Band = MA(CLOSE, N)*[1-K/100]
MA = Simple (or Weighted or Exponential) Moving Average;
N = averaging period;
K/100 = the value of shifting from the average (measured in basis points).

5) Bollinger Bands:

Bollinger Bands measure volatility by plotting a series of three bands. The middle band represents the moving average (SMA or WMA or EMA). The upper band is a set number of standard deviations higher than the middle band (generally 2), and the lower band is a set number of standard deviations (generally 2) lower than the middle band. You set the distance of standard deviation when you create the study.
Bollinger Bands are calculated like this:

ML = Avg. (N)
TL = ML + (D*StdDev)
BL = ML - (D*StdDev)

ML = middle line
Avg(N) = SMA or WMA or EMA
TL = top line
BL = bottom line
N = is the number of periods used in calculation;
StdDev = the Standard Deviation.
StdDev = SQRT(SUM[(CLOSE — SMA(CLOSE, N))^2, N]/N)

6) Parabolic SAR:

For use in trending markets, parabolic SAR uses a trailing stop and reverse method to help determine good exit and entry points. The Parabolic SAR calculation is:

SARt+1 = SARt+ AF x (EPtrade x SARt)


SARt+1 = next period's SAR
SARt = current SAR
AF = acceleration factor, begins at .02 and increases by .02 to a maximum of 20.
NOTE: You can reset the initial, increments and maximum acceleration factor when you create the study.

EPtrade = the extreme price (HIGH for long positions and LOW for short positions).

7) Relative Strength Indicator:

The RSI indicator is for overbought/oversold conditions. It goes up when the market is strong, and down when the market is weak, and oscillates between 0 -100. The RSI calculation is:
RSI = 100-(100/1+RS)

RS = Average of X bars Up Closes/Average X bars Down Closes (X=number of bars set by user)

8) Moving Average Convergence/Divergence (MACD):

This is a trend-following dynamic indicator that shows the correlation between two moving averages, generally a 26-period and 12-period SMA or WMA or EMA. You can modify the period length when you create the study. To help illustrate opportunity, a 9-period EMA "signal line" is plotted on top of the MACD.
The MACD and signal line are plotted using the following calculations:




MA = Simple or Weighted or Exponential Moving Average;
SIGNAL = the signal line of the indicator.


The ADX/DMI is represented by three lines +DM, -DM and ADX.

The Directional movement
If today's High is higher than yesterday's High then:
+DM = today's High - yesterday's High

If today's Low is lower than yesterday's Low then:
-DM = yesterday's Low - today's Low

If +DM is greater than -DM then:-DM = 0
If +DM is less than -DM then:+DM = 0

The true range
True range is the largest of:
• |today's High - today's Low|
• |today's High - yesterday's Close|
• |yesterday's Close - today's Low|

Moving average of +DM, -DM and True Range
• +DMMA = exponential moving average of +DM
• -DMMA = exponential moving average of -DM
• TRMA = exponential moving average of True Range

The Directional Indicators
• +DI = +DMMA / TRMA
• -DI = -DMMA / TRMA

Directional Index
• DX = |(+DI - (-DI))| / (+DI + (-DI))

The Average Directional Movement Index
• ADX = the exponential moving average of DX
• ADX = SUM[(+DI-(-DI))/(+DI+(-DI)), N]/N
N — the number of periods used in the calculation.

10) Stochastic Oscillator:

The stochastic oscillator provides information about the location of a current close in relation to the period's high and low. It ranges between 0% and 100%. A reading of 0% indicates that the close was the lowest price at which the security traded during the preceding x number of time periods. A reading of 100% indicates that the close was the highest price at which the security traded during the preceding x number of time periods.

NOTE: You can specify the method (SMA, WMA or EMA), observation period, period of slow average and period of fast average when you create the study.

11) On Balance Volume:

The concept behind the OBV indicator is: volume precedes price. OBV is a simple indicator that adds a period's volume when the close is up and subtracts the period's volume when the close is down. A cumulative total of the volume additions and subtractions forms the OBV line.

If today’s close is greater than yesterday’s close then: OBV(i) = OBV(i-1)+VOLUME(i)
If today’s close is less than yesterday’s close then: OBV(i) = OBV(i-1)-VOLUME(i)
If today’s close is equal to yesterday’s close then: OBV(i) = OBV(i-1)

OBV(i) — is the indicator value of the current period.
OBV(i-1) — is the indicator value of the previous period.
VOLUME(i) — is the volume of the current bar.

12) Rate of Change:

ROC is a refined version of Momentum. The readings fluctuate as percentages around the zero line. You set the number of periods when you create the study.

Rate of change =100(V/Vx)
V - the latest closing price.
Vx - the closing price of x bars ago.

13) Momentum:

The Momentum is the difference between the current point (price or something else) and the point N periods ago. Momentum is calculated as a ratio of today’s price to the price several (N) periods ago.

Momentum = CLOSE(i)-CLOSE(i-N)

CLOSE(i) = the closing price of the current bar.
CLOSE(i-N) = the closing bar price N periods ago

14) Average True Range:

The Average True Range indicator is used to determine the volatility of the market. The idea is to replace the high-low interval for the given period, as the high-low does not take into consideration gaps and limit moves.
You set the period when you create the study.

The True Range is the largest of:
• difference between the current maximum and minimum (high - low)
• difference between the previous closing price and the current maximum
• difference between the previous closing price and the current minimum
The Average True Range is a simple moving average of the true range values.

15) Ultimate Oscillator:

The Ultimate Oscillator combines the price action for three different time frames. You set the observations periods 1, 2, and 3 when you create the study.

Time Frames:
true low = min(low or prev close)
buying pressure = close - true low
true range = max(high - low, high - prev close, prev close - low)

Buying pressure sum 1, buying pressure sum 2 and buying pressure sum 3 are calculated by adding up buying pressures for 3 different time frames.

The same applies to the true range sum 1, 2 and 3.

raw ultimate oscillator = 4 * (buying pressure sum 1 / true range sum 1)
+ 2 * (buying_pressure_sum_2 / true_range_sum_2) + (buying_pressure_sum_3 / true_range_sum_3)

ultimate oscillator = raw ultimate oscillator / (4 + 2 + 1) ) * 100

16) Williams Oscillator:

The Williams Percent Range (%R) indicator identifies the overbought/oversold levels. The scale extends from 0 to -100.

%R = (HIGH(i-n)-CLOSE)/(HIGH(i-n)-LOW(i-n))-100

CLOSE = is today’s closing price.
HIGH(i-n) = is the highest high over a number (n) of previous periods.
LOW(i-n) = is the lowest low over a number (n) of previous periods.

Reply With Quote
The Following 3 Users Say Thank You to nautilus For This Useful Post:
BrokerJi (8th February 2010), raj_usb (13th February 2010)
Sponsored Links
Old 18th August 2005, 01:42 AM
Join Date: Mar 2005
Location: Kolkata
Posts: 494
Thanks: 1
Thanked 6 Times in 5 Posts
joy_mitali is on a distinguished road
Default Re: Some TA Indicator Formulae

Hi Nautilus---
Good Collection---Thanks---for ur efforts----for the benefit of all---
Reply With Quote
Old 3rd August 2009, 11:21 PM
Join Date: Oct 2005
Location: Out of this world
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
humblybob is on a distinguished road
Default Re: Some TA Indicator Formulae

Can someone post the Amibroker afl for Volume Weighted MACD?
Reply With Quote
Old 7th August 2009, 12:08 PM
Join Date: Sep 2006
Posts: 43
Thanks: 8
Thanked 5 Times in 3 Posts
maharam1956 is on a distinguished road
Default Re: Some TA Indicator Formulae

Thank u the TA formulae provided

Reply With Quote


Advertise Here

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off

All times are GMT +5.5. The time now is 05:34 PM.

Indemnity, Disclaimer & Disclosure Notice:
• By visiting you automatically indicate that you agree to our Forum Rules, Indemnity, Disclaimer & Disclosure Notice and General Content Disclaimer Notice and indemnify, its associates and related parties of all claims howsoever resulting from the usage of the forum/site.
Disclaimer: Trading or investing in stocks & commodities is a high risk activity. Any action you choose to take in the markets is totally your own responsibility. You are recommended to make appropriate enquiries and seek appropriate advise before sending money, incurring any expenses, acting on recommendations or entering into any commitment in relation to any advertisement published here. does not vouch for any claims made by the advertisers of products and services. will not be held liable for any consequences in the event such claims are not honoured by the advertisers. will not be liable for any, direct or indirect, consequential or incidental damages or loss arising out of the use of any information by anybody mentioned anywhere on this site.
Disclosure: The information in this forum is neither an offer to sell nor solicitation to buy any of the securities mentioned herein. The writers may or may not be trading in the securities mentioned.
• All names or products mentioned are trademarks or registered trademarks of their respective owners.
General Content Disclaimer Notice:
In light of our policy of encouraging candid, open exchanges of views and the rapid distribution of information originating from many sources, cannot determine the accuracy or legality of any information that may be uploaded to the forum. Opinions, advice and all other information expressed by participants in discussions are those of the author. You rely on such information at your own risk. You are urged to seek professional advice for specific, individual situations and not rely solely on advice or opinions given in the discussions. Since is an open and free discussion forum, any comments made by members of this forum in their posts reflect their own views and not of the owner or administrator of Thus the owner/administrator indemnify themselves of all claims whatsoever and will not be liable or responsible for any members comments/views in this forum Although we constantly delete all irrelevant content and/or SPAM, if you should find any objectionable or offensive posts made by members of this forum which you would like to bring to our notice for removal then please Contact Us.

Copyright © 2001 - , All rights reserved.

Recommended Websites - - -

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70