Strategy
This strategy is backtested on daily OHLCV price data across major US equity indices and ETFs. Entry and exit signals are generated from the strategy's indicators with no lookahead bias — trades execute at the open of the bar following the signal.
Performance metrics are computed per symbol and shown individually. The parameter optimization section (where available) runs a grid search over the strategy's key parameters, optimizing for Sharpe ratio. Transaction costs and slippage are not modeled.
The signal logic and indicator code for this strategy is shown in the methodology code section below.
Accumulation/Distribution Line tracks cumulative money flow. When the A/D line rises above its moving average, it signals institutional accumulation. Enters long on that cross, exits when A/D drops below its MA.
class ADLineTrend(Strategy):
n = 20
def init(self):
ad = _ad_line(self.data.High, self.data.Low, self.data.Close, self.data.Volume)
self.ad = self.I(lambda: ad, name="AD")
self.ad_ma = self.I(_sma, ad, self.n)
def next(self):
if self.ad[-1] > self.ad_ma[-1] and not self.position: self.buy()
elif self.ad[-1] < self.ad_ma[-1] and self.position: self.position.close()| Total return | +112.41% |
| Net profit | $1,124,103 |
| Gross profit | $1,172,615 |
| Gross loss | $888,015 |
| CAGR | +6.25% |
| Annualized return | +6.25% |
| Monthly average return | +0.51% |
| Median monthly return | +1.08% |
| Best month return | +4.95% |
| Worst month return | -4.68% |
| Rolling 1-month return | +7.72% |
| Return per trade | +0.23 |
| Log return CAGR | +12.49% |
| Compounded vs simple return difference | -110.13% |
54 trades · green dashes = buy entries · red dashes = sell exits
| Total return | +20.95% |
| Net profit | $209,541 |
| Gross profit | $941,463 |
| Gross loss | $703,005 |
| CAGR | +5.93% |
| Annualized return | +5.93% |
| Monthly average return | +0.54% |
| Median monthly return | +2.07% |
| Best month return | +4.13% |
| Worst month return | -4.36% |
| Rolling 1-month return | +4.45% |
| Return per trade | +0.34 |
| Log return CAGR | +7.98% |
| Compounded vs simple return difference | -17.89% |
Drawdown and rolling Sharpe for one symbol at a time appear in the equity charts above. This section adds strategy-specific views: how each index run for ad-line-trend sits in risk–return space, engine stop / take-profit settings when present, and per-trade MAE/MFE when OHLC trade stats exist in the JSON. Older static portfolio PNGs aggregated every strategy; these plots are scoped to this strategy only.
Stop loss / take-profit (this run)
These rules were applied when opening positions: fixed stop and take-profit prices from entry (backtesting.py sl / tp), plus an optional maximum hold in bars. They change realized outcomes versus signal-only exits; curves and metrics on this page already reflect them.
SL/TP combinations (this strategy)
These are strategy-specific SL/TP combinations from the sensitivity sweep. The best Sharpe combination is highlighted.
Best Sharpe combo: SL 5% / TP 0% (0.32)
| SL | TP | Sharpe | Return | Max DD | Win % |
|---|---|---|---|---|---|
| 5% | 0% | 0.32 | 22.45% | 22.30% | 33.33% |
| 5% | 15% | 0.31 | 21.99% | 22.30% | 34.69% |
| 7% | 0% | 0.31 | 21.99% | 22.27% | 32.61% |
| 7% | 10% | 0.31 | 21.66% | 22.60% | 32.00% |
| 3% | 0% | 0.30 | 21.40% | 20.82% | 32.00% |
| 7% | 15% | 0.30 | 21.52% | 22.27% | 34.04% |
| 3% | 15% | 0.30 | 21.11% | 20.82% | 33.33% |
| 5% | 10% | 0.30 | 20.95% | 23.36% | 31.48% |
| 3% | 10% | 0.29 | 20.17% | 21.76% | 30.36% |
| 5% | 5% | 0.27 | 18.43% | 21.50% | 39.06% |
| 0% | 0% | 0.24 | 17.46% | 22.27% | 32.61% |
| 7% | 5% | 0.24 | 16.76% | 22.28% | 40.32% |
| 0% | 10% | 0.24 | 17.15% | 22.60% | 32.00% |
| 3% | 5% | 0.24 | 16.47% | 20.71% | 37.31% |
| 0% | 15% | 0.24 | 16.98% | 22.27% | 34.04% |
| 0% | 5% | 0.19 | 13.09% | 21.82% | 38.98% |
Each row is one run for ad-line-trend. Values already include the stop / target / max-hold settings shown in the row.
| Symbol | Stop loss | Take profit | Max hold | Total return | Sharpe | Max DD |
|---|---|---|---|---|---|---|
| ^AXJO (S&P/ASX 200) | 5% | 10% | — | -9.78% | -0.34 | 23.13% |
| ^BSESN (BSE Sensex) | 5% | 10% | — | 18.34% | 0.36 | 13.76% |
| ^BVSP (Bovespa) | 5% | 10% | — | 1.84% | 0.03 | 21.83% |
| ^DJI (Dow Jones Industrial Average) | 5% | 10% | — | -4.18% | -0.11 | 20.94% |
| ^FCHI (CAC 40) | 5% | 10% | — | 18.63% | 0.30 | 18.84% |
| ^FTSE (FTSE 100) | 5% | 10% | — | 23.77% | 0.79 | 6.79% |
| ^GDAXI (DAX) | 5% | 10% | — | 6.88% | 0.15 | 16.67% |
| ^GSPC (S&P 500) | 5% | 10% | — | 20.95% | 0.35 | 23.36% |
| ^GSPTSE (TSX Composite) | 5% | 10% | — | 19.19% | 0.49 | 20.25% |
| ^HSI (Hang Seng) | 5% | 10% | — | 6.54% | 0.08 | 38.79% |
| ^IXIC (NASDAQ Composite) | 5% | 10% | — | 10.71% | 0.14 | 29.68% |
| ^KS11 (KOSPI) | 5% | 10% | — | 34.67% | 0.39 | 39.86% |
| ^MERV (Merval) | 5% | 10% | — | 2097.86% | 1.24 | 47.82% |
| ^N100 (Euronext 100) | 5% | 10% | — | 7.09% | 0.20 | 18.88% |
| ^N225 (Nikkei 225) | 5% | 10% | — | 2.83% | 0.04 | 30.03% |
| ^NSEI (Nifty 50) | 5% | 10% | — | 5.81% | 0.11 | 16.36% |
| ^RUT (Russell 2000) | 5% | 10% | — | -34.41% | -0.60 | 47.82% |
| ^SSMI (Swiss Market) | 5% | 10% | — | 34.24% | 1.20 | 7.15% |
| ^STOXX50E (Euro Stoxx 50) | 5% | 10% | — | -3.81% | -0.09 | 19.72% |
| ^TWII (Taiwan Weighted) | 5% | 10% | — | -8.95% | -0.17 | 26.57% |
One point per index run. X = worst drawdown magnitude (%), Y = Sharpe ratio. Compare how stable the edge is across regions — unlike the site-wide risk report PNGs, this uses only runs for ad-line-trend.
Each point is one trade: MAE = worst unrealized loss vs entry during the trade; MFE = best unrealized gain. Sample capped in JSON for payload size. With SL/TP enabled, many trades stop out before reaching prior MFE extremes — compare to metrics in the table above.
A/D Line Trend on ^GSPC. Objective: Sharpe Ratio. 4 runs. Metric:
Performance metrics for each index symbol tested with this strategy.
| Index | Country | Return % | Sharpe | Sortino | Max DD % | Win Rate % | Trades | Profit Factor | Volatility % |
|---|---|---|---|---|---|---|---|---|---|
| Merval | Argentina | +2097.86% | 1.24 | 3.81 | +47.82% | +48.82% | 170 | 1.84 | +36.93% |
| S&P/ASX 200 | Australia | -9.78% | -0.34 | -0.48 | +23.13% | +34.78% | 46 | 0.81 | +12.31% |
| Bovespa | Brazil | +1.84% | 0.03 | 0.04 | +21.83% | +32.14% | 84 | 1.08 | +11.50% |
| TSX Composite | Canada | +19.19% | 0.49 | 0.78 | +20.25% | +41.82% | 55 | 1.39 | +10.68% |
| Euro Stoxx 50 | Europe | -3.81% | -0.09 | -0.14 | +19.72% | +30.77% | 52 | 0.99 | +15.05% |
| Euronext 100 | Europe | +7.09% | 0.20 | 0.30 | +18.88% | +34.69% | 49 | 1.21 | +11.51% |
| CAC 40 | France | +18.63% | 0.30 | 0.69 | +18.84% | +34.48% | 58 | 1.38 | +18.25% |
| DAX | Germany | +6.88% | 0.15 | 0.23 | +16.67% | +32.61% | 46 | 1.21 | +15.06% |
| Hang Seng | Hong Kong | +6.54% | 0.08 | 0.11 | +38.79% | +36.76% | 68 | 1.13 | +16.96% |
| BSE Sensex | India | +18.34% | 0.36 | 0.53 | +13.76% | +32.84% | 67 | 1.36 | +9.42% |
| Nifty 50 | India | +5.81% | 0.11 | 0.16 | +16.36% | +29.89% | 87 | 1.13 | +9.99% |
| Nikkei 225 | Japan | +2.83% | 0.04 | 0.05 | +30.03% | +38.71% | 93 | 1.07 | +15.20% |
| KOSPI | South Korea | +34.67% | 0.39 | 0.61 | +39.86% | +35.64% | 101 | 1.33 | +15.16% |
| Swiss Market | Switzerland | +34.24% | 1.20 | 2.04 | +7.15% | +51.72% | 29 | 3.28 | +8.02% |
| Taiwan Weighted | Taiwan | -8.95% | -0.17 | -0.23 | +26.57% | +33.33% | 84 | 0.95 | +11.33% |
| FTSE 100 | UK | +23.77% | 0.79 | 1.46 | +6.79% | +43.90% | 41 | 2.03 | +8.84% |
| Dow Jones Industrial Average | US | -4.18% | -0.11 | -0.14 | +20.94% | +33.33% | 45 | 0.95 | +11.44% |
| NASDAQ Composite | US | +10.71% | 0.14 | 0.19 | +29.68% | +30.91% | 55 | 1.18 | +22.06% |
| Russell 2000 | US | -34.41% | -0.60 | -0.72 | +47.82% | +30.67% | 75 | 0.75 | +22.35% |
| S&P 500 | US | +20.95% | 0.35 | 0.58 | +23.36% | +31.48% | 54 | 1.34 | +16.00% |