Strategy code
Strategy source code
Download the current Python strategy modules with a default-parameter example runner, plus TradingView Pine Script versions where a single chart can express the rule.
Strategies72
With Pine Script55
LanguagePython 3 · Pine v5
PriceFree
Run your first example
Install the dependencies once, then download an example below and run its command in the download folder.
pip install pandas numpy yfinance
- Time-Series Momentum · Read the research · Download Python (.py) · Download Pine Script (.pine) ·
python MOM-01.py SPY - Turn of Month · Read the research · Download Python (.py) · Download Pine Script (.pine) ·
python CAL-01.py SPY - Donchian Breakout · Read the research · Download Python (.py) · Download Pine Script (.pine) ·
python TREND-02.py SPY
Each command prints the available date range, total return, CAGR, Sharpe ratio, and maximum drawdown for SPY using the strategy's default parameters.
How to use the files
- Python files run on their own: install pandas, numpy and yfinance, then run the file with a ticker or a CSV of daily prices.
- Pine files: use the Pine icon in TradingView's right toolbar to open the editor. Paste the script, select Add to chart, and use the daily timeframe.
- Each download page shows its TradingView test status. Use Python for the site's backtest rules. Market data and simulated fills can differ.
- A position decided at today's close earns tomorrow's return. Results are before trading costs.
- The example runner uses current prices and default parameters, not the site's walk-forward fits. Evidence downloads include archived source and replay the published run's recorded arithmetic. Recomputing strategy decisions requires the exact original inputs, which may not be public.
Free to use and modify. Provided as is, for research and education. Historical backtests do not predict future returns. Not investment advice.