OPEN-SOURCE SCRIPT
12M Return Strategy

This strategy is based on the original Dual Momentum concept presented by Gary Antonacci in his book “Dual Momentum Investing.”
It implements the absolute momentum portion of the framework using a 12-month rate of change, combined with a moving-average filter for trend confirmation.
The script automatically adapts the lookback period depending on chart timeframe, ensuring the return calculation always represents approximately one year, whether you are on daily, weekly, or monthly charts.
How the Strategy Works
1. 12-Month Return Calculation
The core signal is the 12-month price return, computed as:
(Current Price ÷ Price from ~1 year ago) − 1
This return:
Plots as a histogram
Turns green when positive
Turns red when negative
The lookback adjusts automatically:
1D chart → 252 bars
1W chart → 52 bars
1M chart → 12 bars
Other timeframes → estimated to approximate 1 calendar year
2. Trend Filter (Moving Average of Return)
To smooth volatility and avoid noise, the strategy applies a moving average to the 12M return:
Default length: 12 periods
Plotted as a white line on the indicator panel
This becomes the benchmark used for crossovers.
3. Trade Signals (Long / Short / Cash)
Trades are generated using a simple crossover mechanism:
Bullish Signal (Go Long)
When:
12M Return crosses ABOVE its MA
Action:
Close short (if any)
Enter long
Bearish Signal (Go Short or Go Flat)
When:
12M Return crosses BELOW its MA
Action:
If shorting is enabled → Enter short
If shorting is disabled → Exit position and go to cash
Shorting can be enabled or disabled with a single input switch.
4. Position Sizing
The strategy uses:
Percent of Equity position sizing
You can specify the percentage of your portfolio to allocate (default 100%).
No leverage is required, but the strategy supports it if your account settings allow.
5. Visual Signals
To improve clarity, the strategy marks signals directly on the indicator panel:
Green Up Arrows: return > MA
Red Down Arrows: return < MA
A status label shows the current mode:
LONG
SHORT
CASH
6. Backtest-Ready
This script is built as a full TradingView strategy, not just an indicator.
This means you can:
Run complete backtests
View performance metrics
Compare long-only vs long/short behavior
Adjust inputs to tune the system
It provides a clean, rule-driven interpretation of the classic absolute momentum approach.
Inspired By: Gary Antonacci – Dual Momentum Investing
This script reflects the absolute momentum side of Antonacci’s original research:
Uses 12-month momentum (the most statistically validated lookback)
Applies a trend-following overlay to control downside risk
Recreates the classic signal structure used in academic studies
It is a simplified, transparent version intended for practical use and educational clarity.
Disclaimer
This script is for educational and research purposes only.
Historical performance does not guarantee future results.
Always use proper risk management.
It implements the absolute momentum portion of the framework using a 12-month rate of change, combined with a moving-average filter for trend confirmation.
The script automatically adapts the lookback period depending on chart timeframe, ensuring the return calculation always represents approximately one year, whether you are on daily, weekly, or monthly charts.
How the Strategy Works
1. 12-Month Return Calculation
The core signal is the 12-month price return, computed as:
(Current Price ÷ Price from ~1 year ago) − 1
This return:
Plots as a histogram
Turns green when positive
Turns red when negative
The lookback adjusts automatically:
1D chart → 252 bars
1W chart → 52 bars
1M chart → 12 bars
Other timeframes → estimated to approximate 1 calendar year
2. Trend Filter (Moving Average of Return)
To smooth volatility and avoid noise, the strategy applies a moving average to the 12M return:
Default length: 12 periods
Plotted as a white line on the indicator panel
This becomes the benchmark used for crossovers.
3. Trade Signals (Long / Short / Cash)
Trades are generated using a simple crossover mechanism:
Bullish Signal (Go Long)
When:
12M Return crosses ABOVE its MA
Action:
Close short (if any)
Enter long
Bearish Signal (Go Short or Go Flat)
When:
12M Return crosses BELOW its MA
Action:
If shorting is enabled → Enter short
If shorting is disabled → Exit position and go to cash
Shorting can be enabled or disabled with a single input switch.
4. Position Sizing
The strategy uses:
Percent of Equity position sizing
You can specify the percentage of your portfolio to allocate (default 100%).
No leverage is required, but the strategy supports it if your account settings allow.
5. Visual Signals
To improve clarity, the strategy marks signals directly on the indicator panel:
Green Up Arrows: return > MA
Red Down Arrows: return < MA
A status label shows the current mode:
LONG
SHORT
CASH
6. Backtest-Ready
This script is built as a full TradingView strategy, not just an indicator.
This means you can:
Run complete backtests
View performance metrics
Compare long-only vs long/short behavior
Adjust inputs to tune the system
It provides a clean, rule-driven interpretation of the classic absolute momentum approach.
Inspired By: Gary Antonacci – Dual Momentum Investing
This script reflects the absolute momentum side of Antonacci’s original research:
Uses 12-month momentum (the most statistically validated lookback)
Applies a trend-following overlay to control downside risk
Recreates the classic signal structure used in academic studies
It is a simplified, transparent version intended for practical use and educational clarity.
Disclaimer
This script is for educational and research purposes only.
Historical performance does not guarantee future results.
Always use proper risk management.
开源脚本
秉承TradingView的精神,该脚本的作者将其开源,以便交易者可以查看和验证其功能。向作者致敬!您可以免费使用该脚本,但请记住,重新发布代码须遵守我们的网站规则。
免责声明
这些信息和出版物并非旨在提供,也不构成TradingView提供或认可的任何形式的财务、投资、交易或其他类型的建议或推荐。请阅读使用条款了解更多信息。
开源脚本
秉承TradingView的精神,该脚本的作者将其开源,以便交易者可以查看和验证其功能。向作者致敬!您可以免费使用该脚本,但请记住,重新发布代码须遵守我们的网站规则。
免责声明
这些信息和出版物并非旨在提供,也不构成TradingView提供或认可的任何形式的财务、投资、交易或其他类型的建议或推荐。请阅读使用条款了解更多信息。