PROTECTED SOURCE SCRIPT

CloverKnight

24
## CloverKnight (4H Inside Bar Breakout) — Description for Publishing

**CloverKnight** is a 4H-only inside-bar breakout indicator that identifies **Nested** or **Chained** inside-bar patterns (children candles inside a “mother” candle), then suggests a breakout entry with **EP / SL / TP** and shows a performance summary (Win/Draw/Loss, Win Rate, and ORPT) for a selected backtest window.

This script is designed for traders who want a clean, rule-based inside-bar breakout with optional filters and risk sizing calculations.

---

## What it does

### 1) Inside Bar Pattern Detection

CloverKnight detects inside-bar structures with two pattern styles:

* **Nested**: all child candles must be inside the same mother candle
* **Chained**: each child candle must be inside the previous candle

You control how many child candles are required via **Inside Bar Count**.

### 2) Direction Logic (Buy/Sell)

Direction can be determined by:

* **Last** candle direction
* **Mother** candle direction
* **Vote** (majority of bull/bear candles across mother + children)

You can also restrict trading signals via **Trade Side**:

* Both / Buy Only / Sell Only

### 3) Optional EMA200 Direction Filter

If enabled:

* Buy signals only when price is above EMA
* Sell signals only when price is below EMA

### 4) Day-of-Week Filter

You can allow or block signals by weekday (Mon–Sun).

### 5) Risk & Position Size Estimation

For each valid signal, the script calculates:

* **SL distance (pips)** based on mother range
* **Lot size** based on:

* Account Balance
* Risk per Trade (%)
* Pip Value per 1.0 lot (user input)

> Note: This is an estimation tool. Pip value depends on broker/symbol/contract size.

### 6) Trade Simulation & Outcome Tracking (Simple Backtest)

The script simulates a simplified trade lifecycle:

* Signal creates a **pending** breakout order
* Trade triggers when price hits EP
* Outcomes:

* **Win** if TP hit
* **Loss** if SL hit
* **Draw (BE)** if price reaches **+1R**, then returns to EP

### 7) Summary Table (Top Right)

A compact table shows:

* **W / D / L**
* **WR** (Win Rate)
* **MCL** (Max Consecutive Losses)
* **ORPT** (Optimized Risk Per Trade)

---

## Backtest Modes

### A) Years Mode

Backtest only within the last **X years** (default 5, max 10).
Stats reset when a new “Years window” begins.

### B) Trades Mode

Backtest based on last **N completed trades** (default 100, max 500).
This mode uses a rolling array of outcomes.

---

## Inputs (Quick Guide)

**Pattern**

* Inside Bar Count (Only Children)
* Inside Pattern Type: Nested / Chained
* Direction Source: Last / Mother / Vote
* Trade Side: Both / Buy Only / Sell Only

**Backtest**

* Backtest Mode: Years / Trades
* Lookback (Years) / Lookback (Trades)

**Filters**

* Max SL distance (pips): ignore signals with SL larger than this (0 = no limit)
* EMA200 filter: show line + enable/disable filter
* Day-of-Week filter: allow selected days only

**Risk & Sizing**

* Account Balance
* Risk per Trade (%)
* Maximum Drawdown (%) for ORPT
* Pip Value per 1.0 Lot (adjust per symbol)

**UI**

* Font Size: Tiny / Small / Normal / Large / Huge
* Label Offset Multiplier: controls label distance from pattern range

---

## How to use

1. Apply the indicator on **4H timeframe** (required).
2. Tune **Inside Bar Count** and pattern type to match your style.
3. Enable filters (EMA / Day-of-Week) if you want cleaner signals.
4. Set your **Account Balance**, **Risk %**, and **Pip Value per Lot** for realistic sizing.
5. Use the label output (EP/SL/TP) and the summary table to evaluate behavior over your selected backtest window.

---

## Alerts

The script triggers an alert when a valid signal is found (once per bar), including:

* Buy Stop / Sell Stop
* EP / SL / TP
* RRR and estimated lot sizing

---

## Important Notes / Limitations

* **Timeframe restriction**: This script is intended for **4H only**. It will not operate correctly on other timeframes.
* **Simulation limitation**: This is not a broker-grade backtest engine. It uses candle-based logic (high/low) and simplified assumptions.
* **Lot sizing is approximate**: Pip value varies by symbol and broker contract settings. Always verify before trading.
* This indicator **does not place real orders** (not a strategy, not an EA).

면책사항

해당 정보와 게시물은 금융, 투자, 트레이딩 또는 기타 유형의 조언이나 권장 사항으로 간주되지 않으며, 트레이딩뷰에서 제공하거나 보증하는 것이 아닙니다. 자세한 내용은 이용 약관을 참조하세요.