Basic Strategy Example: "Buy AAPL when the price goes down 5 times in a row". You can use either the stock symbol or company name. And you can choose from 100+ technical indicators (see the list at the bottom of this page).
Stock Data: Daily prices from US stock exchanges (NYSE and NASDAQ).
Order Entries: Your trade is entered at the market close. In our 40+ years of stock backtesting experience (starting back when it was done without computers), we have never seen the benefit of waiting until the next day to enter a trade like most backtesting programs do. If, for example, your strategy is "buy AAPL after it goes down 4 days in a row", that streak indicator is calculated at the end of the current bar (the closing price for the day). If it then enters the trade when the market opens tomorrow (the typical method) there is a good chance the price will be significantly different from when the trade was triggered. If AAPL already went up overnight, the "4 down days in a row" indicator in your strategy would no longer be valid and you would have missed your opportunity for profits.
Instead, by entering the trade at the exact same time the indicators for your strategy are calculated, it is a more scientific test of your strategy because it eliminates the randomness of waiting until after the overnight move. One reason backtesting programs generally delay the order until the next bar (in our case, the next day), is that it is technically impossible to place the trade at the exact same time you are supposed to be calculating the indicators. But the reality is that nowadays all stock brokers give you data by the minute (or even by the second or tick. That means even though your strategy is daily, you could calculate your indicators a few seconds before the market closes and then execute the order at the close, just as our backtester does.
Order Exits: It exits at the market close once your strategy triggers it. If no exit is specified, it automatically exits the next trading day (no weekends or market holidays). You can either specify to exit after a certain number of days, or use a stop loss/take profit strategy such as "Exit the trade after it goes down 20%."
AI-Powered Trading Signals: Uses a LightGBM machine learning model to predict if the stock will go up or down. Example AI strategies include:
Buy GOOG when the AI says to buy it.
Buy AMZN when the price goes up by 1% or more, but only if AI also agrees.
Advanced Strategy Examples:
Buy MSFT when the price goes down exactly 5 times in a row, sell short MSFT when the price goes up exactly 5 times in a row.
Buy DIS on Tuesdays when you also see an Evening Doji Star.
Sell Short TSLA when both the RSI and ADX suggest it's time to do so.
Buy MCD when the RSI, ADX, and average true range combined suggest it's time to do so, and sell short MCD with the opposite logic.
Buy HD when the closing price is under the lower Bollinger Band, sell short HD when the price crosses above the upper Bollinger Band.
Buy SPY when the MACD is higher than the Signal line (histogram is positive), sell short SPY when the MACD crosses below the Signal line (histogram is negative).
Multi-Stock Backtests: Get results for a strategy on a universe of stocks all at once, like: "Buy when it goes down 3 days in a row. Test on AAPL, TSLA, DIS"
Hedged Backtest: We run your backtest as usual, but automatically hedge the trades so the strategy is market-neutral. To do this, include hedge=true in your prompt like "Buy AAPL when the price goes down 5 times in a row, hedge=true". There are 2 reasons you might want to do this. First, no matter how good your strategy is, it can easily lose money if the market moves against you. Hedging protects you from big market moves. Second, if your strategy involves mostly buy orders, it will probably show a good profit because the stock market has gone up so much during the time period of the backtest. For example, almost any strategy that involved buying AAPL in the past 10 years would have made a big profit because AAPL has consistently increased in price. With hedging, if the strategy says to buy AAPL, for that same period of time we sell short an equal amount of SPY (this is an ETF that represents the general stock market). That way if the market goes down and causes AAPL to go down, you will make money shorting SPY to offset the AAPL loss.
Pair Trading: A market-neutral strategy (meaning it does not matter if the overall market goes up or down) like "Buy PEP and sell short COKE when they diverge by a threshold of more than 1%." The concept of pair trading is that two related stocks, such as Coke and Pepsi, usually move together (their prices are highly correlated). If for some reason the prices diverge, you short the outperforming stock and go long the underperforming one, hoping the price spread will eventually revert back to the mean.
Pair Basket Basket Trading: This is like pair trading, but it picks the pair of stocks from a bigger group of stocks like "Buy the stock that went down the most yesterday, sell the stock that
went up the most yesterday. The universe of stocks to use for this is AAPL, DIS, MSFT, AA, VZ, META."
Coming Soon - Algorithmic Portfolio Trading: Where you always have your money invested in something, but the strategy decides when you move in and out of various stocks and ETFs.
Coming Soon - Preprogrammed Strategies: You will be able to backtest a bunch of well-known strategies from stock investment books and newsletters, and optionally mix those with your own strategies.
Coming Soon - Crypto, FX, and Futures: We are working on adding these to the site.
Coming Soon - Paper Trading: Register for a free account and you can save your favorite strategies to forward-test them. Track the profit/loss each new day, as if you had invested in the strategy for real.
Coming Soon - AI Portfolio Investing: Where the AI recommends a group of stocks for you to buy and hold based on criteria that you specify. For example, you might ask the AI to create a stock portfolio based on your own
prediction of the future economic and political environment. There is no backtesting for this, it is buy and hold so it needs to be tested with paper trading or live trading. An example would be: "I think the stock market might go down so I want to play
it safe and invest in stocks that are safe. Please output a list of the top 10 safe stocks for me to buy." Another example would be "I want you to create a stock trading strategy based on the following predictions:
1. There will be hyperinflation.
2. The AI industry will grow significantly.
3. The Russia/Ukraine war will go on for years.
4. Global warming will get worse.
Available Technical Indicators:
ADX - Average Directional Movement Index
ADXR - Average Directional Movement Index Rating
APO - Absolute Price Oscillator
AROON - Aroon
AROONOSC - Aroon Oscillator
BOP - Balance Of Power
CCI - Commodity Channel Index
CMO - Chande Momentum Oscillator
DX - Directional Movement Index
MACD - Moving Average Convergence/Divergence
MACDEXT - MACD with controllable MA type
MACDFIX - Moving Average Convergence/Divergence Fix 12/26
MFI - Money Flow Index
MINUS_DI - Minus Directional Indicator
MINUS_DM - Minus Directional Movement
MOM - Momentum
PLUS_DI - Plus Directional Indicator
PLUS_DM - Plus Directional Movement
PPO - Percentage Price Oscillator
ROC - Rate of change : ((price/prevPrice)-1)*100
ROCP - Rate of change Percentage: (price-prevPrice)/prevPrice
ROCR - Rate of change ratio: (price/prevPrice)
ROCR100 - Rate of change ratio 100 scale: (price/prevPrice)*100
RSI - Relative Strength Index
STOCH - Stochastic
STOCHF - Stochastic Fast
STOCHRSI - Stochastic Relative Strength Index
TRIX - 1-day Rate-Of-Change (ROC) of a Triple Smooth EMA
ULTOSC - Ultimate Oscillator
WILLR - Williams' %R
BBANDS - Bollinger Bands
DEMA - Double Exponential Moving Average
EMA - Exponential Moving Average
HT_TRENDLINE - Hilbert Transform - Instantaneous Trendline
KAMA - Kaufman Adaptive Moving Average
MA - Moving average
MAMA - MESA Adaptive Moving Average
MAVP - Moving average with variable period
MIDPOINT - MidPoint over period
MIDPRICE - Midpoint Price over period
SAR - Parabolic SAR
SAREXT - Parabolic SAR - Extended
SMA - Simple Moving Average
T3 - Triple Exponential Moving Average (T3)
TEMA - Triple Exponential Moving Average
TRIMA - Triangular Moving Average
WMA - Weighted Moving Average
AD Chaikin A/D Line
ADOSC Chaikin A/D Oscillator
OBV On Balance Volume
HT_DCPERIOD - Hilbert Transform - Dominant Cycle Period
HT_DCPHASE - Hilbert Transform - Dominant Cycle Phase
HT_PHASOR - Hilbert Transform - Phasor Components
HT_SINE - Hilbert Transform - SineWave
HT_TRENDMODE - Hilbert Transform - Trend vs Cycle Mode
AVGPRICE - Average Price
MEDPRICE - Median Price
TYPPRICE - Typical Price
WCLPRICE - Weighted Close Price
ATR - Average True Range
NATR - Normalized Average True Range
TRANGE - True Range
CDL2CROWS - Two Crows
CDL3BLACKCROWS - Three Black Crows
CDL3INSIDE - Three Inside Up/Down
CDL3LINESTRIKE - Three-Line Strike
CDL3OUTSIDE - Three Outside Up/Down
CDL3STARSINSOUTH - Three Stars In The South
CDL3WHITESOLDIERS - Three Advancing White Soldiers
CDLABANDONEDBABY - Abandoned Baby
CDLADVANCEBLOCK - Advance Block
CDLBELTHOLD - Belt-hold
CDLBREAKAWAY - Breakaway
CDLCLOSINGMARUBOZU - Closing Marubozu
CDLCONCEALBABYSWALL - Concealing Baby Swallow
CDLCOUNTERATTACK - Counterattack
CDLDARKCLOUDCOVER - Dark Cloud Cover
CDLDOJI - Doji
CDLDOJISTAR - Doji Star
CDLDRAGONFLYDOJI - Dragonfly Doji
CDLENGULFING - Engulfing Pattern
CDLEVENINGDOJISTAR - Evening Doji Star
CDLEVENINGSTAR - Evening Star
CDLGAPSIDESIDEWHITE - Up/Down-gap side-by-side white lines
CDLGRAVESTONEDOJI - Gravestone Doji
CDLHAMMER - Hammer
CDLHANGINGMAN - Hanging Man
CDLHARAMI - Harami Pattern
CDLHARAMICROSS - Harami Cross Pattern
CDLHIGHWAVE - High-Wave Candle
CDLHIKKAKE - Hikkake Pattern
CDLHIKKAKEMOD - Modified Hikkake Pattern
CDLHOMINGPIGEON - Homing Pigeon
CDLIDENTICAL3CROWS - Identical Three Crows
CDLINNECK - In-Neck Pattern
CDLINVERTEDHAMMER - Inverted Hammer
CDLKICKING - Kicking
CDLKICKINGBYLENGTH - Kicking - bull/bear determined by the longer marubozu
CDLLADDERBOTTOM - Ladder Bottom
CDLLONGLEGGEDDOJI - Long Legged Doji
CDLLONGLINE - Long Line Candle
CDLMARUBOZU - Marubozu
CDLMATCHINGLOW - Matching Low
CDLMATHOLD - Mat Hold
CDLMORNINGDOJISTAR - Morning Doji Star
CDLMORNINGSTAR - Morning Star
CDLONNECK - On-Neck Pattern
CDLPIERCING - Piercing Pattern
CDLRICKSHAWMAN - Rickshaw Man
CDLRISEFALL3METHODS - Rising/Falling Three Methods
CDLSEPARATINGLINES - Separating Lines
CDLSHOOTINGSTAR - Shooting Star
CDLSHORTLINE - Short Line Candle
CDLSPINNINGTOP - Spinning Top
CDLSTALLEDPATTERN - Stalled Pattern
CDLSTICKSANDWICH - Stick Sandwich
CDLTAKURI - Takuri (Dragonfly Doji with very long lower shadow)
CDLTASUKIGAP - Tasuki Gap
CDLTHRUSTING - Thrusting Pattern
CDLTRISTAR - Tristar Pattern
CDLUNIQUE3RIVER - Unique 3 River
CDLUPSIDEGAP2CROWS - Upside Gap Two Crows
CDLXSIDEGAP3METHODS - Upside/Downside Gap Three Methods
BETA - Beta
CORREL - Pearson's Correlation Coefficient (r)
LINEARREG - Linear Regression
LINEARREG_ANGLE - Linear Regression Angle
LINEARREG_INTERCEPT - Linear Regression Intercept
LINEARREG_SLOPE - Linear Regression Slope
STDDEV - Standard Deviation
TSF - Time Series Forecast
VAR - Variance