Pine Script v5 · Strategy
CM_SlingShotSystem+_CassicEMA+Willams21EMA13 htc1977 edition
A Pine Script v5 strategy built on EMA (close, 62), Highest (21) and Lowest (21). It has 6 order rules and no entry of its own. Exits use a stop loss. Each trade is one contract and pays no commission. 17 settings; defaults include CM SLING SHOT ema Slow input 62, CM SLING SHOT ema Fast input 38 and Willams candles back length 21.
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 CM_SlingShotSystem+_CassicEMA+Willams21EMA13 htc1977 edition repaint?
- No
- No repainting patterns were found in the source. The live replay was not measured: it had no trades to compare.
- How did CM_SlingShotSystem+_CassicEMA+Willams21EMA13 htc1977 edition 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, so there is no result to report. Its entry conditions never all held on this data. It closed no trades on the other markets either. A backtest, not investment advice.
- What alerts does CM_SlingShotSystem+_CassicEMA+Willams21EMA13 htc1977 edition have?
- 2
- long_signal; short_signal.
- Does CM_SlingShotSystem+_CassicEMA+Willams21EMA13 htc1977 edition run in Pine Script v6?
- No
- The v6 version does not run in Zeal Terminal's engine: Pine Script v6 Error at @L52:C17: cannot use 'float' as a condition — Pine Script v6 does not cast 'int' or 'float' to 'bool' implicitly. Wrap it in bool(). The v6 version is shown for reference and is not offered as a download.
- Does CM_SlingShotSystem+_CassicEMA+Willams21EMA13 htc1977 edition use a stop loss?
- Yes
- strategy.exit sets a stop on line 117, 123.
BTCUSDT · 1D · default settings
- Slow MA
- Fast MA
- Conservative Buy Entry Triangle
- Conservative Short Entry Triangle
- Up Entry Arrow
- Down Entry Arrow
- EMA
- Smoothing Line
- Plot
- Winning trade
- Losing trade
- Equity
- Buy and hold
- Net profit
- 0.00%
- $0.00
- Buy and hold
- +102.5%
- same period
- Closed trades
- 0
- 0 won · 0 lost
- Profitable
- 0.0%
- of closed trades
- Profit factor
- —
- gross profit ÷ gross loss
- Max drawdown
- 0.00%
- $0.00
One run with the author's default settings, $500 starting capital, commission as the script sets it. 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
1 setting does nothing
“Only Choose 1 - Either Conservative Entry Arrows or 'B'-'S' Letters” is declared but never read.
-
Check
No commission
The backtest assumes free trading. Results on any real exchange will be lower.
-
Note
4 settings have no label
In the settings dialog CM_SLING_SHOT_emaSlow_input (line 19), CM_SLING_SHOT_emaFast_input (line 20), Willams_candles_back_length (line 58), switcher_EMA (line 72) show an empty name. The labels on this page come from the variable names.
-
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 |
|---|---|---|---|
| Show Aggressive Entry?, Or Use as Alert To Potential Conservative Entry? | true | bool | barcolor |
| Show Conservative Entry? | true | bool | barcolor |
| Show Trend Arrows at Top and Bottom of Screen? | true | bool | Conservative Buy Entry Triangle Conservative Short Entry Triangle |
| Only Choose 1 - Either Conservative Entry Arrows or 'B'-'S' Letters | false | bool | unused |
| Show Conservative Entry Arrows? | true | bool | Up Entry Arrow Down Entry Arrow |
| Show 'B'-'S' Letters? | false | bool | Buy Entry Short Entry |
| CM SLING SHOT ema Slow input (no label in the script) | 62 | int · min 2 | emaSlow |
| CM SLING SHOT ema Fast input (no label in the script) | 38 | int · min 1 | emaFast |
| Willams candles back length (no label in the script) | 21 | int · min 1 | upper lower |
| Length | 13 | int · min 1 | emaout |
| Switcher EMA (no label in the script) | true | bool | line 93 |
| Length | 200 | int · min 1 | out2 |
| Source | close | source | out2 |
| Offset | 0 | int · min -500 · max 500 | EMA Smoothing Line |
| custom stop | 0.01 | float · min 0.001 | cust_stop_long cust_stop_short |
| Smoothing | |||
| Method | SMA | string · options ["SMA", "EMA", "SMMA (RMA)", "WMA", "VWMA"] | smoothingLine2 |
| Length | 5 | int · min 1 · max 100 | smoothingLine2 |
What it calculates
- EMAclose, CM SLING SHOT ema Slow input (62)
emaSlow · line 21 - EMAclose, CM SLING SHOT ema Fast input (38)
emaFast · line 22 - HighestWillams candles back length (21)
upper · line 59 - LowestWillams candles back length (21)
lower · line 60 - EMAwillyout, Length (13)
emaout · line 66 - EMASource (close), Length (200)
out2 · line 76
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 |
|---|---|---|---|
| order long_entry long | emaFast > emaSlow and ta.crossunder(low, emaFast) and low[1] > emaFast and long_EMA_classic == true | On | 114 |
| Exit long_entry stop | emaFast > emaSlow and ta.crossunder(low, emaFast) and low[1] > emaFast and long_EMA_classic == true | On | 117 |
| order short_entry short | emaFast < emaSlow and ta.crossover(high, emaFast) and high[1] < emaFast and short_EMA_classic == true | On | 120 |
| Exit short_entry stop | emaFast < emaSlow and ta.crossover(high, emaFast) and high[1] < emaFast and short_EMA_classic == true | On | 123 |
| Close long_entry | calc == 1 and (emaFast < emaSlow or (emaout > -20 and willyout > -20) or close < cust_stop_long) | On | 128 |
| Close short_entry | calc == -1 and (emaFast > emaSlow or (emaout < -80 and willyout < -80) or close > cust_stop_short) | On | 132 |
Each order is guarded by the setting shown. “Off” orders never fire unless that setting is switched on.
Alerts
| Alert | Call | Message | Line |
|---|---|---|---|
| (no title) | alert | long_signal | 115 |
| (no title) | alert | short_signal | 121 |
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.0% | 26 Jan 2024 – 21 Oct 2026 |
| BTCUSDT 4h | 0.0% | +5.5% | 0 | 0% | — | 0.0% | 8 May 2026 – 21 Oct 2026 |
| ETHUSDT 1D | 0.0% | +9.8% | 0 | 0% | — | 0.0% | 26 Jan 2024 – 21 Oct 2026 |
| ETHUSDT 4h | 0.0% | +8.4% | 0 | 0% | — | 0.0% | 8 May 2026 – 21 Oct 2026 |
| SOLUSDT 1D | 0.0% | +16.7% | 0 | 0% | — | 0.0% | 26 Jan 2024 – 21 Oct 2026 |
| SOLUSDT 4h | 0.0% | +21.5% | 0 | 0% | — | 0.0% | 8 May 2026 – 21 Oct 2026 |
| BNBUSDT 1D | 0.0% | +148.3% | 0 | 0% | — | 0.0% | 26 Jan 2024 – 21 Oct 2026 |
| BNBUSDT 4h | 0.0% | +17.1% | 0 | 0% | — | 0.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 |
|---|---|---|---|---|---|
| CM_SlingShotSystem+_CassicEMA+Willams21EMA13 htc1977 edition this page | — | v5 strategy | 0.0% | 0 | 0.0% |
| CC Trend strategy 2- Downtrend Short by CheatCode1 | ema highest lowest | v5 strategy | No trades on this market | ||
| 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 | ||
| 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.
- 7 settings use the untyped input() (line 11, 12, 13, 14, 15, 16, 74). It still compiles in v6; input.int, input.float or input.source state the type.
- No v6-only features. v6 is not needed to run this script.
Clean v5
Not verifiedNeither version placed a trade on any of the 8 markets, so there was nothing to compare.
- Line 11: input() → input.bool()
- Line 12: input() → input.bool()
- Line 13: input() → input.bool()
- Line 14: input() → input.bool()
- Line 15: input() → input.bool()
- Line 16: input() → input.bool()
- Line 74: input() → input.source()
⋯// this indicator based on EMA, so there are some reasons to use much bigger/lower EMA classic(see below)-sae = input(true, title="Show Aggressive Entry?, Or Use as Alert To Potential Conservative Entry?")+sae = input.bool(true, title="Show Aggressive Entry?, Or Use as Alert To Potential Conservative Entry?")-sce = input(true, title="Show Conservative Entry?")+sce = input.bool(true, title="Show Conservative Entry?")-st = input(true, title="Show Trend Arrows at Top and Bottom of Screen?")+st = input.bool(true, title="Show Trend Arrows at Top and Bottom of Screen?")-def = input(false, title="Only Choose 1 - Either Conservative Entry Arrows or 'B'-'S' Letters")+def = input.bool(false, title="Only Choose 1 - Either Conservative Entry Arrows or 'B'-'S' Letters")-pa = input(true, title="Show Conservative Entry Arrows?")+pa = input.bool(true, title="Show Conservative Entry Arrows?")-sl = input(false, title="Show 'B'-'S' Letters?")+sl = input.bool(false, title="Show 'B'-'S' Letters?")// EMA Definitions⋯EMA_classic_len = input.int(200, minval=1, title="Length")-EMA_OHLC = input(close, title="Source")+EMA_OHLC = input.source(close, title="Source")offset2 = input.int(title="Offset", defval=0, minval=-500, maxval=500)⋯Does it run in Pine Script v6?
No
The v6 version does not run in Zeal Terminal's engine: Pine Script v6 Error at @L52:C17: cannot use 'float' as a condition — Pine Script v6 does not cast 'int' or 'float' to 'bool' implicitly. Wrap it in bool(). The v6 version is shown for reference and is not offered as a download. It differs from the v5 version by 1 edit.
⋯// © svatvlad1993-//@version=5+//@version=6strategy("CM_SlingShotSystem", overlay=true, margin_long = 100, margin_short = 100, initial_capital = 500, currency=currency.USDT, calc_on_every_tick = false)⋯Where it runs
| Engine | Compiles | Runs | Matches TradingView |
|---|---|---|---|
| Zeal Terminal · OpenPineScript v2 | Yes 42 ms | With a workaround 1,000 bars in 84 ms | Not measured |
| PineTS | Not tested | Not tested | Not measured |
The engine's host API cannot yet declare a chart's symbol and timeframe, so this page sets them on the engine directly for each market.
“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/// © svatvlad1993//@version=5strategy("CM_SlingShotSystem", overlay=true, margin_long = 100, margin_short = 100, initial_capital = 500, currency=currency.USDT, calc_on_every_tick = false)// do not use 'calc_on_every_tick = true', better to use lower timeframe// if You strong need - you can, but the part of code(some variables) should be overwritten// CM_SLING_SHOT_SYSTEM// Has updated for pinescript v5// this is first indicator you provided https://tr.tradingview.com/script/GE7tSQK1-CM-Sling-Shot-System/// this indicator based on EMA, so there are some reasons to use much bigger/lower EMA classic(see below)sae = input(true, title="Show Aggressive Entry?, Or Use as Alert To Potential Conservative Entry?")sce = input(true, title="Show Conservative Entry?")st = input(true, title="Show Trend Arrows at Top and Bottom of Screen?")def = input(false, title="Only Choose 1 - Either Conservative Entry Arrows or 'B'-'S' Letters")pa = input(true, title="Show Conservative Entry Arrows?")sl = input(false, title="Show 'B'-'S' Letters?")// EMA Definitions// This part for input each EMA for CM_SLING_SHOT_SYSTEMCM_SLING_SHOT_emaSlow_input = input.int(62 ,minval = 2)CM_SLING_SHOT_emaFast_input = input.int(38, minval = 1)emaSlow = ta.ema(close, CM_SLING_SHOT_emaSlow_input)emaFast = ta.ema(close, CM_SLING_SHOT_emaFast_input)//Aggressive Entry or Alert To Potential TradepullbackUpT() => emaFast > emaSlow and close < emaFastpullbackDnT() => emaFast < emaSlow and close > emaFast//Conservative Entry Code For Highlight BarsentryUpT() => emaFast > emaSlow and close[1] < emaFast and close > emaFastentryDnT() => emaFast < emaSlow and close[1] > emaFast and close < emaFast//Conservative Entry True/False ConditionentryUpTrend = emaFast > emaSlow and close[1] < emaFast and close > emaFast ? 1 : 0entryDnTrend = emaFast < emaSlow and close[1] > emaFast and close < emaFast ? 1 : 0//Define Up and Down Trend for Trend Arrows at Top and Bottom of ScreenupTrend = emaFast >= emaSlowdownTrend = emaFast < emaSlow//Definition for Conseervative Entry Up and Down PlotArrowscodiff = entryUpTrend == 1 ? entryUpTrend : 0codiff2 = entryDnTrend == 1 ? entryDnTrend : 0//Color definition for Moving Averagescol = emaFast > emaSlow ? color.lime : emaFast < emaSlow ? color.red : color.yellow//Moving Average Plots and Fillp1 = plot(emaSlow, title="Slow MA", style=plot.style_linebr, linewidth=4, color=col)p2 = plot(emaFast, title="Fast MA", style=plot.style_linebr, linewidth=2, color=col)fill(p1, p2, color.new(color.silver, 50))//Aggressive Entry, Conservative Entry Highlight Barsbarcolor(sae and pullbackUpT() ? color.yellow : sae and pullbackDnT() ? color.yellow : na)barcolor(sce and entryUpT() ? color.aqua : sce and entryDnT() ? color.aqua : na)//Trend Triangles at Top and Bottom of Screenplotshape(st and upTrend ? upTrend : na, title="Conservative Buy Entry Triangle",style=shape.triangleup, location=location.bottom, color=color.new(color.lime, transp=0), offset=0)plotshape(st and downTrend ? downTrend : na, title="Conservative Short Entry Triangle",style=shape.triangledown, location=location.top, color=color.new(color.red, transp=0), offset=0)//Plot Arrows OR Letters B and S for Buy Sell Signalsplotarrow(pa and codiff ? codiff : na, title="Up Entry Arrow", colorup=color.new(color.lime, transp=0), maxheight=30, minheight=30)plotarrow(pa and codiff2*-1 ? codiff2*-1 : na, title="Down Entry Arrow", colordown=color.new(color.red, transp=0), maxheight=30, minheight=30)plotchar(sl and codiff ? low - ta.tr : na, title="Buy Entry", offset=0, char='B', location=location.absolute, color=color.new(color.lime, transp=0))plotchar(sl and codiff2 ? high + ta.tr : na, title="Short Entry", offset=0, char='S', location=location.absolute, color=color.new(color.red, transp=0))// Willams21EMA13 htc1977 edition// second indicator https://tr.tradingview.com/v/BYEfUEKp/// input number of candles for diapasonWillams_candles_back_length = input.int(21, minval=1)upper = ta.highest(Willams_candles_back_length)lower = ta.lowest(Willams_candles_back_length)// calc willywillyout = 100 * (close - upper) / (upper - lower)src = willyoutWillams_len = input.int(13, minval=1, title="Length")// compute the EMA of willyemaout = ta.ema(willyout, Willams_len)// draw willy and EMAcurrent_price = close// EMA classic// You can use this EMA for bult indicator or/and inside strategy buy logic// You can ON/OFF EMA for calculating(but for OFF indicator there is another field in settings)switcher_EMA = input.bool(true)EMA_classic_len = input.int(200, minval=1, title="Length")EMA_OHLC = input(close, title="Source")offset2 = input.int(title="Offset", defval=0, minval=-500, maxval=500)out2 = ta.ema(EMA_OHLC, EMA_classic_len)plot(out2, title="EMA", color=color.blue, offset=offset2)ma(source, length, type) => switch type "SMA" => ta.sma(source, length) "EMA" => ta.ema(source, length) "SMMA (RMA)" => ta.rma(source, length) "WMA" => ta.wma(source, length) "VWMA" => ta.vwma(source, length)// choose indicator - for You it is EMAtypeMA2 = input.string(title = "Method", defval = "SMA", options=["SMA", "EMA", "SMMA (RMA)", "WMA", "VWMA"], group="Smoothing")smoothingLength2 = input.int(title = "Length", defval = 5, minval = 1, maxval = 100, group="Smoothing")smoothingLine2 = ma(out2, smoothingLength2, typeMA2)plot(smoothingLine2, title="Smoothing Line", color=#f37f20, offset=offset2, display=display.none)// logic for strategy_ema_switchervar long_EMA_classic = truevar short_EMA_classic = trueif switcher_EMA == true if close > out2 long_EMA_classic := true short_EMA_classic := false else long_EMA_classic := false short_EMA_classic := trueelse long_EMA_classic := true short_EMA_classic := true// var for entered order + stop_loss for each sidevar calc = 0var cust_stop_long = 0.0var cust_stop_short = 0.0if strategy.position_size == 0 cust_stop_long := 0.0 cust_stop_short := 0.0custom_stop_percent = input.float(0.01, minval = 0.001, title = 'custom stop') //this is 1%, 55% = 0.55// logict enry orderif calc == 0 if emaFast > emaSlow and ta.crossunder(low, emaFast) and low[1] > emaFast and long_EMA_classic == true strategy.order('long_entry', strategy.long, 50) alert('long_signal') cust_stop_long := close - (close * custom_stop_percent) strategy.exit('long_entry', stop=cust_stop_long) calc := 1 if emaFast < emaSlow and ta.crossover(high, emaFast) and high[1] < emaFast and short_EMA_classic == true strategy.order('short_entry', strategy.short, 50) alert('short_signal') cust_stop_short := close + (close * custom_stop_percent) strategy.exit('short_entry', stop=cust_stop_short) calc := -1 // logic for close positionif calc == 1 and (emaFast < emaSlow or (emaout > -20 and willyout > -20) or close < cust_stop_long) strategy.close('long_entry', immediately = true) calc := 0 if calc == -1 and (emaFast > emaSlow or (emaout < -80 and willyout < -80) or close > cust_stop_short) strategy.close('short_entry', immediately = true) calc := 0plot(strategy.equity)// a piece of advice// here are a lot of ema, probably You have to try some else indicators.// a lot of negative orders were also opened on period of small difference between emaslow and emafast. This could be avoided.// Play with variables, see profit, gave fan!!!// Arivadis