Saturday, March 28, 2009

Nifty Future Intraday trading setup (Best setup that I have used)

Nifty Futures Intra Day Trading System with RSI Stochastics EMA and PSAR

Quick instructions on how to take trades

Buy – When RSI moves above 20 from below & when the Blue stochastics line rises above the red from below 20.

Sell – When RSI moves below 80 from above & when the Blue stochastics line falls below the red from above 80.

Keep stop of 15-20 points. Keep target of 30-40 points (twice that of stop). This kind of trading setup is more suited to range bound markets rather than trending markets. In strongly trending markets, things can remain oversold or overbought for long periods without correcting. So, if you do two trades in the same direction & both of them get stopped out, stop trading for the day.

Click here for Detailed instructions on how to use this chart and the various indicators
For auto refresh of this page, use Firefox and use ReloadEvery Addon

Tuesday, March 17, 2009

How to use nifty futures intraday trading system

How to use nifty intraday chart -

How to use the nifty intraday trading technical setup

Anyone can use the above technical setup to trade Nifty Futures intraday with a reasonable degree of success. Before one sets out to trade nifty futures, let us first understand the above chart, how it functions, what is signifies, when to enter/exit a trade etc.

Components of the above chart

a. The First box is the intraday chart of Nifty index (spot). The chart is depicted using a form of charting technique called candlestick charting.

For more on candlestick charting you visit this page - candlesticks

Simply put, each candle like structure represents the movement in a 5 minute period. A White candle means the closing was higher than the opening(market moved up in that 5 minutes), while a blue candle signifies the opposite.

There is also the red line which is the 20 minute Exponential Moving Average. It acts as support & resistance for intraday moves. More on moving averages here - Moving Averages

b. The second box containing a red & a blue line is the slow stochastics box. Slow stochastics is a technical indicator which is primarily used to indicate overbought/oversold levels. In short, when the lines are above 80 the market is overbought, & when it is below 20 is oversold. One can use overbought/oversold levels to enter into positions & square off existing ones. More on Slow Stochastics here - Slow Stochastics

c. The third box with the single blue line is the RSI line. RSI or Relative Strength Index, again is a technical indicator which depicts overbought /oversold levels above 80/below 20 respectively - very similar to slow stochastics. More on RSI here - RSI

Rules for entering a trade (Trade setup)

In one line - When Stochastics/RSI reach overbought/oversold levels & subsequently emerge below/above the respective 80/20 levels we take a short/long trade.

A more detailed explanation

1. During any given day, market keeps moving up & down. The slow stochastics & RSI indicators also move accordingly. After a period of upmove or downmove, mkt will tend to face resistance/ take support at particular levels. More often than not, these are significant levels used by traders for intraday trading. These could be pivot points - Pivot points, or other levels.

How do we know that this is the case ?

- The speed of the rise/fall will decline & prices will move in a range for a few candles. Look for bounces off particular price levels.

Look at the Stochastics & RSI boxes & wait for them to reach overbought/oversold levels. Now we are ready to take a trade.

When Stochastics & RSI emerge from such overbought/oversold levels that is the time when we take a trade. So say for example, after a sustained upmove, both Stochastics & RSI reach above 80 (overbought), & subsequently start coming down below 80, we take a short(sell) trade. Similarly on the opposite side wait for them to go below 20 & emerge out of it. Thats a buy trade.

This is a basic setup. We also look for confirmations to strengthen our trade.

2. Watch out for price reactions from 20min EMA. The 20min EMA often acts as support/resistance during intraday moves. This can be considered as the initial level for booking partial profits - but moves to the EMA from when the trade got triggered hardly provide sufficient move to make a decent profit. So wait & see how the price reacts. If it is able to breach the 20min EMA convincingly, then we are setup for a much better move, else just book whatever profits you have & wait for some time & see how price movement develops.

3. Divergence - This is a very reliable indicator & really improves the chances of a successful trade. Divergence occurs when price forms a new high or a new low, but RSI is at a lower/higher level than where it was at the previous high/low. For an example click here - Divergence

So when we have a divergence, combined alongwith overbought/oversold levels we can take a trade. The advantage with divergence is that we need not wait for Stochastics/RSI indicators to emerge from oversold levels before we take the trade. As such, this provides early signals, thus increasing the profitability of a trade.

Divergence happens very frequently.

4. A phenomenon i have seen occur often is that after coming down prices move up a bit, seems like breakout from oversold zone is happening, but prices after 4-5 candles form a lower low slightly lower than the previous one, typically accompanied by divergence on the RSI. This is the right place to take a trade. Risk is low.

