OPEN-SOURCE SCRIPT

Turn of the Month Strategy on Steroids

█ STRATEGY DESCRIPTION
The "Turn of the Month Strategy on Steroids" is a seasonal mean-reversion strategy designed to capitalize on price movements around the end of the month. It enters a long position when specific conditions are met and exits when the Relative Strength Index (RSI) indicates overbought conditions. This strategy is optimized for use on daily or higher timeframes.

█ WHAT IS THE TURN OF THE MONTH EFFECT?
The Turn of the Month effect refers to the observed tendency of stock prices to rise around the end of the month. This strategy leverages this phenomenon by entering long positions when the price shows signs of a reversal during this period.

█ SIGNAL GENERATION
1. LONG ENTRY
A Buy Signal is triggered when:
  • The current day of the month is greater than or equal to the specified `dayOfMonth` threshold (default is 25).
  • The close price is lower than the previous day's close (`close < close[1]`).
  • The previous day's close is also lower than the close two days ago (`close[1] < close[2]`).
  • The signal occurs within the specified time window (between `Start Time` and `End Time`).
  • There is no existing open position (`strategy.position_size == 0`).


2. EXIT CONDITION
  • A Sell Signal is generated when the 2-period RSI exceeds 65, indicating overbought conditions. This prompts the strategy to exit the position.


█ ADDITIONAL SETTINGS
  • Day of Month: The day of the month threshold for triggering a Buy Signal. Default is 25.
  • Start Time and End Time: The time window during which the strategy is allowed to execute trades.


█ PERFORMANCE OVERVIEW
  • This strategy is designed to exploit seasonal price patterns around the end of the month.
  • It performs best in markets where the Turn of the Month effect is pronounced.
  • Backtesting results should be analyzed to optimize the `dayOfMonth` threshold and RSI parameters for specific instruments.
Breadth IndicatorsChart patternsCyclesdaytradingIndicesmeanreversionmonthQQQreversalSPDR S&P 500 ETF (SPY) Stocksswingtrading

开源脚本

本着真正的TradingView精神,此脚本的作者已将其开源,以便交易者可以理解和验证它。向作者致敬!您可以免费使用它,但在出版物中重复使用此代码受网站规则约束。 您可以收藏它以在图表上使用。

想在图表上使用此脚本?

免责声明