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
- 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.
| Setting | Default | Type and range | Feeds |
|---|---|---|---|
| Automatic Fibonacci Retracement | |||
| Fibonacci Length | 100 | int | highF lowF |
| Show Last | 1 | int | Highe2 Highe1 High 0.764 0.618 0.5 0.382 0.236 Low Lowe1 Lowe2 |
| Offset Length | 5 | int | Highe2 Highe1 High 0.764 0.618 0.5 0.382 0.236 Low Lowe1 Lowe2 |
What it calculates
- EMAclose, 9
ema9 · line 5 - EMAclose, 21
ema21 · line 6 - EMAclose, 55
ema55 · line 7 - EMAclose, 200
ema200 · 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.
Order rules
| Order | Fires when | By default | Line |
|---|---|---|---|
| Open Short short | (shortCondition) | On | 45 |
| Close Short | (shorttp) | On | 48 |
| Close Short | (shortclose2) | On | 51 |
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.
- 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.
| Market | Net | Buy and hold | Trades | Won | Profit factor | Max drawdown | Period |
|---|---|---|---|---|---|---|---|
| BTCUSDT 1D | −0.0% | +102.5% | 0 | 0% | 0.00 | 107.5% | 26 Jan 2024 – 21 Oct 2026 |
| BTCUSDT 4h | −0.0% | +5.5% | 0 | 0% | 0.00 | 13.4% | 8 May 2026 – 21 Oct 2026 |
| ETHUSDT 1D | −0.0% | +9.8% | 0 | 0% | 0.00 | 59.0% | 26 Jan 2024 – 21 Oct 2026 |
| ETHUSDT 4h | −0.0% | +8.4% | 0 | 0% | 0.00 | 33.7% | 8 May 2026 – 21 Oct 2026 |
| SOLUSDT 1D | −0.0% | +16.7% | 0 | 0% | 0.00 | 102.6% | 26 Jan 2024 – 21 Oct 2026 |
| SOLUSDT 4h | −0.0% | +21.5% | 0 | 0% | 0.00 | 46.5% | 8 May 2026 – 21 Oct 2026 |
| BNBUSDT 1D | −0.0% | +148.3% | 0 | 0% | 0.00 | 142.3% | 26 Jan 2024 – 21 Oct 2026 |
| BNBUSDT 4h | −0.0% | +17.1% | 0 | 0% | 0.00 | 27.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.
| Script | Shares | Type | Net | Trades | Max drawdown |
|---|---|---|---|---|---|
| CC Trend strategy 2- Downtrend Short this page | — | v5 strategy | −0.0% | 0 | 107.5% |
| TrianglePoint strategy by mohanee | highest lowest ema | v4 strategy | +45.4% | 11 | 101.9% |
| Lagged Donchian Channel + EMA by Mysteriown | ema highest lowest | v4 strategy | −12.3% | 4 | 12.3% |
| Backtest Custom HiLo Strategy by luyikaibr | ema highest lowest | v4 strategy | No trades on this market | ||
| CM_SlingShotSystem+_CassicEMA+Willams21EMA13 htc1977 edition by Arivadis | ema highest lowest | v5 strategy | No trades on this market | ||
| EMA Mean Reversion Strategy by jordanfray | ema highest lowest | v5 strategy | +4.7% | 230 | 8.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
VerifiedNothing 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
| Engine | Compiles | Runs | Matches TradingView |
|---|---|---|---|
| Zeal Terminal · OpenPineScript v2 | Yes 22 ms | Yes 1,000 bars in 49 ms | Not measured |
| PineTS | Not tested | Not tested | Not 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)