5. If a large up/down candle occurs after a sustained period of uptrend/downtrend & is followed by another large candle of opposite colour, it is a pretty good confirmation of a top/bottom. After a sustained move this large candle shows all selling/buying coming in at one go & exhaustion of sell/buy power.

Another factor one must realise is that one is not meant to take trades on all signals from stochastics & RSI. They generate a lot of signals & if one takes all of them you wouldnt make any money. Idea is to take trades in the direction of the trend & not the anti-trends. And what defines the trend. Moving average - Take an appropriate moving average & plot it. If its going up - trend is up, if its going down, trend is down.

So if the overall market trend over several days is down, then we will tend to take the sell signals with much more confidence & be skeptical of the buy signals. This will lead to a much better success rate over time. Its not that one cant take the opposite trade, but one's success ratio will vary.

~ The trend is your friend.

Sunday, March 15, 2009

Slow Stochastics

Slow Stochastic Oscillator


Recognia identifies an event for a slow stochastic oscillator when:


The slow stochastic oscillator compares two lines called the %K and %D lines to predict the possibility of an uptrend or a downtrend. In price charts, the %K line typically appears as a solid line, and the %D line appears as a dotted line. The slow stochastic oscillator can be used effectively to monitor daily, weekly or monthly periods.

According to Martin J. Pring, George Lane developed the stochastic oscillator with the premise that during an uptrend, the closing price tends to rise. However, when the uptrend matures, price tends to close towards the bottom of the price range for the period. Likewise, in a downtrend, the reverse holds true.

The difference between the slow and fast stochastic oscillators is the way that the %K and %D values are calculated. Slow stochastics are based on the moving averages values calculated for fast stochastics. As such, John J. Murphy writes that most traders favor slow stochastics because they tend to be more reliable.

Slow Stochastic


For slow stochastics, the %K value is based on a 3-period moving average of the %K fast stochastics value. See fast stochastics for information about the %K calculation.


For slow stochastics, the %D value is based on a 3-period moving average of the %K slow stochastics value (described above).

Pring identifies that a way to differentiate the %K line from the %D line is to remember that %K represents "Kwick" movements, while %D shows movements that "Dawdle". As such, Edwards and Magee note that "[ordinarily], the %K Line will change direction before the %D Line. However, when the %D line changes direction prior to the %K line, a slow and steady Reversal is often indicated."

Trading Considerations

This section identifies that inform trading decisions using stochastics. It should be pointed out, that many technical analysts use stochastics in combination with other patterns or oscillators. John J. Murphy, for example, suggests that "[one] way to combine daily and weekly stochastics is to use weekly signals to determine the market direction and daily signals for timing. It's also a good idea to combine stochastics with RSI."

When you are using stochastics with price charts, keep the following factors in mind:

Saturday, March 14, 2009

Calculate Nifty Pivot Points

Visit this site if you want any help or tools on calculating Pivot points in general and more specifically pivot points for Nifty index. Pivot points are a useful tool for intraday trading, specifically acting as resistance and support levels which are used by a lot of traders to determine market direction and when & how to take positions intraday in market.

Friday, March 13, 2009

Pivot Points

Pivot points

We often hear market analysts or experienced traders talking about an equity price nearing a certain support or resistance level, each of which is important because it represents a point at which a major price movement is expected to occur. But how do these analysts and professional traders come up with these so-called levels? One of the most common methods is using pivot points, and here we take a look at how to calculate and interpret these technical tools.

How to Calculate Pivot Points
There are several different methods for calculating pivot points, the most common of which is the five-point system. This system uses the previous day's high, low and close, along with two support levels and two resistance levels (totaling five price points) to derive a pivot point. The equations are as follows:
R2 = P + (H - L) = P + (R1 - S1)
R1 = (P x 2) - L
P = (H + L + C) / 3
S1 = (P x 2) - H
S2 = P - (H - L) = P - (R1 - S1)
Here, "S" represents the support levels, "R" the resistance levels and "P" the pivot point. High, low and close are represented by the "H", "L" and "C" respectively. Note that the high, low and close in 24-hour markets (such as forex) are often calculated using New York closing time (4pm EST) on a 24-hour cycle. Limited markets (such as the NYSE) simply use the high, low and close from the day's standard trading hours.

Take a look at the following example of the five-point system, which illustrates a projection of Microsoft's (Nasdaq:MSFT) stock movement. Note the pivot point and the support and resistance levels.

Source: Yahoo! Finance

Another common variation of the five-point system is the inclusion of the opening price in the formula:

