Calculate Pivot Point,Resistance and Support of a Stock Price with a Small Python Code.

Pivot Point,Support and Resistance is an Important factor to Place the Orders as Per the Levels.


Say Suppose if the Market is Bullish then you set you target as according R1,R2 and R3 and then vice versa you will follow to set the Target in Sell Orders in Which S1,S2 and S3 Plays role.


It will also Help in Placing Stop Loss and Trailing Stop-Loss say suppose you want to stay Buy and Choose the Target as R3 then Definitely you Stop-Loss should be Less or More as per your Risk Apetite in which you can for S1 as Less and S3 as More.


Pivot Point helps in set for Calculation in Placing bid whether it is Buy or Sell.


It Does Follow Opposite to at Sompe Point it is Just touch S1 and will try to reach R3 for in that Case you can follow this rule.


Please Follow the Video for Proper Instruction's and Python Code Input is Given Below Please do Try it Yourself:


#impot the important packaging module
import pandas_datareader.data as pdr
import fix_yahoo_finance
import pandas as pd
import matplotlib.pyplot as plt



#define each and everything to perform the operation
def PPSR(data):  
    PP = pd.Series((data['High'] + data['Low'] + data['Close']) / 3)  
    R1 = pd.Series(2 * PP - data['Low'])  
    S1 = pd.Series(2 * PP - data['High'])  
    R2 = pd.Series(PP + data['High'] - data['Low'])  
    S2 = pd.Series(PP - data['High'] + data['Low'])  
    R3 = pd.Series(data['High'] + 2 * (PP - data['Low']))  
    S3 = pd.Series(data['Low'] - 2 * (data['High'] - PP))  
    psr = {'PP':PP, 'R1':R1, 'S1':S1, 'R2':R2, 'S2':S2, 'R3':R3, 'S3':S3}  
    PSR = pd.DataFrame(psr)  
    data= data.join(PSR)  
    return data
#extract the stock data
data = pdr.get_data_yahoo("^NSEI", start="2017-01-01", end="2017-07-31")
#compute and print the data
LL=PPSR(data)
print(LL)
# plot the data
pd.concat([data['Close'],PD.PP,PD.R1,PD.S1,PD.R2,PD.S2,PD.R3,PD.S3],axis=1).plot(figsize=(12,9),grid=True)
plt.show()

---End of Code Input--


Have any Doubt Regarding this Plese Fell Free to Comment and Plese do Share this Post in Various other Platform: