PROTECTED SOURCE SCRIPT
[NBK] Cover Buy Sell

[NBK] Cover Buy Sell — idea
Purpose
Detect high-quality engulfing turning points, but only when they align with a short-term trend.
Cover Buy = Bullish engulfing / piercing that appears in a short-term downtrend.
Cover Sell = Bearish engulfing (full-candle or body engulf / dark-cloud style) that appears in a short-term uptrend.
Signal logic
Bullish side
Body Engulf: current green body fully covers prior red body.
Piercing (relaxed): prior red → current green closes above prior body midpoint (≤ prior open).
Bearish side
Full Candle Engulf: current red candle (body+wicks) covers the entire prior candle.
Body Engulf: current red body covers prior body.
Dark Cloud (relaxed): prior green → current red closes below prior body midpoint.
Trend model (short-term, non-repainting)
EMA slope is measured between bar-1 and bar-2 and must exceed an ATR-scaled threshold:
Slope < 0 ⇒ downtrend (only Bull signals).
Slope > 0 ⇒ uptrend (only Bear signals).
Quality filters
Body filter: bodies must not be tiny. Compare each body to the average body over a lookback; for Bear signals an alternative check ensures current body ≥ a ratio of the prior body.
Peak filters (Bear only):
High must be far above EMA by a minimum fraction of ATR.
High must be near the local highest within a lookback (current or previous bar).
Close must break prior low by an ATR-scaled amount.
These remove premature “sell” flags in choppy ranges and keep the later, cleaner reversal.
Inputs to tune
lenTrend, slopeAtrPct, atrLen (trend strength)
lenBodyRef, minBodyPct, bearRatioMin (body size)
emaDistAtrMin, nearHighLen, nearHighTol, breakAtrMin (bearish peak confirmation)
Usage tips
To reduce early Cover Sell, raise emaDistAtrMin / nearHighLen / breakAtrMin.
If you miss good tops, nudge those down slightly.
Works on any symbol/TF; signals are evaluated on bar close; no repaint.
Includes alert conditions for both sides.
This is a screening tool, not financial advice. Combine with structure/levels and your risk plan.
Purpose
Detect high-quality engulfing turning points, but only when they align with a short-term trend.
Cover Buy = Bullish engulfing / piercing that appears in a short-term downtrend.
Cover Sell = Bearish engulfing (full-candle or body engulf / dark-cloud style) that appears in a short-term uptrend.
Signal logic
Bullish side
Body Engulf: current green body fully covers prior red body.
Piercing (relaxed): prior red → current green closes above prior body midpoint (≤ prior open).
Bearish side
Full Candle Engulf: current red candle (body+wicks) covers the entire prior candle.
Body Engulf: current red body covers prior body.
Dark Cloud (relaxed): prior green → current red closes below prior body midpoint.
Trend model (short-term, non-repainting)
EMA slope is measured between bar-1 and bar-2 and must exceed an ATR-scaled threshold:
Slope < 0 ⇒ downtrend (only Bull signals).
Slope > 0 ⇒ uptrend (only Bear signals).
Quality filters
Body filter: bodies must not be tiny. Compare each body to the average body over a lookback; for Bear signals an alternative check ensures current body ≥ a ratio of the prior body.
Peak filters (Bear only):
High must be far above EMA by a minimum fraction of ATR.
High must be near the local highest within a lookback (current or previous bar).
Close must break prior low by an ATR-scaled amount.
These remove premature “sell” flags in choppy ranges and keep the later, cleaner reversal.
Inputs to tune
lenTrend, slopeAtrPct, atrLen (trend strength)
lenBodyRef, minBodyPct, bearRatioMin (body size)
emaDistAtrMin, nearHighLen, nearHighTol, breakAtrMin (bearish peak confirmation)
Usage tips
To reduce early Cover Sell, raise emaDistAtrMin / nearHighLen / breakAtrMin.
If you miss good tops, nudge those down slightly.
Works on any symbol/TF; signals are evaluated on bar close; no repaint.
Includes alert conditions for both sides.
This is a screening tool, not financial advice. Combine with structure/levels and your risk plan.
Mã được bảo vệ
Tập lệnh này được đăng dưới dạng mã nguồn đóng. Tuy nhiên, bạn có thể tự do sử dụng tập lệnh mà không có bất kỳ hạn chế nào – tìm hiểu thêm tại đây.
Thông báo miễn trừ trách nhiệm
Thông tin và ấn phẩm không có nghĩa là và không cấu thành, tài chính, đầu tư, kinh doanh, hoặc các loại lời khuyên hoặc khuyến nghị khác được cung cấp hoặc xác nhận bởi TradingView. Đọc thêm trong Điều khoản sử dụng.
Mã được bảo vệ
Tập lệnh này được đăng dưới dạng mã nguồn đóng. Tuy nhiên, bạn có thể tự do sử dụng tập lệnh mà không có bất kỳ hạn chế nào – tìm hiểu thêm tại đây.
Thông báo miễn trừ trách nhiệm
Thông tin và ấn phẩm không có nghĩa là và không cấu thành, tài chính, đầu tư, kinh doanh, hoặc các loại lời khuyên hoặc khuyến nghị khác được cung cấp hoặc xác nhận bởi TradingView. Đọc thêm trong Điều khoản sử dụng.