jefrnc
strategy-orb15-momentum
Python

Professional ORB Trading System - 25.7% Annual Returns (Aggressive Mode Default)

Last updated Jul 3, 2026
16
Stars
0
Forks
0
Issues
0
Stars/day
Attention Score
43
Language breakdown
No language data available.
โ–ธ Files click to expand
README

๐Ÿ”ฅ ORB Trading System

Professional algorithmic trading system for Interactive Brokers

โš ๏ธ IMPORTANT: This system requires real market data from Polygon.io for backtesting. All performance metrics must be generated from your own backtests with actual historical data.

๐ŸŽฏ Strategy Overview

Core Strategy: Opening Range Breakout (ORB)

  • ORB Period: Configurable (5-15 minutes)
  • Trading Window: Morning session focus
  • Position Type: Long only (breakout above ORB high)
  • Markets: Large cap stocks (NVDA, TSLA, AMD, AAPL, MSFT, GOOGL, AMZN, META)

Risk Management

  • Position Sizing: Risk-based (configurable 1-5% per trade)
  • Stop Loss: ATR-based or percentage
  • Take Profit: Multiple R targets
  • Circuit Breakers: Daily loss limits and drawdown protection

๐Ÿ“‹ System Requirements

Software Dependencies

pip install -r requirements.txt

Core Requirements

  • Python: 3.8+
  • Interactive Brokers: TWS or IB Gateway
  • Market Data: Polygon.io API key (required for backtesting)
  • API Libraries: ib_insync, pandas, numpy

Configuration

  • Paper Trading: Port 7497 (default)
  • Live Trading: Port 7496
  • API Permissions: Enable in TWS/Gateway settings

๐Ÿš€ Quick Start

1. Setup

# Clone repository
git clone https://github.com/jefrnc/ORB-15-Momentum.git
cd ORB-15-Momentum

Create virtual environment

python3 -m venv orb_env source orb_env/bin/activate

Install dependencies

pip install -r requirements.txt

Configure environment

cp .env.example .env

Edit .env with your Polygon API key

2. Paper Trading

# Start with paper trading (REQUIRED before live trading)
python3 orb_trader.py --mode paper

3. Risk Profiles

# Conservative (1% risk)
python3 orb_trader.py --risk-profile conservative --mode paper

Balanced (2% risk)

python3 orb_trader.py --risk-profile balanced --mode paper

Growth (3% risk)

python3 orb_trader.py --risk-profile growth --mode paper

Aggressive (5% risk) - NOT RECOMMENDED for beginners

python3 orb_trader.py --risk-profile aggressive --mode paper

๐Ÿ“Š Backtesting with Real Data

IMPORTANT: Real Data Required

This system does NOT include historical market data. You must use your own Polygon.io API key to fetch real market data for backtesting.

Running Real Backtests

# Set your Polygon API key
export POLYGONAPIKEY=yourpolygonapikeyhere

Run backtest for specific period

python3 backtestrealpolygon_yearly.py --start-year 2024 --start-month 1 --end-year 2024 --end-month 12

Results will be saved to data/yearlybacktestresults/

Backtest Output

  • monthly_results.json - Month-by-month performance
  • ytd_metrics.json - Year-to-date statistics
  • all_trades.csv - Individual trade details
  • backtest_summary.md - Performance report

โš ๏ธ Risk Disclaimers

CRITICAL WARNINGS

  • Paper Trade First: Minimum 30-60 days paper trading required
  • No Performance Guarantees: Past results do not predict future performance
  • Real Money Risk: You can lose your entire investment
  • Your Own Analysis: Run your own backtests with real data
  • Start Small: Begin with conservative position sizing (1%)

Trading Risks

  • Market volatility can cause significant losses
  • Technical failures can result in missed exits
  • Slippage and commissions reduce profits
  • Strategy may underperform in certain market conditions

โš™๏ธ Configuration Files

Strategy Parameters

Configure your strategy using one of the config files in the configs/ directory (e.g., configs/orbbalancedconfig.json):
  • ORB period length
  • Stop loss and take profit levels
  • Position sizing rules
  • Trading time windows
  • Symbol selection

Risk Profiles Available

  • orbconservativeconfig.json - 1% risk per trade
  • orbbalancedconfig.json - 2% risk per trade
  • orbgrowthconfig.json - 3% risk per trade
  • orbaggressiveconfig.json - 5% risk per trade (HIGH RISK)

๐Ÿ”ง Technical Features

Real-Time Execution

  • Market order entries
  • Stop-loss and profit target brackets
  • Position monitoring
  • Automatic end-of-day exits

Risk Controls

  • Maximum daily loss limits
  • Position size constraints
  • Consecutive loss protection
  • Volatility-based adjustments

๐Ÿ“ Important Notes

Before Trading

  • Validate with YOUR data: Run extensive backtests using your Polygon.io API
  • Paper trade extensively: Minimum 30-60 days recommended
  • Start conservative: Use 1% risk until proven profitable
  • Monitor carefully: Watch for strategy degradation
  • Have an exit plan: Know when to stop if strategy fails

Best Practices

  • Keep detailed trade logs
  • Review performance weekly
  • Adjust parameters based on market conditions
  • Never trade money you can't afford to lose
  • Consider tax implications of frequent trading

๐Ÿ› ๏ธ Troubleshooting

Connection Issues

  • Verify TWS/Gateway is running
  • Check port settings (7497 paper, 7496 live)
  • Ensure API permissions enabled

Data Issues

  • Confirm Polygon API key is valid
  • Check rate limits aren't exceeded
  • Verify market hours for data requests

๐Ÿ“„ License

MIT License - See LICENSE file for details

โš ๏ธ FINAL WARNING

This is experimental software for educational purposes. Trading involves substantial risk of loss. The developers are not responsible for any financial losses. There are no guarantees of profitability. Always start with paper trading and never risk money you cannot afford to lose.


Remember: Successful trading requires discipline, proper risk management, and continuous learning. This is a tool, not a magic money maker.

๐Ÿ”— More in this category

ยฉ 2026 GitRepoTrend ยท jefrnc/strategy-orb15-momentum ยท Updated daily from GitHub