Zeal Terminal Open in Zeal Terminal

Pine Script v5 · Strategy

CC Trend strategy 2- Downtrend Short

A Pine Script v5 strategy built on EMA (close, 9), Highest (100) and Lowest (100). It has 3 order rules, 1 entry among them, and trades short only with the default settings. Exits wait for a signal; there is no stop loss. Each trade commits 100% of equity and pays 0.01% commission. 3 settings; defaults include Fibonacci Length 100, Show Last 1 and Offset Length 5.

Generated from the script's code by a template: every clause is a fact read from the source. Not written by a person or a model, and not taken from the author's description.

Does CC Trend strategy 2- Downtrend Short repaint?
No
No repainting patterns were found in the source. The live replay was not measured: it had no trades to compare.
How did CC Trend strategy 2- Downtrend Short do on BTCUSDT 1D with default settings?
Not measured
It closed no trades there from 26 Jan 2024 to 21 Oct 2026 with the default settings; it opened a short position that was still open on the last bar, so there is no result to report. It closed no trades on the other markets either. A backtest, not investment advice.
Does CC Trend strategy 2- Downtrend Short run in Pine Script v6?
No
The v6 version runs in Zeal Terminal's engine, but its results differ from the v5 version: Trades differ: 0 before, 255 after on BTCUSDT 1D, 1,000 bars, in Zeal Terminal's engine. It is shown for reference and is not offered as a download.
Does CC Trend strategy 2- Downtrend Short use a stop loss?
No
Every exit waits for a signal; nothing limits a losing trade before it fires.
Does CC Trend strategy 2- Downtrend Short run in Zeal Terminal?
Yes
It compiles in 22 ms and runs 1,000 bars in 49 ms, in the browser.

BTCUSDT · 1D · default settings

  • 22
  • Highe2
  • Highe1
  • High
  • 0.764
  • 0.618
  • 0.5
  • 0.382
  • 0.236
  • Low
  • Lowe1
  • Lowe2
  • 22
  • 55
  • 200
  • Winning trade
Prerendered with the defaults. Change anything and run it here. The script runs in your browser.
Settings (3)
25,00050,00075,000100,000125,000AprJulOct2025AprJulOct2026AprJulOct$6,074$20,253Equity from $10,000
Binance BTCUSDT 1D candles, 26 Jan 2024 to 21 Oct 2026, 1,000 bars, default settings. Triangles mark entries; circles mark exits. Lines are what the script plots.
Net profit
−0.01%
−$1.00
Buy and hold
+102.5%
same period
Closed trades
0
0 won · 0 lost
Profitable
0.0%
of closed trades
Profit factor
0.00
gross profit ÷ gross loss
Max drawdown
107.48%
−$10,747.60

One run with the author's default settings, $10,000 starting capital, commission as the script sets it. A short position was still open at the last bar. A single backtest says little about future results and is not a recommendation. Backtests are simulations on historical data and are not investment advice.

Review

What a careful reader of this script would point out, found by checking the source and the backtest.

  • Check

    No stop loss

    Every exit waits for a signal. Nothing limits a losing trade before the exit condition fires.

  • Check

    Every trade uses all the equity

    default_qty_value is 100% of equity.

  • Note

    No slippage

    Fills are assumed at the exact open price. Add slippage in the properties for a more realistic test.

Settings

Every input the script declares, with its default and what it feeds. Bounds are the ones the script enforces.

SettingDefaultType and rangeFeeds
Automatic Fibonacci Retracement
Fibonacci Length100inthighF lowF
Show Last1intHighe2 Highe1 High 0.764 0.618 0.5 0.382 0.236 Low Lowe1 Lowe2
Offset Length5intHighe2 Highe1 High 0.764 0.618 0.5 0.382 0.236 Low Lowe1 Lowe2

What it calculates

  • EMAclose, 9ema9 · line 5
  • EMAclose, 21ema21 · line 6
  • EMAclose, 55ema55 · line 7
  • EMAclose, 200ema200 · line 8
  • Highestema55 >= ema9 ? ema55:ema9, Fibonacci Length (100)highF · line 13
  • Lowestema55 >= ema9 ? ema9:ema55, Fibonacci Length (100)lowF · line 14

Signal flow

How price data and settings reach the orders. Each box is a name in the script, or several computed the same way; each arrow is a value one of them reads. Hover a box for its members.

