OPEN-SOURCE SCRIPT

Price Reaction Analysis by Day of Week

176
Overview

The "Price Reaction Analysis by Day of Week" indicator is a tool that enables traders to analyze historical price reaction patterns to technical indicator signals on a selected day of the week. It examines price behavior on a chosen candle (from 1 to 30) in the next day or subsequent days after a signal, depending on the timeframe, and provides success rate statistics to support data-driven trading decisions. The indicator is optimized for timeframes up to 1 day (e.g., 1D, 12H, 8H, 6H, 4H, 1H, 15M), as the analysis relies on day-of-week comparisons. Lower timeframes generate more signals due to the higher number of candles per day.

Key Features

1. Flexible Technical Indicator Selection

Users can choose one of four technical indicators: RSI, SMI, MA, or Bollinger Bands. Each indicator has configurable parameters, such as:
RSI length, oversold/overbought levels.
SMI length, %K and %D smoothing, signal levels.
MA length.
Bollinger Bands length and multiplier.

2. Day-of-Week Analysis

The indicator allows users to select a day of the week (Monday, Tuesday, Wednesday, Thursday, Friday) for generating signals. It analyzes price reactions on a selected candle (from 1 to 30) in the next day or subsequent days after the signal. Examples:

On a daily timeframe, a signal on Monday can be analyzed for the first, fourth, or later candle (up to 30) in subsequent days (e.g., Tuesday, Wednesday).

On timeframes lower than 1 day (e.g., 12H, 8H, 6H, 4H, 1H, 15M), the analysis targets the selected candle in the next day or subsequent days. For example, on a 4H timeframe, you can analyze the second Tuesday candle following a Monday signal. The maximum timeframe is 1 day to ensure consistent day-of-week analysis.

3. Visual Signals

Signals for the analysis period are marked with background highlights in real-time when the indicator’s conditions are met. The last highlighted candle of the selected day is always analyzed. Arrows are displayed on the chart at the candle specified by the “Candles to Compare” setting (e.g., the first candle if set to 1):

Green upward triangles (below the candle) for successful buy signals (the closing price of the selected candle is higher than the signal candle’s close).

Red downward triangles (above the candle) for successful sell signals (the closing price of the selected candle is lower than the signal candle’s close).

Gray “x” marks for unsuccessful signals (no price reversal in the expected direction). Arrow positions are intuitive: buy signals below the candle, sell signals above. Highlights and arrows do not require waiting for future signals but are essential for calculating statistics.
Note: The first candle of the next day may appear shifted on the chart due to timezone differences, which can affect the timing of signal appearance.

4. Signal Conditions (Highlights) for Each Indicator

RSI: The oscillator is in oversold (buy) or overbought (sell) zones.
SMI: SMI returns from oversold (buy) or overbought (sell) zones.
MA: Price crosses the MA (upward for buy, downward for sell).
Bollinger Bands: Price returns inside the bands (from below for buy, from above for sell).

5. Success Rate Statistics

A table in the top-right corner of the chart displays:

The number of buy and sell signals for the selected day of the week.
The percentage of cases where the price of the selected candle in the next day or subsequent days reversed as expected (e.g., rising after a buy signal). Statistics are based on comparing the closing price of the signal candle with the closing price of the selected candle (e.g., first, fourth) in the next day or subsequent days.
Important: Statistics do not account for price movements within the candle or after its close. The price on the selected candle (e.g., fourth) may be lower than earlier candles but still higher than the signal candle, counting as a positive buy signal, though it does not guarantee profit.

6. Date Range

Users can specify the analysis date range, enabling strategy testing on historical data from a chosen period. Ensure the start and end dates are set correctly.

Applications

The indicator is designed for traders who want to leverage historical patterns for position planning. Examples:

On a 4-hour timeframe: If a sell signal highlight appears on Monday and statistics show an 80% chance that the fourth Tuesday candle is bearish, traders may consider playing a correction at the open of that candle.

On a daily timeframe: If a highlight indicates market overheating, traders may consider entering a position at the open of the first candle after the signal (e.g., Tuesday), provided statistics suggest an edge. Users can analyze the signal on the first candle and check later candles to validate results, increasing confidence in consistent patterns.

Key Settings

Indicator Type: Choose between RSI, SMI, MA, or Bollinger Bands.
Selected Day: Monday, Tuesday, Wednesday, Thursday, or Friday.
Candles to Compare: The number of the candle in the next day or subsequent days (from 1 to 30).
Indicator Parameters: Lengths, levels (e.g., oversold/overbought for RSI).
Background Colors: Configurable highlights for buy and sell signals.

Notes

Timeframes: The indicator is optimized for timeframes up to 1 day (e.g., 1D, 12H, 8H, 6H, 4H, 1H, 15M), as the analysis relies on day-of-week patterns. Timeframes lower than 1 day generate more signals due to the higher number of candles per day.

Candle Shift: The first candle of the next day may appear shifted on the chart due to timezone differences, affecting the timing of signals across markets or platforms.

Statistical Limitations: Results are based on the closing prices of the selected candle, ignoring fluctuations in earlier candles, within the candle, or subsequent price movements. Traders must assess whether entering at the open or after the close of the selected candle is profitable.

Testing: Effectiveness depends on historical data and parameter settings. Testing different configurations across markets and timeframes is recommended.

Who Is It For?

Swing and position traders who base decisions on technical analysis and historical patterns.
Market analysts seeking patterns in price behavior by day of the week.
TradingView users of all experience levels, thanks to an intuitive interface and flexible settings.

Feragatname

Bilgiler ve yayınlar, TradingView tarafından sağlanan veya onaylanan finansal, yatırım, işlem veya diğer türden tavsiye veya tavsiyeler anlamına gelmez ve teşkil etmez. Kullanım Şartları'nda daha fazlasını okuyun.