Giter VIP home page Giter VIP logo

cpr-based-stock-screener-in-python's Introduction

Automated Stock Tracker with SMTP Alerts:

License

I created Stock Tracker app based on leading indicator - Central Pivot Range(CPR)

Table of Contents

About:

  • This application uses a leading technical indicator - Central Pivot Range which uses previous OHLC data and predict the next day/week/month pivots.
  • Using this indicator principles such as Narrow Range CPR, we are identifying the list of stocks which can have a huge momentum for next day/week/month.
  • Email alerts will be sent with this filtered list of stocks
  • We also identified the accuracy of this indicator by comparing the previous momentum on normal days with momentum on Narrow Range CPR days.

Central Pivot Range - Overview:

Central Pivot Range Indicator is a powerful price action leading indicator. The range acts as major support or resistance for every stock. Anyone can forecast the trend of any stock, whether it will be bullish, bearish or sideways, by looking at the width of the CPR.

Strategies with CPR:

Major Strategies that are in practise with CPR are:

  • Width of CPR:

    Width of CPR can be categorized into 3 parts:

    1. Narrow Range CPR - NRCPR

    2. Medium Range CPR - MRCPR

    3. Wide Range CPR - WRCPR

    4. NRCPR says that - whenever a stock trades within a small range in the previous day, week or month, depending on the CPR you are using, then there is a good possibility of a trending day.

    5. MRCPR says that - When the range of CPR is neither too narrow nor too wide,then it indicates that the stock will not be as trending as much as a narrow range.

    6. WRCPR says that: When the range of the CPR is very wide, then the stock was trending in the previous sessions which indicates a high possibility of a sideways day.

  • Virgin CPR:

    A virgin CPR occurs when all the candles on a trading session have closed either upside or downside of the CPR, and none of the candles closed at the CPR. A Virgin CPR acts as very strong support and resistance for next few subsequent trading sessions.

Pivots Math Formula:

	Central Pivots:
	  - pivot = (high + low + close) /3
	  - BC = (high + low) / 2
	  - TC = (pivot - BC) + pivot
	
	Support levels:
	  - S1 = (pivot * 2) - high
	  - S2 = pivot - (high - low)
	  - S3 = low - 2 * (high - pivot)
	
	Resistance levels:
	  - R1 = (pivot * 2) - low
	  - R2 = pivot + (high - low)
	  - R3 = high + 2 * (pivot-low)
	
	Formula for Narrow Range = 2*(Pivot - BC)<0.0015*close

Project Structure:

	.
	└── Stock Screener/
		├── com/
		│   └── dino/
		│       └── stocktracker/
		│           ├── Dataset/
		│           │   └── get_dataset.py/
		│           │       ├── stock_data.csv
		│           │       ├── Narrow_CPR.csv
		│           │       └── wkly_dataset.csv
		│           ├── Find Pivots/
		│           │   ├── find_pivots.py
		│           │   └── filter_narrow_range.py
		│           ├── Indicator Backtests/
		│           │   ├── backtest.py
		│           │   └── cpr_backtest.py
		│           └── Mail Alerts/
		│               └── stock_alerts.py
		├── run.py
		├── config.py
		├── README.md
		├── .gitignore
		├── CODE_OF_CONDUCT.md
		└── LICENSE
  • Note: config.py is restricted to local as it contains secret credentials

Libraries used:

  • pathlib
  • pandas
  • yfinance
  • mplfinance
  • smtplib
  • email.mime

Back Testing Results:

  • We performed back testing with a list of Top 100 US stocks(as of 11/25/2022) and calculated the accuracy of Narrow CPR indicator based on momentum
Time Period From To Success Ratio Fail Ratio
2 Years 2020/1/1 10/30/2022 58.59 41.41
5 Years 2017/1/1 10/30/2022 59.18 40.82
10 Years 2012/1/1 10/30/2022 59.73 40.27
20 Years 2022/1/1 10/30/2022 59.61 40.39

License:

This project is licensed under the Apache 2.0 License - see the LICENSE file for details.

License

cpr-based-stock-screener-in-python's People

Contributors

dineshmv avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.