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. קרא עוד ב־תנאי השימוש.