OPEN-SOURCE SCRIPT
Estrategia Timing SMA 10 de Faber

Introduction This strategy is based on the classic trend-following logic popularized by Meb Faber in his white papers (such as "A Quantitative Approach to Tactical Asset Allocation") and frequently discussed by financial analyst José Luis Cárpatos. The core philosophy is simple but effective: stay in the market during uptrends to capture growth, and move to cash during downtrends to protect capital from major drawdowns.
This is a long-term "Timing" strategy designed for investors who want to filter out market noise and focus on the primary macro trend.
How it Works The strategy utilizes a specific Moving Average on a Monthly timeframe to determine the trend direction.
The Indicator: A 10-period Simple Moving Average (SMA) calculated on the Monthly timeframe (1M).
Long Condition: When the Monthly Close price is above the 10-Month SMA, the strategy enters a Long position (Risk On).
Exit Condition (Cash): When the Monthly Close price falls below the 10-Month SMA, the strategy closes the position and stays in Cash (Risk Off). It does not open short positions; it simply exits the market to preserve capital.
Key Features (Multi-Timeframe) This script has been coded using request.security to force the calculation on Monthly data (1M), regardless of the chart timeframe you are currently viewing.
This allows you to view the strategy on a Daily or Weekly chart while ensuring the mathematical logic remains strictly bound to the Monthly moving average.
The SMA line will appear "stepped" on lower timeframes (e.g., Daily), representing the constant value of the SMA for that specific month.
Settings
Length: Default is 10 (representing 10 Months), but this can be adjusted if you wish to test other periods (e.g., 12 months).
Source: Defaults to close.
Visuals
Blue Line: Represents the 10-Month SMA.
Background Color:
Green: Indicates the strategy is currently Long (Price > SMA).
Red/Grey: Indicates the strategy is in Cash (Price < SMA).
Important Note on Backtesting & Repainting Because this strategy requests Monthly data on lower timeframes (like Daily), please be aware that the current month's data is dynamic. The signal is technically confirmed only at the close of the monthly bar. When viewing on a Daily chart, the script evaluates the relationship between the current price and the current monthly SMA.
Disclaimer This script is for educational and research purposes only. Past performance is not indicative of future results. Always manage your risk appropriately.
This is a long-term "Timing" strategy designed for investors who want to filter out market noise and focus on the primary macro trend.
How it Works The strategy utilizes a specific Moving Average on a Monthly timeframe to determine the trend direction.
The Indicator: A 10-period Simple Moving Average (SMA) calculated on the Monthly timeframe (1M).
Long Condition: When the Monthly Close price is above the 10-Month SMA, the strategy enters a Long position (Risk On).
Exit Condition (Cash): When the Monthly Close price falls below the 10-Month SMA, the strategy closes the position and stays in Cash (Risk Off). It does not open short positions; it simply exits the market to preserve capital.
Key Features (Multi-Timeframe) This script has been coded using request.security to force the calculation on Monthly data (1M), regardless of the chart timeframe you are currently viewing.
This allows you to view the strategy on a Daily or Weekly chart while ensuring the mathematical logic remains strictly bound to the Monthly moving average.
The SMA line will appear "stepped" on lower timeframes (e.g., Daily), representing the constant value of the SMA for that specific month.
Settings
Length: Default is 10 (representing 10 Months), but this can be adjusted if you wish to test other periods (e.g., 12 months).
Source: Defaults to close.
Visuals
Blue Line: Represents the 10-Month SMA.
Background Color:
Green: Indicates the strategy is currently Long (Price > SMA).
Red/Grey: Indicates the strategy is in Cash (Price < SMA).
Important Note on Backtesting & Repainting Because this strategy requests Monthly data on lower timeframes (like Daily), please be aware that the current month's data is dynamic. The signal is technically confirmed only at the close of the monthly bar. When viewing on a Daily chart, the script evaluates the relationship between the current price and the current monthly SMA.
Disclaimer This script is for educational and research purposes only. Past performance is not indicative of future results. Always manage your risk appropriately.
Mã nguồn mở
Theo đúng tinh thần TradingView, tác giả của tập lệnh này đã công bố nó dưới dạng mã nguồn mở, để các nhà giao dịch có thể xem xét và xác minh chức năng. Chúc mừng tác giả! Mặc dù bạn có thể sử dụng miễn phí, hãy nhớ rằng việc công bố lại mã phải tuân theo Nội quy.
Thông báo miễn trừ trách nhiệm
Thông tin và các ấn phẩm này không nhằm mục đích, và không cấu thành, lời khuyên hoặc khuyến nghị về tài chính, đầu tư, giao dịch hay các loại khác do TradingView cung cấp hoặc xác nhận. Đọc thêm tại Điều khoản Sử dụng.
Mã nguồn mở
Theo đúng tinh thần TradingView, tác giả của tập lệnh này đã công bố nó dưới dạng mã nguồn mở, để các nhà giao dịch có thể xem xét và xác minh chức năng. Chúc mừng tác giả! Mặc dù bạn có thể sử dụng miễn phí, hãy nhớ rằng việc công bố lại mã phải tuân theo Nội quy.
Thông báo miễn trừ trách nhiệm
Thông tin và các ấn phẩm này không nhằm mục đích, và không cấu thành, lời khuyên hoặc khuyến nghị về tài chính, đầu tư, giao dịch hay các loại khác do TradingView cung cấp hoặc xác nhận. Đọc thêm tại Điều khoản Sử dụng.