P = ((Today's O) + Yesterday's (H + L + C)) / 4

Here, the opening price, "O", is added to the equation. Note that the opening price for foreign exchange markets is simply the last period's closing price. The supports and resistances can then be calculated in the same manner as the five-point system, except with the use of the modified pivot point.

Yet another pivot point system was developed by Tom DeMark, a famous technical analyst and president of Market Studies, Inc. This system uses the following rules:

As you can see, there are many different pivot-point systems available. Some popular ones include as many as nine different price levels; meanwhile, others predict only one pivot point, and no additional levels of support or resistance.

Interpreting and Using Pivot Points
When calculating pivot points, the pivot point itself is the primary support/resistance. This means that the largest price movement is expected to occur at this price. The other support and resistance levels are less influential, but may still generate significant price movements.

Pivot points can be used in two ways. The first way is for determining overall market trend: if the pivot point price is broken in an upward movement, then the market is bullish, and vice versa. Keep in mind, however, that pivot points are short-term trend indicators, useful for only one day until they need to be recalculated. The second method is to use pivot point price levels to enter and exit the markets. For example, a trader might put in a limit order to buy 100 shares if the price breaks a resistance level. Alternatively, a trader might set a stop-loss for his active trade if a support level is broken.

Pivot points are yet another useful tool that can be added to any trader's toolbox. It enables anyone to quickly calculate levels that are likely to cause price movement. The success of a pivot-point system, however, lies squarely on the shoulders of the trader, and on his or her ability to effectively use the pivot-point systems in conjunction with other forms of technical analysis. These other technical indicators can be anything from MACD crossovers to candlestick patterns - the greater the number of positive indications, the greater the chances for success.

If all this seems very confusing and all you simply want to know is how to calculate pivot levels for any stock or index then simply look at this page for calculating nifty pivot point levels



Moving Averages

Moving Averages


Moving averages are one of the most popular and easy to use tools available to the technical analyst. They smooth a data series and make it easier to spot trends, something that is especially helpful in volatile markets. They also form the building blocks for many other technical indicators and overlays.

Sun Microsystems, Inc. (SUNW) MA 50/100 chart example from

The two most popular types of moving averages are the Simple Moving Average (SMA) and the Exponential Moving Average (EMA). They are described in more detail below.

Simple Moving Average (SMA)

(Click here for a live example of a Simple Moving Average)

A simple moving average is formed by computing the average (mean) price of a security over a specified number of periods. While it is possible to create moving averages from the Open, the High, and the Low data points, most moving averages are created using the closing price. For example: a 5-day simple moving average is calculated by adding the closing prices for the last 5 days and dividing the total by 5.

10+ 11 + 12 + 13 + 14 = 60
(60 / 5) = 12

The calculation is repeated for each price bar on the chart. The averages are then joined to form a smooth curving line - the moving average line. Continuing our example, if the next closing price in the average is 15, then this new period would be added and the oldest day, which is 10, would be dropped. The new 5-day simple moving average would be calculated as follows:

11 + 12 + 13 + 14 +15 = 65
(65 / 5) = 13

Over the last 2 days, the SMA moved from 12 to 13. As new days are added, the old days will be subtracted and the moving average will continue to move over time.

In the example above, using closing prices from Eastman Kodak (EK), day 10 is the first day possible to calculate a 10-day simple moving average. As the calculation continues, the newest day is added and the oldest day is subtracted. The 10-day SMA for day 11 is calculated by adding the prices of day 2 through day 11 and dividing by 10. The averaging process then moves on to the next day where the 10-day SMA for day 12 is calculated by adding the prices of day 3 through day 12 and dividing by 10.

The chart above is a plot that contains the data sequence in the table. The simple moving average begins on day 10 and continues.

This simple illustration highlights the fact that all moving averages are lagging indicators and will always be "behind" the price. The price of EK is trending down, but the simple moving average, which is based on the previous 10 days of data, remains above the price. If the price were rising, the SMA would most likely be below. Because moving averages are lagging indicators, they fit in the category of trend following indicators. When prices are trending, moving averages work well. However, when prices are not trending, moving averages can give misleading signals.

Exponential Moving Average (EMA)

(Click here for a live example of an Exponential Moving Average)

In order to reduce the lag in simple moving averages, technicians often use exponential moving averages (also called exponentially weighted moving averages). EMA's reduce the lag by applying more weight to recent prices relative to older prices. The weighting applied to the most recent price depends on the specified period of the moving average. The shorter the EMA's period, the more weight that will be applied to the most recent price. For example: a 10-period exponential moving average weighs the most recent price 18.18% while a 20-period EMA weighs the most recent price 9.52%. As we'll see, the calculating and EMA is much harder than calculating an SMA. The important thing to remember is that the exponential moving average puts more weight on recent prices. As such, it will react quicker to recent price changes than a simple moving average. Here's the calculation formula.

Exponential Moving Average Calculation

Exponential Moving Averages can be specified in two ways - as a percent-based EMA or as a period-based EMA. A percent-based EMA has a percentage as it's single parameter while a period-based EMA has a parameter that represents the duration of the EMA.

The formula for an exponential moving average is:

EMA(current) = ( (Price(current) - EMA(prev) ) x Multiplier) + EMA(prev)

For a percentage-based EMA, "Multiplier" is equal to the EMA's specified percentage. For a period-based EMA, "Multiplier" is equal to 2 / (1 + N) where N is the specified number of periods.

For example, a 10-period EMA's Multiplier is calculated like this:

(2 / (Time periods + 1) ) = (2 / (10 + 1) ) = 0.1818 (18.18%)

This means that a 10-period EMA is equivalent to an 18.18% EMA.

Note: only support period-based EMA's.

Below is a table with the results of an exponential moving average calculation for Eastman Kodak. For the first period's exponential moving average, the simple moving average was used as the previous period's exponential moving average (yellow highlight for the 10th period). From period 11 onward, the previous period's EMA was used. The calculation in period 11 breaks down as follows:

(C - P) = (57.15 - 59.439) = -2.289
(C - P) x K = -2.289 x .181818 = -0.4162
( (C - P) x K) + P = -0.4162 + 59.439 = 59.023


*The 10-period simple moving average is used for the first calculation only. After that the previous period's EMA is used.

(Download this table as an Excel spreadsheet)

Note that, in theory, every previous closing price in the data set is used in the calculation of each EMA that makes up the EMA line. While the impact of older data points diminishes over time, it never fully disappears. This is true regardless of the EMA's specified period. The effects of older data diminish rapidly for shorter EMA's. than for longer ones but, again, they never completely disappear.

Simple Versus Exponential

From afar, it would appear that the difference between an exponential moving average and a simple moving average is minimal. For this example, which uses only 20 trading days, the difference is minimal, but a difference nonetheless. The exponential moving average is consistently closer to the actual price. On average, the EMA is 3/8 of a point closer to the actual price than the SMA.

From day 10 to day 20, the EMA was closer to the price than the SMA 8 out of 11 times. The average absolute difference between the exponential moving average and the current price was 1.52 and the simple moving average had an average absolute difference of 1.69. This means that on average, the exponential moving average was 1.52 point above or below the current price and the simple moving average was 1.69 points above or below the current price.

When Kodak stopped falling and started to trade flat, the SMA kept on declining. During this period, the SMA was closer to the actual price than the EMA. The EMA began to level out with the actual price, and remain further away. This was because the actual price started to level out. Because of its lag, the SMA continued to decline and nearly touched the actual price on 13-Dec.

International Business Machines (IBM) MA example chart from

A comparison of a 50-day EMA and a 50-day SMA for IBM also shows that the EMA picks up on the trend quicker than the SMA. The blue arrows mark points when the stock started a strong trend. By giving more weight to recent prices, the EMA reacted quicker than the SMA and remained closer to the actual price. The gray circle shows when the trend began to slow and a trading range developed. When the change from trend to trading began, the SMA was closer to the price. As the trading range continued into 2001, both moving averages converged. In early 2001, CPQ started to trend up and the EMA was quicker to pick up on the recent price change and remain closer to the price.

Which is better?

Which moving average you use will depend on your trading and investing style and preferences. The simple moving average obviously has a lag, but the exponential moving average may be prone to quicker breaks. Some traders prefer to use exponential moving averages for shorter time periods to capture changes quicker. Some investors prefer simple moving averages over long time periods to identify long-term trend changes. In addition, much will depend on the individual security in question. A 50-day SMA might work great for identifying support levels in the NASDAQ, but a 100-day EMA may work better for the Dow Transports. Moving average type and length of time will depend greatly on the individual security and how it has reacted in the past.

The initial thought for some is that greater sensitivity and quicker signals are bound to be beneficial. This is not always true and brings up a great dilemma for the technical analyst: the trade off between sensitivity and reliability. The more sensitive an indicator is, the more signals that will be given. These signals may prove timely, but with increased sensitivity comes an increase in false signals. The less sensitive an indicator is, the fewer signals that will be given. However, less sensitivity leads to fewer and more reliable signals. Sometimes these signals can be late as well.

For moving averages, the same dilemma applies. Shorter moving averages will be more sensitive and generate more signals. The EMA, which is generally more sensitive than the SMA, will also be likely to generate more signals. However, there will also be an increase in the number of false signals and whipsaws. Longer moving averages will move slower and generate fewer signals. These signals will likely prove more reliable, but they also may come late. Each investor or trader should experiment with different moving average lengths and types to examine the trade-off between sensitivity and signal reliability.

Trend-Following Indicator


Moving averages smooth out a data series and make it easier to identify the direction of the trend. Because past price data is used to form moving averages, they are considered lagging, or trend following, indicators. Moving averages will not predict a change in trend, but rather follow behind the current trend. Therefore, they are best suited for trend identification and trend following purposes, not for prediction.

When to Use

Because moving averages follow the trend, they work best when a security is trending and are ineffective when a security moves in a trading range. With this in mind, investors and traders should first identify securities that display some trending characteristics before attempting to analyze with moving averages. This process does not have to be a scientific examination. Usually, a simple visual assessment of the price chart can determine if a security exhibits characteristics of trend.

In its simplest form, a security's price can be doing only one of three things: trending up, trending down or trading in a range. An uptrend is established when a security forms a series of higher highs and higher lows. A downtrend is established when a security forms a series of lower lows and lower highs. A trading range is established if a security cannot establish an uptrend or downtrend. If a security is in a trading range, an uptrend is started when the upper boundary of the range is broken and a downtrend begins when the lower boundary is broken.

Ford Motor Co. (F) MA example chart from

In the Ford (F)[F] example, it is evident that a stock can go through both trending and trading phases. The red circles indicate trading range phases that are interspersed among trending periods. It is sometimes difficult to determine when a trend will stop and a trading range will begin or when a trading range will stop and a trend will begin. The basic rules for trends and trading ranges laid out above can be applied to Ford. Notice the trading range periods, the breakouts (both up and down) and the trending periods. The moving average worked well in times of trend, but faired poorly in times of trading. Also note how the moving average lags behind the trend: it is always under the price during an uptrend and above the price during a downtrend. A 50-day simple moving average was used for this example. However, the number of periods is optional and much will depend on the characteristics of the security as well as an individual's trading and investing style.

Coca Cola Co. (KO) MA example chart from

If price movements are choppy and erratic over an extended period of time, then a moving average is probably not the best choice for analysis. The chart for Coca-Cola (KO)[KO] shows a security that moved from 60 to 40 in a couple months in 2001. Prior to this decline, the price gyrated above and below its moving average. After the decline, the stock continued its erratic behavior without developing much of a trend. Trying to analyze this security based on a moving average is likely to be a lesson in futility.

Time Warner, Inc. (TWX) MA example chart from

A quick look at the chart for Time Warner (TWX)[TWX] shows a different picture. Over the same time period, Time Warner has shown the ability to trend. There are 3 distinct trends or price movements that extend for a number of months. Once the stock moves above or below the 70-day SMA, it usually continues in that direction for a little while longer. Coca-Cola, on the other hand, broke above and below its 70-day SMA numerous times and would have been prone to numerous whipsaws. A longer moving average might work better, but it is clear that the Time Warner chart had better trending characteristics.

Moving Average Settings

Once a security has been deemed to have enough characteristics of trend, the next task will be to select the number of moving average periods and type of moving average. The number of periods used in a moving average will vary according to the security's volatility, trendiness and personal preferences. The more volatility there is, the more smoothing that will be required and hence the longer the moving average. Stocks that do not exhibit strong characteristics of trend may also require longer moving averages. There is no one set length, but some of the more popular lengths include 21, 50, 89, 150 and 200 days as well as 10, 30 and 40 weeks. Short-term traders may look for evidence of 2-3 week trends with a 21-day moving average, while longer-term investors may look for evidence of 3-4 month trends with a 40-week moving average. Trial and error is usually the best means for finding the best length. Examine how the moving average fits with the price data. If there are too many breaks, lengthen the moving average to decrease its sensitivity. If the moving average is slow to react, shorten the moving average to increase its sensitivity. In addition, you may want to try using both simple and exponential moving averages. Exponential moving averages are usually best for short-term situations that require a responsive moving average. Simple moving averages work well for longer-term situations that do not require a lot of sensitivity.

Uses for Moving Averages

There are many uses for moving averages, but three basic uses stand out:

  • Trend identification/confirmation
  • Support and Resistance level identification/confirmation
  • Trading Systems

Trend Identification/Confirmation

There are three ways to identify the direction of the trend with moving averages: direction, location and crossovers.

The first trend identification technique uses the direction of the moving average to determine the trend. If the moving average is rising, the trend is considered up. If the moving average is declining, the trend is considered down. The direction of a moving average can be determined simply by looking at a plot of the moving average or by applying an indicator to the moving average. In either case, we would not want to act on every subtle change, but rather look at general directional movement and changes.

Walt Disney Co. (DIS) MA example chart from

In the case of Disney (DIS)[DIS], a 100-day exponential moving average (EMA) has been used to determine the trend. We do not want to act on every little change in the moving average, but rather significant upturns and downturns. This is not a scientific study, but a number of significant turning points can be spotted just based on visual observation (red circles). A few good signals were rendered, but also a few whipsaws and late signals. Much of the performance would depend on your entry and exit points. The length of the moving average influences the number of signals and their timeliness. Moving averages are lagging indicators. Therefore, the longer the moving average is, the further behind the price movement it will be. For quicker signals, a 50-day EMA could have been used.

The second technique for trend identification is price location. The location of the price relative to the moving average can be used to determine the basic trend. If the price is above the moving average, the trend is considered up. If the price is below the moving average, the trend is considered down.

Cisco Systems, Inc. (CSCO) MA example chart from

This example is pretty straightforward. The long-term for Cisco (CSCO)[CSCO] is determined by the location of the stock relative to its 100-day SMA. When CSCO is above its 100-day SMA, the trend is considered bullish. When the stock is below the 100-day SMA, the trend is considered bearish. Buy and sell signals are generated by crosses above and below the moving average. There was a brief sell signal generated in Aug-99 and a false buy signal in July-00. Both of these signals occurred when Cisco's trend began to weaken. For the most part though, this simple method would have kept an investor in throughout most of the bull move.

The third technique for trend identification is based on the location of the shorter moving average relative to the longer moving average. If the shorter moving average is above the longer moving average, the trend is considered up. If the shorter moving average is below the longer moving average, the trend is considered down.

Inter-Tel, Inc. (INTL) MA example chart from

For Inter-Tel (INTL)[INTL], a 30/100 moving average crossover was used to determine the trend. When the 30-day moving average moves above the 100-day moving average, the trend is considered bullish. When the 30-day moving average declines below the 100-day moving average, the trend is considered bearish. A plot of the 30/100 differential is plotted below the price chart by using the Percentage Price Oscillator (PPO) set to (30,100,1). When the differential is positive the trend is considered up – when it is negative the trend is considered down. As with all trend-following systems, the signals work well when the stock develops a strong trend, but are ineffective when the stock is in a trading range. Also notice that the signals tend to be late and after the move has begun. Again, trend following indicators are best for identification and following, not predicting.

Support and Resistance Levels

Another use of moving averages is to identify support and resistance levels. This is usually accomplished with one moving average and is based on historical precedent. As with trend identification, support and resistance level identification through moving averages works best in trending markets.

Sun Microsystems, Inc. (SUNW) MA example chart from

After breaking out of a trading range, Sun Microsystems (SUNW)[Sunw] successfully tested moving average support in late July and early August. Also notice that the June resistance breakout near 18 turned into support. Therefore, the moving average acted as a confirmation of resistance-turned-support. After this first test, the 50-day moving average went on to 4 more successful support tests over the next several months. A break of support from the 50-day moving average would serve as a warning that the stock may move into a trading range or may be about to change the direction of the trend. Such a break occurred in Apr-00 and the 50-day SMA turned into resistance later that month. When the stock broke above the 50-day SMA in early Jun-00, it returned to a support level until the Oct-00 break. In Oct-00, the 50-day SMA became a resistance level and that held for many months.

Moving Averages and SharpCharts

SharpCharts application MA example image

Moving averages are available as a price overlay feature on SharpCharts. From the price overlay option, you can choose either a simple moving average or an exponential moving average. The first parameter is used to set the number of time periods. If charting on daily periods, then 50 would be for a 50-day moving average. If charting on weekly periods, then 50 would be for a 50-week moving average. An optional second parameter can be used to shift the MA lines to the left or right by a specified number of periods. The moving averages are based on closing prices and multiple moving averages can be overlaid the price plot.

(Click here for a live example of a Simple Moving Average and an Exponential Moving Average)


Moving averages can be effective tools to identify and confirm trend, identify support and resistance levels, and develop trading systems. However, traders and investors should learn to identify securities that are suitable for analysis with moving averages and how this analysis should be applied. Usually, an assessment can be made with a visual examination of the price chart, but sometimes it will require a more detailed approach. The ADX, Average Directional Index, is one tool that can help identify securities that are trending and those that are not.

The advantages of using moving averages need to be weighed against the disadvantages. Moving averages are trend following, or lagging, indicators that will always be a step behind. This is not necessarily a bad thing though. After all, the trend is your friend and it is best to trade in the direction of the trend. Moving averages will help ensure that a trader is in line with the current trend. However, markets, stocks and securities spend a great deal of time in trading ranges, which render moving averages ineffective. Once in a trend, moving averages will keep you in, but also give late signals. Don't expect to get out at the top and in at the bottom using moving averages. As with most tools of technical analysis, moving averages should not be used on their own, but in conjunction with other tools that complement them. Using moving averages to confirm other indicators and analysis can greatly enhance technical analy

Thursday, March 12, 2009

Best EMA Chart for Nifty Intraday trading

From my experience trading Nifty Futures since last 3 years, the 20 minute EMA works best as a support, resistance. But obviously one cannot trade just on the basis of that, since the profit % will be low and the gains on winning trades not enough to compensate for the losses as well as make decent profits.

Further, using just the 20 minute EMA also leads to a problem of deciding when to book profits. In most cases, one will end up losing almost all of the gains if one waits for the price to cross 20EMA line in either direction.

Then I thought why not book profits if price move x%, say 0.5% or 1% in my favour, while having a stop of half that target amount. I tested the same with data, but that did not give good results at all. Thus it stands decided that the 20 minute EMA cant be used all by itself.

However I have found that when used in conjunction with other indicator such as RSI, Stochastics it is a useful tool. How ?

Now say suppose RSI & Stochastics give buy indicator, but by this time, the price has already run up too much and there is risk in taking a long position now. So what do I do ? I wait for price to correct a little bit & will look to enter near the 20 minute EMA line. In most cases, prices bounce off this line and continue the earlier trend. This is how one can use the indicator usefully.

Calculate Exponential Moving Average EMA

Exponetial Moving Average (EMA for short) is one of the most used indicators in technical analysis today. But how do you calculate it for yourself, using a paper and a pen or - preferred - a spreadsheet program of your choice. Let’s find out in this explanation of EMA calculation.

Calculating Exponential Moving Average (EMA) is of course done automatically by most trading and technical analysis software out there today.

Here is how to calculate it manually which also adds to the understanding on how it works.

In this example we shall calculate EMA for a the price of a stock. We want a22 day EMA which is a common enough time frame for a long EMA.

The formula for calculating EMA is as follows:

EMA = Price(t) * k + EMA(y) * (1 - k)

t = today, y = yesterday, N = number of days in EMA, k = 2/(N+1)

Use the following steps to calculate a 22 day EMA:

1) Start by calculating k for the given timeframe. 2 / (22 + 1) = 0,0869

