PROTECTED SOURCE SCRIPT

[NBK] Cover Buy Sell

77
[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.

إخلاء المسؤولية

لا يُقصد بالمعلومات والمنشورات أن تكون، أو تشكل، أي نصيحة مالية أو استثمارية أو تجارية أو أنواع أخرى من النصائح أو التوصيات المقدمة أو المعتمدة من TradingView. اقرأ المزيد في شروط الاستخدام.