Skip to main content
Prompts TradingView Pine Script Reversal Patterns Indicator

developer coding user risk: medium

TradingView Pine Script Reversal Patterns Indicator

Act as a TradingView Pine Script v5 developer to create an indicator that detects and plots bullish (Morning Star, Hammer) and bearish (Evening Star, Bearish Engulfing) candlestick…

  • Policy sensitive
  • Human review

PROMPT

Act as a TradingView Pine Script v5 developer. You are tasked with creating an indicator that automatically detects and plots candlestick reversal patterns on the price chart.

Your task is to:
- Identify and label the following candlestick patterns:
  - Bullish: Morning Star, Hammer
  - Bearish: Evening Star, Bearish Engulfing
- For each detected pattern:
  - Plot a green upward arrow below the candle for bullish patterns with the text “BUY: Pattern Name”
  - Plot a red downward arrow above the candle for bearish patterns with the text “SELL: Pattern Name”
- Add optional trend confirmation using a moving average (user-selectable length).
  - Only show bullish signals above the MA and bearish signals below the MA (toggleable).
- Include an optional RSI panel:
  - RSI length input
  - Overbought and oversold levels
  - Allow RSI to be used as an additional filter for signals (on/off)
- Ensure the indicator overlays signals on the price chart and uses clear labels and arrows
- Allow user inputs to enable/disable each candlestick pattern individually
- Make sure the script is clean, optimized, and fully compatible with TradingView.

ROLES & RULES

Role assignments

  • Act as a TradingView Pine Script v5 developer.
  1. Identify and label the following candlestick patterns: Bullish: Morning Star, Hammer. Bearish: Evening Star, Bearish Engulfing.
  2. Plot a green upward arrow below the candle for bullish patterns with the text “BUY: Pattern Name”.
  3. Plot a red downward arrow above the candle for bearish patterns with the text “SELL: Pattern Name”.
  4. Add optional trend confirmation using a moving average (user-selectable length).
  5. Only show bullish signals above the MA and bearish signals below the MA (toggleable).
  6. Include an optional RSI panel: RSI length input, Overbought and oversold levels, Allow RSI to be used as an additional filter for signals (on/off).
  7. Ensure the indicator overlays signals on the price chart and uses clear labels and arrows.
  8. Allow user inputs to enable/disable each candlestick pattern individually.
  9. Make sure the script is clean, optimized, and fully compatible with TradingView.

EXPECTED OUTPUT

Format
code
Constraints
  • Pine Script v5
  • clean and optimized
  • overlays signals on price chart
  • user inputs to enable/disable patterns, MA, RSI
  • clear labels and arrows

SUCCESS CRITERIA

  • Detect and label specified bullish and bearish candlestick patterns.
  • Plot arrows and text labels for signals.
  • Implement optional MA trend confirmation filter.
  • Implement optional RSI panel and filter.
  • Provide user inputs for enabling/disabling patterns, MA, and RSI.
  • Ensure script overlays on price chart, is clean, optimized, and TradingView compatible.

FAILURE MODES

  • May incorrectly define or detect candlestick patterns.
  • May misplace arrows or labels.
  • May omit user inputs or toggles.
  • May fail to implement filters correctly.
  • May produce non-optimized or incompatible code.

CAVEATS

Missing context
  • Detailed definitions or logic for candlestick pattern detection.
  • Default input values (e.g., MA/RSI lengths, OB/OS levels).
  • MA calculation method.
  • RSI filter conditions.
Ambiguities
  • Which candle to plot the arrow and label on for multi-candle patterns (e.g., Morning Star, Evening Star)?
  • Exact detection criteria for each pattern (e.g., body/wick ratios, gaps)?
  • MA type (SMA, EMA, etc.)?
  • Precise condition for trend confirmation (e.g., close > MA or low > MA for bullish)?
  • RSI filter logic (e.g., bullish only if RSI < oversold)?

QUALITY

OVERALL
0.75
CLARITY
0.90
SPECIFICITY
0.85
REUSABILITY
0.30
COMPLETENESS
0.75

IMPROVEMENT SUGGESTIONS

  • Provide precise mathematical or logical criteria for detecting each candlestick pattern.
  • Specify the exact bar for plotting arrows/labels in multi-bar patterns (e.g., the third bar).
  • Clarify MA type (e.g., 'SMA') and filter condition (e.g., 'close > ma for bullish').
  • Define RSI filter explicitly (e.g., 'bullish signals only if rsi < 30').
  • Add requirements for input groups or table for settings overview.

USAGE

Copy the prompt above and paste it into your AI of choice — Claude, ChatGPT, Gemini, or anywhere else you're working. Replace any placeholder sections with your own context, then ask for the output.

MORE FOR DEVELOPER