2) Add the closing prices for the first 22 days together and divide them by 22.

3) You’re now ready to start getting the first EMA day by taking the following day’s (day 23) closing price multiplied by k, then multiply the previous day’s moving average by (1-k) and add the two.

4) Do step 3 over and over for each day that follows to get the full range of EMA.

This can of course be put into Excel or some other spreadsheet software to make the process of calculating EMA semi-automatic.

To give you an algorithmic view on how this can be accomplished, see below.

public float CalculateEMA(float todaysPrice, float numberOfDays, float EMAYesterday){
float k = 2 / (numberOfDays + 1);
return todaysPrice * k + EMAYesterday * (1 - k);

This method would typically be called from a loop through your data, looking something like this:

foreach (DailyRecord sdr in DataRecords){
//call the EMA calculation
ema = Formulas.EMA(sdr.Close, numberOfDays, yesterdayEMA);

//put the calculated ema in an array
m_emaSeries.Items.Add(sdr.TradingDate, ema);

//make sure yesterdayEMA gets filled with the EMA we used this time around
yesterdayEMA = ema;

Note that this is psuedo code. You would typically need to send the yesterday CLOSE value as yesterdayEMA until the yesterdayEMA is calculated from today’s EMA. That’s happening only after the loop has run more days than the number of days you have calculated your EMA for.

For a 22 day EMA, it’s only on the 23 time in the loop and thereafter that the yesterdayEMA = ema is valid. This is no big deal, since you will need data from at least 100 trading days for a 22 day EMA to be valid.

Wednesday, March 4, 2009

Calculate RSI for Nifty

I have a post showing exactly how to do the computation. There is also a live example
with real data of Nifty index and calculation done in excel.

Tuesday, March 3, 2009

RSI - Relative Strength Index

Relative Strength Index (RSI)


Developed by J. Welles Wilder and introduced in his 1978 book, New Concepts in Technical Trading Systems, the Relative Strength Index (RSI) is an extremely useful and popular momentum oscillator. The RSI compares the magnitude of a stock's recent gains to the magnitude of its recent losses and turns that information into a number that ranges from 0 to 100. It takes a single parameter, the number of time periods to use in the calculation. In his book, Wilder recommends using 14 periods.

The RSI's full name is actually rather unfortunate as it is easily confused with other forms of Relative Strength analysis such as John Murphy's "Relative Strength" charts and IBD's "Relative Strength" rankings. Most other kinds of "Relative Strength" stuff involve using more than one stock in the calculation. Like most true indicators, the RSI only needs one stock to be computed. In order to avoid confusion, many people avoid using the RSI's full name and just call it "the RSI."


                  100     RSI = 100 - --------                  1 + RS      RS = Average Gain / Average Loss      Average Gain = [(previous Average Gain) x 13 + current Gain] / 14     First Average Gain = Total of Gains during past 14 periods / 14      Average Loss = [(previous Average Loss) x 13 + current Loss] / 14     First Average Loss = Total of Losses during past 14 periods / 14       Note: "Losses" are reported as positive values.  

To simplify our explanation of the formula, the RSI has been broken down into its basic components which are the RS, the Average Gain, and the Average Loss.

To calculate RSI values for a given dataset, first find the magnitude of all gains and losses for the 14 periods prior to the time where you wish to start the calculation. (Note: 14 is the standard number of periods used when calculating the RSI. If a different number is specified, just substitute that number in for "14" throughout this discussion.)

It is important to understand that the RSI is a "running" calculation and the accuracy of the calculation depends on how long ago the calculations started. The first RSI value is an estimate - subsequent values improve on that estimate. You should calculate at least 14 values prior to the start of any values that you will rely on - going back 28+ periods is even better.

To start the running calculation, the First Average Gain is calculated as the total of all gains during the past 14 periods divided by 14. Similarly, the First Average Loss is calculated as the total magnitude of all losses during the past 14 periods divided by 14. The next values for the "averages" are calculated by taking the previous value, multiplying it by 13, adding in the next Gain (or Loss), and then dividing by 14. This is Wilder's modified "smoothing" technique in action.

The RS value is simply the Average Gain divided by the Average Loss for each period.

Finally, the RSI is simply the RS converted into an oscillator that goes between zero and 100 using this formula: 100 - (100 / RS + 1).

Here's an Excel Spreadsheet that shows the start of an RSI calculation in action.

When the Average Gain is greater than the Average Loss, the RSI rises because RS will be greater than 1. Conversely, when the Average Loss is greater than the Average Gain, the RSI declines because RS will be less than 1. The last part of the formula ensures that the indicator oscillates between 0 and 100. Note: If the Average Loss ever becomes zero, RSI becomes 100 by definition.


Important Note: The more data points that are used to calculate the RSI, the more accurate the results. The smoothing factor is a continuous calculation that - in theory - takes into account all of the closing values in the data set. If you start an RSI calculation in the middle of an existing data set, your values will only approximate the true RSI value. SharpCharts uses at least 250 data points prior to the starting date of any chart (assuming that much data exists) when calculating its RSI values. To duplicate our RSI numbers, you'll need to use at least that much data also.



Wilder recommended using 70 and 30 and overbought and oversold levels respectively. Generally, if the RSI rises above 30 it is considered bullish for the underlying stock. Conversely, if the RSI falls below 70, it is a bearish signal. Some traders identify the long-term trend and then use extreme readings for entry points. If the long-term trend is bullish, then oversold readings could mark potential entry points.


Buy and sell signals can also be generated by looking for positive and negative divergences between the RSI and the underlying stock. For example, consider a falling stock whose RSI rises from a low point of (for example) 15 back up to say, 55. Because of how the RSI is constructed, the underlying stock will often reverse its direction soon after such a divergence. As in that example, divergences that occur after an overbought or oversold reading usually provide more reliable signals.

Centerline Crossover

The centerline for RSI is 50. Readings above and below can give the indicator a bullish or bearish tilt. On the whole, a reading above 50 indicates that average gains are higher than average losses and a reading below 50 indicates that losses are winning the battle. Some traders look for a move above 50 to confirm bullish signals or a move below 50 to confirm bearish signals.


Dell Inc. (DELL) RSI example chart from

The DELL example shows a number of extreme readings as well as a negative divergence. In Oct-99, RSI reached oversold for a brief moment to mark the low around 38. The next extreme reading (overbought) occurred after a large advance that peaked in Dec-99. RSI reached overbought levels in late Dec-99 and moved below 50 by the second week of Jan-00. The next oversold reading occurred in Feb. for another brief moment and marked the low around 35. By the end of Feb-00, RSI moved back above 50 and into overbought territory in March. A negative divergence formed in March and marked the high in the upper fifties.

To see an illustration of how RSI is calculated in Excel have a look here.