PROTECTED SOURCE SCRIPT

CLEVER V15

163
1. What it is
Type: Full strategy, not just a visual indicator.
Name: CLEVER v15.
Overlay: Plots directly on the price chart.
Core idea:
Generate long/short signals from either:
Heikin‑Ashi open/close cross, or
EMA cross on ATR‑based Renko bricks,
then manage trades with ATR‑based multi‑take‑profit / stop‑loss, plus rich dashboards.
2. Entry logic (two modes)
Controlled by setup Type:
スナップショット XAUUSD BTCUSD EURUSD USDCNH USOIL
Open/Close mode (“Open/Close”)
Uses Heikin‑Ashi candles on a higher timeframe (my_time).
Buy condition BUYOC: Heikin‑Ashi close crosses above open (bullish body flip).
Sell condition SELLOC: Heikin‑Ashi close crosses below open (bearish body flip).
Signals must also pass the RSI/ATR filter (trendType, see section 3).
Renko mode (“Renko”)
Builds Renko bricks (ATR‑based by default).
Computes EMAs on Renko close:
EMA1 (fast, length 2),
EMA2 (slow, length 10).
Buy BUYR: EMA1 crosses over EMA2 on Renko close (bullish).
Sell SELLR: EMA1 crosses under EMA2 on Renko close (bearish).
Again, trades only fire when the RSI/ATR filter allows it.
Both modes create unified booleans:

buy_entry = either BUYOC or BUYR
sel_entry = either SELLOC or SELLR
These then drive all trade/TP/SL logic.

3. RSI & ATR “sideways / trend” filter
Configurable via typefilter (“Sideways Filtering Input”), using:

RSI: 7‑period RSI with:
toplimitrsi (default 45),
botlimitrsi (default 10).
ATR filter:
ATR length 5 on the symbol.
ATR MA (EMA or SMA, length 5).
It defines combinations like:

ATR “high vs MA” → trending vs quiet.
RSI “outside band” vs “inside band” → trending vs sideways.
Options:
Filter by ATR only.
Filter by RSI only.
ATR or RSI.
ATR and RSI.
No filtering.
Only enter in sideways market (by ATR/RSI or by both).
Result is trendType (boolean).
If trendType is false, no trades are allowed.

4. Trade types / management modes
Controlled by TPSType:

ATR mode (“ATR”) – full multi‑TP risk management
Uses ATR(20) to set three take‑profit levels and a stop:
TP1 ≈ 1×(factor×ATR)
TP2 ≈ 2×(factor×ATR)
TP3 ≈ 3×(factor×ATR)
SL roughly symmetric the other way.
On a valid long/short entry:
Opens one position ("Long" or "Short").
Scales out using three strategy.exit orders:
TP1: 50% of position.
TP2: 30%.
TP3: 20%.
Uses a persistent state variable condition to track which TP/SL has been hit.
Draws lines and labels for:
Entry, SL, TP1/TP2/TP3.
Fills between Entry–TP area (profit zone) and Entry–SL area (risk zone).
Fires alerts for:
Long/Short entries, exits.
TP1/2/3 hits.
SL hits.
Trailing mode (“Trailing”) – signal‑to‑signal reversals
On buy:
Closes existing "Short", opens "Long".
On sell:
Closes "Long", opens "Short".
No fixed ATR TP/SL here; exit is mainly via opposite signal.
Options mode (“Options”) – long‑only style
On buy:
Opens "Long"; does not automatically close shorts (those lines are commented out).
On sell:
Closes "Long"; does not open new shorts.
Useful if you only want long trades (e.g., options, long‑only instruments).
Backtesting date range is also restricted by fromDate and toDate.

5. Visual elements on the chart
Bar colors
One layer colors bars by trend (up / down) from Heikin‑Ashi or Renko context.
Another layer colors bars simply by close > open vs close < open.
Renko “ribbon” / cloud (almaRibbon)
When enabled, plots paired series (Renko or HA open/close) as circles and fills between them.
Cloud color switches with brick/candle trend.
EMA Cloud
Higher‑timeframe EMAs:
ema (48),
ema2 (2),
ema3 (21).
Uses either current TF or a higher TF (useHTF).
Plots EMAs and fills between them with different colors for uptrend vs downtrend using i_emaCloudColorUp/Down.
Gives a visual trend cloud around price.
DEMA ATR line (BackQuant module)
Computes a double‑EMA smoothed ATR‑based line (DemaAtr) from either HA close or standard close.
Constrains the line within ATR bands.
Colors green when rising, red when falling.
Optional visibility via showAtr.
Labels
Entry labels: “Long”, “Short”.
Exit labels: “Close”.
TP labels: “TP1”, “TP2”, “TP3”.
SL label: “SL”.
Line‑end labels showing numeric values and target pips for TP3/SL/Entry.
6. Dashboards / performance tables
All in the Dashboards group:

Strategy Performance panel
Shows after backtest completes:
Total trades, win rate.
Start/ending capital.
Average win/loss.
Profit factor.
Max run‑up.
Return % and max drawdown %.
Weekly Performance table
Day‑of‑week breakdown (Sun–Sat).
Per day:
Total trades,
Wins, losses,
Win rate %.
You choose whether to classify trades by open time or close time, and which timezone.
Monthly Performance table (QuantNomad style)
Month‑by‑month and year‑by‑year P&L (%).
Heatmap style table by year (rows) vs months (columns) + yearly column.
7. Alerts
The script fires TradingView alert() events for:

Any entry/exit (combined “Any Alert”).
Long Entry / Short Entry.
Long Exit / Short Exit.
Plus, when using TPSType == "ATR", the strategy.exit orders can each carry separate webhook messages for TP/SL.

Summary
This script is an advanced multi‑timeframe, Renko/Heikin‑Ashi EMA‑cross strategy with:

RSI + ATR‑based market‑state filter,
Three trade‑management modes (ATR multi‑TP, simple reversal, long‑only),
Rich visuals (Renko/EMA clouds, DEMA ATR, TP/SL areas),
And several performance dashboards (overall, weekly, monthly).

免責事項

この情報および投稿は、TradingViewが提供または推奨する金融、投資、トレード、その他のアドバイスや推奨を意図するものではなく、それらを構成するものでもありません。詳細は利用規約をご覧ください。