closecloseprice dataFibLFibonacci Lengthsetting · 100ema9EMA→ ema9ema21EMA→ ema21ema55EMA→ ema55ema200EMA→ ema200highFHighest→ highFlowFLowest→ lowFAvgFibAvgFibvalueLL2, LL1, L236, L382, MidLL2 · LL1 +35 valuesL1L1valueS382, S236, SS1, SS2S382 · S236 +24 valuesS1S1valueshortConditionshortConditionconditionshorttpshorttpconditionshortclose2shortclose2conditionentry:ShortOpen Shortstrategy.entryclose:ShortClose Shortstrategy.closeplot:922plotplot:29Highe2plotplot:30Highe1plotplot:31Highplotplot:320.764plotplot:330.618plotplot:340.5plotplot:350.382plotplot:360.236plotplot:37Lowplotplot:38Lowe1plotplot:39Lowe2plotplot:4022plotplot:4155plotplot:42200plot

Order rules

OrderFires whenBy defaultLine
Open Short short(shortCondition)On45
Close Short(shorttp)On48
Close Short(shortclose2)On51

Each order is guarded by the setting shown. “Off” orders never fire unless that setting is switched on.

Does it repaint?

No

No repainting patterns in the source.

Not measuredNo trades to compareThe last 300 bars, from 26 Dec 2025, were fed to the engine as live ticks, but neither the live nor the historical run produced any trades in them, so the replay says nothing either way.
  • ClearHigher-timeframe dataThe script requests no other symbol or timeframe.
  • ClearFuture-bar referencesNo negative history offsets such as close[-1].
  • ClearIntrabar recalculationNo varip, calc_on_every_tick or realtime-only state. Orders are decided once per closed bar.
  • ClearOrder timingOrders fill at the next bar's open, after the signal bar has closed.

The checks read the source; the replay runs it. Together they catch the common causes, not every possible one.

Other markets

The same script with default settings on 8 Binance markets. Each row is a separate backtest over the most recent 1,000 bars.

MarketNetBuy and holdTradesWonProfit factorMax drawdownPeriod
BTCUSDT 1D−0.0%+102.5%00%0.00107.5%26 Jan 2024 – 21 Oct 2026
BTCUSDT 4h−0.0%+5.5%00%0.0013.4%8 May 2026 – 21 Oct 2026
ETHUSDT 1D−0.0%+9.8%00%0.0059.0%26 Jan 2024 – 21 Oct 2026
ETHUSDT 4h−0.0%+8.4%00%0.0033.7%8 May 2026 – 21 Oct 2026
SOLUSDT 1D−0.0%+16.7%00%0.00102.6%26 Jan 2024 – 21 Oct 2026
SOLUSDT 4h−0.0%+21.5%00%0.0046.5%8 May 2026 – 21 Oct 2026
BNBUSDT 1D−0.0%+148.3%00%0.00142.3%26 Jan 2024 – 21 Oct 2026
BNBUSDT 4h−0.0%+17.1%00%0.0027.0%8 May 2026 – 21 Oct 2026

Backtests are simulations on historical data and are not investment advice.

Similar scripts

Indicators and strategies built from the same calculations, run on BTCUSDT 1D with their own defaults so they can be compared directly.

ScriptSharesTypeNetTradesMax drawdown
CC Trend strategy 2- Downtrend Short this page—v5 strategy−0.0%0107.5%
TrianglePoint strategy by mohaneehighest lowest emav4 strategy+45.4%11101.9%
Lagged Donchian Channel + EMA by Mysteriownema highest lowestv4 strategy−12.3%412.3%
Backtest Custom HiLo Strategy by luyikaibrema highest lowestv4 strategyNo trades on this market
CM_SlingShotSystem+_CassicEMA+Willams21EMA13 htc1977 edition by Arivadisema highest lowestv5 strategyNo trades on this market
EMA Mean Reversion Strategy by jordanfrayema highest lowestv5 strategy+4.7%2308.9%

Upgrade and export

Written in Pine Script v5. The clean-v5 step types the settings and moves when = into if blocks, which v6 requires; it is run before and after like any upgrade.

  • No v6-only features. v6 is not needed to run this script.

Clean v5

Verified

Nothing to change.

Does it run in Pine Script v6?

