Halloween effect?

Most are aware of the Haloween effect. It also appears to be effective, at least for periods:

I need help with a rule that will allow me to backtest the effect of this seasonal fluctuation.

So, from October to April, the strategy solely picks stocks from the following sectors:
INDUSTRIAL is the sector.
CYCLICALS is a sector.
MATERIALS = Sector

From May through September, the strategy solely invests in stocks from the following sectors:
HEALTHCARE is the industry sector.
NONCYCLICAL SECTOR

I’ve looked over the rules here,(https://www.portfolio123.com/app/opener/SCR/search) but I haven’t found any that are exactly what I’m searching for.

Anyone have any ideas (ore rules) on how to solve this?

Something like this, but in one strategy:
month> 5 AND month <10
Sector = NONCYCLICAL or Sector = HEALTHCARE or Sector = UTIL
month> 9 OR month<5
Sector = MATERIALS or Sector = INDUSTRIAL or Sector = CYCLICALS

[Buy1] Eval(between(Month,5,10),RBICS(NONCYCLICAL, HEALTHCARE),True)
[Buy2] Eval(between(Month,11,12),RBICS(CYCLICALS,Materials,Industrial),True)
[Buy3] Eval(between(Month,1,4),RBICS(CYCLICALS,Materials,Industrial),True)

Thank you Gorge! Is it possible to convert this code so I can use it in the “screen backtester”.

I was able to execute it on the backtest screen by dividing it into two runs. By first trying Month 4,9, then Month 10,12, or Month 1,4 and then combining them.

“Between(Month,4,9)
Sector = NONCYCLICAL or Sector = HEALTHCARE or Sector = UTIL”

And then run this;

“Between(Month,10,12) or Between(Month,1,4)
Sector = MATERIALS or Sector = INDUSTRIAL or Sector = CYCLICALS”

But im not sure how to combine them so I can get a full year test in the backtest “Screen”.

I combined Georg’s rules into one line:
Eval(between(Month,5,10),RBICS(NONCYCLICAL, HEALTHCARE),RBICS(CYCLICALS,Materials,Industrial))

This did very well upto January 2019, and then it went pear-shaped. I suppose that when Covid struck in March and April 2020, you would have been better off with the NonCyclical and Healthcare sectors.

1 Like

Thank you so much, dodge. Just to be certain, as I am still fresh to the code. Does this work with the screen backtest? (Eval(between(Month,5,10),RBICS(NONCYCLICAL, HEALTHCARE),RBICS(CYCLICALS,Materials,Industrial))

1 Like

This rule with ranking system “Core Combination” works well. The screener shows a 17% annualized return from 1999 to 2022 for a 10 position model. Rebalance every 4 weeks, and Slippage 0.12%. Universe is S&P 500.
All one has to still do is to apply a market timer to get rid of the large drawdown of 2020.

Eval(between(Month,5,10),RBICS(NONCYCLICAL,HEALTHCARE,CONSUMERSVCE), RBICS(CYCLICALS,MATERIALS,INDUSTRIAL,FINANCIAL,ENERGY,BIZSVCE))

Im not sure why, but Im not getting very good result when using it in Screen Backtest, and with the sentiment ranking system:

Here in the Screen Backtester with Core ranking: