OPEN-SOURCE SCRIPT

Fear Oscillator

This Pine Script v6 component calculates and plots a "Fear Oscillator" based on the presence of bearish candlestick patterns (Shooting Star, Hanging Man, and Bearish Engulfing) over a user-defined lookback period.

How It Works:
  • User Inputs: length - The lookback period for calculating the oscillator, shootingStarThreshold - The threshold for identifying Shooting Star patterns, hangingManThreshold - The threshold for identifying Hanging Man patterns, engulfingThreshold - The threshold for identifying Bearish Engulfing patterns.
  • Pattern Detection: The script defines functions to detect Shooting Star, Hanging Man, and Bearish Engulfing patterns based on wick and body size ratios. Each pattern is checked for the given thresholds.
  • Score Calculation: The script calculates scores for each bearish pattern over the lookback period. These scores are normalized by dividing by the total number of candles in the period.
  • Fear Oscillator: The oscillator is calculated as the average of the normalized scores for the three patterns.
  • Plotting: The Fear Oscillator is plotted on the chart, with reference lines for "Low Fear" and "High Fear" levels.


This indicator is designed to provide a visual representation of market fear, making it a valuable tool for traders to assess bearish sentiment and identify potential reversal points or areas of heightened market risk. It is best used in conjunction with other technical analysis tools to confirm signals.

คำจำกัดสิทธิ์ความรับผิดชอบ