Friday, June 5, 2015

Technical Analysis using R Software - Calculating Standard Pivot Points - Support Resistance Levels

Technical Analysts often refer to Pivots Points that can be defined as a point at which a major price movement is expected to occur. Pivot Points basically define directional price movement or support and resistance levels. Pivot Points are calculated using the prior period's high, low and close price of the stock, commodity or currency and based on which a future support and resistance level is identified. Pivot Points can be considered as predictive or leading indicators. Pivot points are to be calculated on daily basis.

Pivot Points for 1, 5, 10 and 15 minute charts use the prior day's high, low and close. Pivot Points for 30 and 60 minute charts use the prior week's high, low and close. These calculations are based on calendar weeks. Pivot Points for daily charts use the prior month's data. Pivot Points for current month would be based on the high, low and close for previous month.  Once Pivot Points are fixed, they do not change and remain same during the relevant time frame. Source: http://stockcharts.com/school/doku.php?id=chart_school:technical_indicators:pivot_points

Standard Pivot Points also called the five-point system as it involves five different points. ( Average Point + S1+S2+R1+R2 ).  Calculation is based on the simple average of previous day's high, low and close prices combined with two support levels (S1 & S2) and two resistance levels (R1 & R2) 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 prices are represented by the "H," "L" and "C," respectively.

R CODE

getSymbols('INFY.BO',src='yahoo') # Data downloaded from January 1st 2007 till the current previous day
INFY=INFY.BO['2015-01-01::2015-05-31'] # Choosing Data from January 1st 2015 till May 31st 2015
head(INFY) # First Six Lines of Data
chartSeries(INFY) # Candlestick Chart of Infosys
center <- xts(rowSums(HLC(INFY))/3,order.by=index(INFY)) # Average of High, Low & Close Price (H+L+C/3)
head(center) # First Six Lines of Data
R1 <- (2*center)-Lo(INFY)  # First Resistance (R1) = (2*P) - Low
S1 <- (2*center)-Hi(INFY)  # First Support (S1) = (2*P) - High
R2 <- center + (R1 - S1)   # Second Resistance (R2) = P + (R1-S1)
S2 <- center - (R1 - S1)   # Second Support (S2) = P - (R1- S1)
ret <- cbind(center,R1,R2,S1,S2) # Combining all Calculations in adjacent columns
colnames(ret) <- c('center','R1','R2','S1','S2') # Column Names
dat = cbind(INFY,ret) # Combining both the sheets or files
head(dat) # First Six Lines of Data
write.csv(dat,"Datasupres.csv") # Saving a copy as CSV file
chartSeries(INFY) # Candlestick Chart of Infosys
addTA(dat$S1, on=1, col='lightblue') # Adding Support1 Line to Candlestick Chart
addTA(dat$S2, on=1, col='blue')   # Adding Support2 Line to Candlestick Chart
addTA(dat$R1, on=1, col='pink')   # Adding Resistance1 Line to Candlestick Chart
addTA(dat$R2, on=1, col='red')   # Adding Resistance2 Line to Candlestick Chart 




Interpreting & Analysis of Pivot Points

Pivot point (PP) is considered as the principal  support & resistance level around which the biggest price movement is expected to occur. S1 & S2 and R1 & R2 levels can be considered secondary that can still lead to  significant price movements. Overall market trend is highlighted by pivot points.

If the pivot point price is broken in an upward trend, then the market is bullish, and if the pivot point price is broken in downward trend then the market is bearish. Pivot point price also used to enter and exit the markets. Traders may might place a BUY limit order if the price breaks a resistance level and can place a stop-loss SELL if a support level is broken.

Movement above the pivot point is often considered positive highlighting strength targeting the R1 level and movement beyond R1 level highlights further stronger move targeting R2 level. Movement below the pivot point is often considered negative highlighting weakness targeting the S1 level and movement beyond S1 level highlights further weakness  targeting S2 level.

When prices decline to a support level and then stabilize at that level, traders often look at it as a successful test for bounce off the support and for confirming the  bounce upwards from the support level , bullish chart patterns or indicators are used to confirm. Similarly if prices rise to the resistance level and then stabilize at that level, traders often lookout for a bearish chart pattern or indicator to confirm a downturn from the resistance level.

Second support and resistance levels indicate whether there is overbuying or overselling.
Any price movement beyond the second resistance level (R2), indicates strength along with overbuying and with a chance of  pullback occurring. Any price movement beyond the second support level (S2) indicates weakness along with overselling and with a chance of bounce back occurring.

Support and resistance levels are critical after the crossover which is a point on a stock chart when price and an indicator intersect. Crossovers aid technical analysts in forecasting the future movements in the price of a stock that may signal either buy or sell.

No comments:

Post a Comment