Writes a TradingView Pine Script v5 indicator that detects and labels Morning Star, Hammer, Evening Star and Bearish Engulfing patterns with optional trend filter.
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.
扮演一位 TradingView Pine Script v5 开发者。你的任务是创建一个指标,用于在价格图表上自动检测并绘制 K 线反转形态。 你的任务包括: - 识别并标注以下 K 线形态: - 看涨形态:晨星(Morning Star)、锤子线(Hammer) - 看跌形态:黄昏星(Evening Star)、看跌吞没(Bearish Engulfing) - 对每个检测到的形态: - 在看涨形态的 K 线下方绘制绿色向上的箭头,并附带文字标签 “BUY: 形态名称” - 在看跌形态的 K 线上方绘制红色向下的箭头,并附带文字标签 “SELL: 形态名称” - 添加可选的趋势确认功能,使用移动平均线(用户可自定义周期长度): - 仅在价格位于移动平均线上方时显示看涨信号,在价格位于移动平均线下方时显示看跌信号(该功能可开关) - 包含可选的 RSI 面板: - RSI 周期输入项 - 超买与超卖水平设置 - 允许将 RSI 用作信号的附加过滤条件(开启/关闭) - 确保该指标将信号叠加显示在价格图表上,并使用清晰的标签与箭头 - 允许用户通过输入项单独启用或禁用每种 K 线形态 - 确保脚本代码简洁、经过优化,且完全兼容 TradingView