No

The v6 version runs in Zeal Terminal's engine, but its results differ from the v5 version: Trades differ: 0 before, 255 after on BTCUSDT 1D, 1,000 bars, in Zeal Terminal's engine. It is shown for reference and is not offered as a download. It differs from the v5 version by 1 edit.

⋯// © CheatCode1-//@version=5+//@version=6strategy("CC-Trend strategy 2", overlay=true, initial_capital = 10000, commission_type = strategy.commission.percent, commission_value = 0.01, default_qty_type =  strategy.percent_of_equity, default_qty_value = 100 )⋯

Where it runs

EngineCompilesRunsMatches TradingView
Zeal Terminal · OpenPineScript v2Yes 22 msYes 1,000 bars in 49 msNot measured
PineTSNot testedNot testedNot measured

“Matches TradingView” needs this script's own output exported from TradingView and compared bar by bar, which has not been done for this script. The engine is built on OpenPineScript, whose conformance results are in its conformance report.

Source

Copied verbatim from the author's published script, with its licence header intact. The author may have updated the original since this snapshot.

// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/// © CheatCode1//@version=5strategy("CC-Trend strategy 2", overlay=true, initial_capital = 10000, commission_type = strategy.commission.percent, commission_value = 0.01, default_qty_type =  strategy.percent_of_equity, default_qty_value = 100 )ema9 = ta.ema(close, 9)ema21 = ta.ema(close, 21)ema55 = ta.ema(close, 55)ema200 = ta.ema(close, 200)plot(ema200, '22', color.blue, 2)FibL = input.int(100, 'Fibonacci Length', 1, 500, group = 'Automatic Fibonacci Retracement')len1 = input.int(1, 'Show Last', 0, 1000, group = 'Automatic Fibonacci Retracement')len2 = input.int(5, 'Offset Length', 0, 1000, group = 'Automatic Fibonacci Retracement')highF = ta.highest(ema55 >= ema9 ? ema55:ema9, FibL)lowF = ta.lowest(ema55 >= ema9 ? ema9:ema55, FibL)AvgFib = highF - lowF//Fibonacci ExecutionsLL2 = highF + .618 * AvgFibLL1 = highF + .272 * AvgFibL1 = highFL236 = highF - 0.236 * AvgFibL382 = highF - 0.382 * AvgFibMid =  highF - 0.50 * AvgFibS382 = lowF + 0.382 * AvgFibS236 = lowF + 0.236 * AvgFibS1 = lowFSS1 = lowF - .272 * AvgFibSS2 = lowF - .618 * AvgFib//Fibonacci Plot'shigh2FP = plot(LL2, 'Highe2', color.red,offset = len2, show_last = len1, trackprice = true)high1FP = plot(LL1, 'Highe1', color.red,offset = len2, show_last = len1, trackprice = true)highFP = plot(highF, 'High', color.red,offset = len2, show_last = len1, trackprice = true)L236P = plot(L236, "0.764", #ED381C, offset = len2, show_last = len1, trackprice = true )L382P = plot(L382, "0.618", color.white,offset = len2, show_last = len1, trackprice = true )MidP = plot(Mid, "0.5", color.orange,offset = len2, show_last = len1, trackprice = true )S382P = plot(S382, "0.382", color.yellow ,offset = len2, show_last = len1, trackprice = true)S236P = plot(S236, "0.236", color.lime ,offset = len2, show_last = len1, trackprice = true)lowFP = plot(lowF, 'Low', color.green,offset = len2, show_last = len1, trackprice = true)low1FP = plot(SS1, 'Lowe1', color.green,offset = len2, show_last = len1, trackprice = true)low2FP = plot(SS2, 'Lowe2', color.green,offset = len2, show_last = len1, trackprice = true)plot(ema9, '22', color.yellow, 2)plot(ema55, '55', color.aqua, 2)plot(ema200, '200', color.maroon, 2)shortCondition = close[1] < highF and ema21 < ema55if (shortCondition)    strategy.entry("Short", strategy.short)shorttp = ta.crossover(close, ema200) and strategy.openprofit >= 0if (shorttp)    strategy.close('Short', 'Short TP', qty_percent = 100)shortclose2 = close[1] > L236 and not (shortCondition) if(shortclose2)    strategy.close('Short', 'Short RM', qty_percent = 100)