OPEN-SOURCE SCRIPT
Aggiornato

Engulfing Pattern[SpeculationLab]

554
Overview

This script detects two types of engulfing / outer bar patterns and marks them directly on the chart:
Body Engulfing – The current candle’s body range (open–close) completely covers the entire range (high–low) of the previous candle.
Range Engulfing – The current candle’s full range (high–low, including wicks) completely covers the entire range (high–low) of the previous candle.
Direction logic:
Bull – The previous candle is bearish and the selected engulfing rule is met.
Bear – The previous candle is bullish and the selected engulfing rule is met.
Optional: Require the current candle to have the opposite color of the previous one.
This is an open-source pattern recognition tool for learning, backtesting, and chart review. It is not financial advice.

Key Features
Two detection modes:
body – Body engulfs previous entire range
range – Wicks engulf previous entire range
Direction detection based on the previous candle’s color, with optional opposite-color confirmation
Chart markers: “BULL” /“BEAR” above bars
Alert-ready: built-in conditions for bullish and bearish engulfing patterns

Parameters
Engulfing Type: body / range
body: Current body must fully cover the previous candle’s high–low range
range: Current full range (high–low) must fully cover the previous candle’s high–low range
Require Opposite Previous Candle (default: off):
When enabled, the engulfing pattern must also have the opposite color from the previous candle to trigger

Usage Tips
Engulfing patterns are price action structures; combine with trend, key levels, and volume for context
Signals confirm on bar close (barstate.isconfirmed) to reduce repainting
Can be used with personal risk management rules (stop-loss, take-profit, filters)

Disclaimer
For educational and research purposes only – not financial advice
Past performance of patterns does not guarantee future results
Trading involves risk; always manage it responsibly
This script is open-source – feel free to learn from or modify it, but credit the original source and author (SpeculationLab)

脚本简介
本脚本用于识别两类包裹/外包形态,并在图表上以标记提示:
Body(实体包裹):当前K线的实体区间(开—收)完全覆盖上一根K线的整个区间(上一根的高—低)。
Range(影线外包):当前K线的影线区间(高—低)完全覆盖上一根K线的整个区间(上一根的高—低)。

方向判定:
Bull(多):上一根为阴线且满足所选包裹规则;
Bear(空):上一根为阳线且满足所选包裹规则;
可选项:要求“当前K线颜色与上一根相反”后再确认(见参数)。
本脚本为开源形态识别工具,适合技术分析学习、回测与复盘,不构成任何投资建议。

主要功能
两种识别模式:body(实体包裹上一根整段) / range(影线包裹上一根整段)。
方向识别:按上一根K线颜色判断多空;可选“当前颜色与上一根相反”的二次确认。
图表提示:plotshape 在K线上方标注 “BULL / BEAR”。
提醒支持:内置 Bullish Engulf / Bearish Engulf 提醒条件。

参数说明
Engulfing Type:body / range
body:当前实体须完全覆盖上一根的高—低整段;
range:当前高—低须完全覆盖上一根的高—低整段。
Require Opposite Previous Candle(默认关闭):
开启后,除满足包裹规则外,还需当前K线颜色与上一根相反才触发标记。

使用建议
包裹/外包是价格行为结构,建议结合趋势、关键价位、成交量等因素综合判断。
信号在收盘时确认(barstate.isconfirmed),以减少重绘干扰。
可与个人风格的风险控制规则(止损、止盈、过滤条件)配合使用。

合规与免责声明
本脚本仅用于技术研究与学习,不构成任何形式的投资建议或收益承诺。
历史形态并不代表未来结果,交易有风险,请自行评估并承担责任。
本脚本开源,欢迎学习与二次开发;转载或改用请注明来源与作者(SpeculationLab / 投机实验室)。

Note di rilascio
Optimized data panel display.

Declinazione di responsabilità

Le informazioni ed i contenuti pubblicati non costituiscono in alcun modo una sollecitazione ad investire o ad operare nei mercati finanziari. Non sono inoltre fornite o supportate da TradingView. Maggiori dettagli nelle Condizioni d'uso.