ETF Regime Filter Testing Script

This script is useful for testing various regime filter ideas - such as Meb Faber's white paper on the 10-month SMA timing tool.

Check out my other free lessons!

Source Code

Import:
    DataSource:      Norgate
    IncludeList:      %3MTCM     {"3-Month Treasury Bill Constant Maturity"}
    IncludeList:     SPY     {"ETF"}
    //IncludeList:     EFA     {"ETF"}
    //IncludeList:     EWC     {"ETF"}
    StartDate:      Earliest
    EndDate:         Latest
    SaveAs:          ETF_Faber.rtd
    Adjustment:      TotalReturn   // dividend reinvest

Settings:
    DataFile:        ETF_Faber.rtd
    StartDate:       1/1/1993
    EndDate:         Latest
    AccountSize:     100000
    BarSize:         Monthly
    CashIntPct:    0.000001
    RiskFreeRateSym:    %3MTCM

Benchmark:     BuyAndHold
    Side:            Long
    QtyType:         Percent
    Quantity:        100
    EntryTime:       ThisClose
    EntrySetup:      InList("ETF")

Data:
    MonthlyClose:    Close
    RegimeFilterMA:    MA(Close, 10)
    RegimeFilter:     MonthlyClose > RegimeFilterMA
    
Strategy:     Faber
    Side:            Long
    MaxPositions:     1
    QtyType:         Percent
    Quantity:        100
    EntryTime:       ThisClose
    ExitTime:        ThisClose
    EntrySetup:      InList("ETF") and RegimeFilter and EndOfMonth
    ExitRule:        InList("ETF") and not RegimeFilter and EndOfMonth
    
Charts:
    RegimeFilterMA:    {#}    RegimeFilterMA