Zeal Terminal Open in Zeal Terminal

Pine Script v4 · Strategy

Weis Chop Strategy

A Pine Script v4 strategy built on ATR or Highest or Lowest (1) and Crossunder (ci, 61.8). It has 4 order rules, 2 entries among them, and trades long and short with the default settings. Exits use a stop loss and a profit target. Each trade commits 10% of equity and pays no commission. 9 settings; defaults include Max Intraday Loss(%) 1, Renko Assignment Method ATR and Value 14.0.

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 Weis Chop Strategy repaint?
No
No repainting patterns were found in the source, and a live tick-by-tick replay matched history on 5 of 5 trades.
How did Weis Chop Strategy do on BTCUSDT 1D with default settings?
−7.53%
From 26 Jan 2024 to 21 Oct 2026, over 12 closed trades, against +102.5% for buy and hold. A backtest, not investment advice.
Can Weis Chop Strategy be converted to Pine Script v5?
No
The automatic step from v4 to v5 changes the results, so no v5 download is offered; the edits are shown below.
Does Weis Chop Strategy use a stop loss?
Yes
strategy.exit sets a stop on line 52, 53.
Does Weis Chop Strategy run in Zeal Terminal?
Yes
It compiles in 18 ms and runs 1,000 bars in 56 ms, in the browser.

BTCUSDT · 1D · default settings

  • Wave Volume
  • CHOP
  • Upper Band
  • Lower Band
  • Winning trade
  • Losing trade
  • Equity
  • Buy and hold
Prerendered with the defaults. Change anything and run it here. The script runs in your browser.
Settings (9)
40,00060,00080,000100,000120,000AprJulOct2025AprJulOct2026AprJulOctWave Volume$89,297$202,527Equity from $100,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
−7.53%
−$7,526.84
Buy and hold
+102.5%
same period
Closed trades
12
4 won · 8 lost
Profitable
33.3%
of closed trades
Profit factor
0.31
gross profit ÷ gross loss
Max drawdown
11.10%
−$11,098.80

One run with the author's default settings, $100,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 commission

    The backtest assumes free trading. Results on any real exchange will be lower.

  • Note

    1 setting has no label

    In the settings dialog length (line 38) shows 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.

  • Note

    Uses an argument v6 removed

    when = on line 52, 53. The upgraded version below moves each call inside an if block.

  • Note

    Uses transp =, which v5 removed line 37

    transp = on line 37. v5 folds the transparency into the colour with color.new(c, transp).

Upgrade and export

Written in Pine Script v4. The upgrade to v5 takes 1 step, one per version, each applied to the result of the one before. A last clean-v5 pass then types the settings and moves when = into if blocks, which v6 requires. Every step runs before and after on the same candles in Zeal Terminal's engine; a step whose results differ is shown but not offered as a download. Upgrades preserve behaviour: bugs are fixed in the Review, never silently here.

  • Upgrading to v5 renames atr → ta.atr, round → math.round, change → ta.change, log10 → math.log10, sum → math.sum, highest → ta.highest, lowest → ta.lowest, ema → ta.ema, crossunder → ta.crossunder.
  • 2 strategy calls use the when = argument (line 52, 53). It is deprecated in v5 and removed in v6, where each call moves inside an if block.

v4 → v5

Differs

Trades differ: 12 before, 12 after on BTCUSDT 1D, 1,000 bars, in Zeal Terminal's engine.

  • Line 3: //@version=4 → //@version=5
  • Line 5: input(type = input.float) → input.float()
  • Line 7: method is reserved in v5: renamed method_
  • Line 8: input(type = input.float) → input.float()
  • Line 13: input(type = input.bool) → input.bool()
  • Line 14: input(type = input.bool) → input.bool()
15 more edits
  • Line 15: tr → ta.tr
  • Line 20: atr → ta.atr
  • Line 20: round → math.round
  • Line 30: change → ta.change
  • Line 37: transp = 75 → color.new(directionIsUp ? color.green : color.red, 75)
  • Line 39: log10 → math.log10
  • Line 39: sum → math.sum
  • Line 39: atr → ta.atr
  • Line 39: highest → ta.highest
  • Line 39: lowest → ta.lowest
  • Line 39: log10 → math.log10
  • Line 40: input(type = input.integer) → input.int()
  • Line 45: ema → ta.ema
  • Line 46: ema → ta.ema
  • Line 47: crossunder → ta.crossunder
⋯// © sharatgbhat-//@version=4+//@version=5strategy("Weis Chop Strategy", overlay=false, default_qty_type = strategy.percent_of_equity, default_qty_value = 10,max_lines_count = 500, max_labels_count = 500)-maxIdLossPcnt = input(1, "Max Intraday Loss(%)", type=input.float)+maxIdLossPcnt = input.float(1, "Max Intraday Loss(%)")strategy.risk.max_intraday_loss(maxIdLossPcnt, strategy.percent_of_equity)-method = input(defval="ATR", options=["ATR", "Traditional", "Part of Price"], title="Renko Assignment Method")+method_ = input(defval="ATR", options=["ATR", "Traditional", "Part of Price"], title="Renko Assignment Method")-methodvalue = input(defval=14.0, type=input.float, minval=0, title="Value")+methodvalue = input.float(defval=14.0, minval=0, title="Value")pricesource = input(defval="Close", options=["Close", "Open / Close", "High / Low"], title="Price Source")⋯useTrueRange = input(defval="Auto", options=["Always", "Auto", "Never"], title="Use True Range instead of Volume")-isOscillating = input(defval=false, type=input.bool, title="Oscillating")+isOscillating = input.bool(defval=false, title="Oscillating")-normalize = input(defval=false, type=input.bool, title="Normalize")+normalize = input.bool(defval=false, title="Normalize")-vol = useTrueRange == "Always" or useTrueRange == "Auto" and na(volume) ? tr : volume+vol = useTrueRange == "Always" or useTrueRange == "Auto" and na(volume) ? ta.tr : volumeop = useClose ? close : open⋯lo = useOpenClose ? close <= op ? close : op : low-if method == "ATR"+if method_ == "ATR"-    methodvalue := atr(round(methodvalue))+    methodvalue := ta.atr(math.round(methodvalue))-if method == "Part of Price"+if method_ == "Part of Price"    methodvalue := close / methodvalue⋯direction := currclose > prevclose ? 1 : currclose < prevclose ? -1 : nz(direction[1])-directionHasChanged = change(direction) != 0+directionHasChanged = ta.change(direction) != 0directionIsUp = direction > 0⋯res = barcount > 1 ? vol / barcount : vol-plot(isOscillating and directionIsDown ? -res : res, style=plot.style_columns, color=directionIsUp ? color.green : color.red, transp=75, linewidth=3, title="Wave Volume")+plot(isOscillating and directionIsDown ? -res : res, style=plot.style_columns, color=color.new(directionIsUp ? color.green : color.red, 75), linewidth=3, title="Wave Volume")length = input(14, minval=1)-ci = 100 * log10(sum(atr(1), length) / (highest(length) - lowest(length))) / log10(length)+ci = 100 * math.log10(math.sum(ta.atr(1), length) / (ta.highest(length) - ta.lowest(length))) / math.log10(length)-offset = input(0, "Offset", type = input.integer, minval = -500, maxval = 500)+offset = input.int(0, "Offset", minval = -500, maxval = 500)plot(ci, "CHOP", color=#2962FF, offset = offset)⋯fill(band1, band0, color = color.rgb(33, 150, 243, 90), title = "Background")-MomentumBull = close>ema(close,8)+MomentumBull = close>ta.ema(close,8)-MomentumBear = close<ema(close,8)+MomentumBear = close<ta.ema(close,8)-Tradecon = crossunder(ci,61.8)+Tradecon = ta.crossunder(ci,61.8)if (MomentumBull and directionIsUp and Tradecon)⋯

Clean v5

Verified

Same 12 trades and the same P&L on BTCUSDT 1D, 1,000 bars, in Zeal Terminal's engine.

  • Line 7: input() → input.string()
  • Line 9: input() → input.string()
  • Line 12: input() → input.string()
  • Line 38: input() → input.int()
  • Line 52: when = directionIsDown → if block
  • Line 53: when = directionIsUp → if block
⋯strategy.risk.max_intraday_loss(maxIdLossPcnt, strategy.percent_of_equity)-method_ = input(defval="ATR", options=["ATR", "Traditional", "Part of Price"], title="Renko Assignment Method")+method_ = input.string(defval="ATR", options=["ATR", "Traditional", "Part of Price"], title="Renko Assignment Method")methodvalue = input.float(defval=14.0, minval=0, title="Value")-pricesource = input(defval="Close", options=["Close", "Open / Close", "High / Low"], title="Price Source")+pricesource = input.string(defval="Close", options=["Close", "Open / Close", "High / Low"], title="Price Source")useClose = pricesource == "Close"useOpenClose = pricesource == "Open / Close" or useClose-useTrueRange = input(defval="Auto", options=["Always", "Auto", "Never"], title="Use True Range instead of Volume")+useTrueRange = input.string(defval="Auto", options=["Always", "Auto", "Never"], title="Use True Range instead of Volume")isOscillating = input.bool(defval=false, title="Oscillating")⋯plot(isOscillating and directionIsDown ? -res : res, style=plot.style_columns, color=color.new(directionIsUp ? color.green : color.red, 75), linewidth=3, title="Wave Volume")-length = input(14, minval=1)+length = input.int(14, minval=1)ci = 100 * math.log10(math.sum(ta.atr(1), length) / (ta.highest(length) - ta.lowest(length))) / math.log10(length)⋯    strategy.entry("Sell", strategy.short)-    strategy.exit("exit","Buy",when=directionIsDown,qty_percent=100,profit=20,loss=10)+    if directionIsDown+        strategy.exit("exit","Buy",qty_percent=100,profit=20,loss=10)-    strategy.exit("exit","Sell",when=directionIsUp,qty_percent=100,profit=20,loss=10)+    if directionIsUp+        strategy.exit("exit","Sell",qty_percent=100,profit=20,loss=10)

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: 12 before, 12 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.

⋯// © sharatgbhat-//@version=5+//@version=6strategy("Weis Chop Strategy", overlay=false, default_qty_type = strategy.percent_of_equity, default_qty_value = 10,max_lines_count = 500, max_labels_count = 500)⋯

Settings

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

SettingDefaultType and rangeFeeds
Max Intraday Loss(%)1floatline 6
Renko Assignment MethodATRstring · options ["ATR", "Traditional", "Part of Price"]line 19 line 21
Value14.0float · min 0prevhigh prevlow
Price SourceClosestring · options ["Close", "Open / Close", "High / Low"]useClose useOpenClose
Use True Range instead of VolumeAutostring · options ["Always", "Auto", "Never"]vol
OscillatingfalseboolWave Volume
Normalizefalseboolbarcount
Length (no label in the script)14int · min 1ci
Offset0int (written input.integer) · min -500 · max 500CHOP

What it calculates

  • ATR / Highest / Lowest (atr, ta.atr in v5)1ci · line 39
  • Crossunder (crossunder, ta.crossunder in v5)ci, 61.8Tradecon · line 47

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.

high · low · closehigh · low · closeprice datalengthLengthsetting · 14volumevolumeprice datauseTrueRangeUse True Range instead …setting · Autoopenopenprice dataclosecloseprice datahighhighprice datalowlowprice datamethodvalueValuesetting · 14.0pricesourcePrice Sourcesetting · CloseciATR / Highest / Lowest→ ciTradeconCrossunder→ Tradeconvolvolvalueopopvaluehihivaluelolovaluecurrclosecurrclosevalueprevcloseprevclosevalueprevhigh, prevlowprevhigh · prevlow2 valuesdirectiondirectionvaluebarcountbarcountvalueresresvaluedirectionIsUpdirectionIsUpconditiondirectionIsDowndirectionIsDownconditionMomentumBullMomentumBullconditionMomentumBearMomentumBearconditionuseCloseuseCloseconditionuseOpenCloseuseOpenCloseconditiondirectionHasChangeddirectionHasChangedconditionentry:BuyOpen Buystrategy.entryentry:SellOpen Sellstrategy.entryexit:exitexit exitstrategy.exitplot:37Wave Volumeplotplot:41CHOPplothline:42hlinehlinehline:43hlinehlinefill:BackgroundBackgroundfill

Order rules

OrderFires whenBy defaultLine
Open Buy long(MomentumBull and directionIsUp and Tradecon)On49
Open Sell short(MomentumBear and directionIsDown and Tradecon )On51
Exit exit stop and limitdirectionIsDowndirection < 0On52
Exit exit stop and limitdirectionIsUpdirection > 0On53

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, and the live replay matched history.

5/5trades identical when replayed liveThe last 300 bars, from 26 Dec 2025, were fed to the engine as live ticks, four per bar, and compared with the historical run. Orders are decided once per closed bar, so nothing can change mid-bar.
  • 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−7.5%+102.5%1233%0.3111.1%26 Jan 2024 – 21 Oct 2026
BTCUSDT 4h−1.6%+5.5%1040%0.664.9%8 May 2026 – 21 Oct 2026
ETHUSDT 1D−11.0%+9.8%2348%0.4316.2%26 Jan 2024 – 21 Oct 2026
ETHUSDT 4h−5.1%+8.4%1225%0.186.1%8 May 2026 – 21 Oct 2026
SOLUSDT 1D−8.2%+16.7%1527%0.408.4%26 Jan 2024 – 21 Oct 2026
SOLUSDT 4h+1.4%+21.5%1060%1.652.2%8 May 2026 – 21 Oct 2026
BNBUSDT 1D+0.1%+148.3%1145%1.015.0%26 Jan 2024 – 21 Oct 2026
BNBUSDT 4h−4.9%+17.1%1020%0.146.0%8 May 2026 – 21 Oct 2026

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

The trades

By market direction

At entry, last 90 barsTradesWonP&L
Rising market425%−$3,495.20
Sideways market367%$513.91
Falling market520%−$4,545.55

Rising and falling mean the market moved more than 15% over the 90 bars before entry.

How bad could the drawdown be?

10.2%

The 95th percentile of the worst drawdown when the same 12 trades are reshuffled 5,000 times. The bar spans the 5th to 95th percentile, 7.5% to 10.2%; the tick is what actually happened, 8.9%. Order luck alone moves it this much.

0%12%
All 12 trades
SideEntryExitBarsP&L
long30 Mar 2024 69,850.5014 Apr 2024 63,924.5015−$848.38
short14 Apr 2024 63,924.507 Jun 2024 70,799.1054−$1,066.29
long7 Jun 2024 70,799.1011 Nov 2024 81,389.60157$1,467.22
long6 Dec 2024 96,945.603 Feb 2025 97,700.6059$77.53
short3 Feb 2025 97,700.6011 Sep 2025 113,960.00220−$1,658.05
long11 Sep 2025 113,960.0017 Dec 2025 87,863.4097−$2,243.54
short17 Dec 2025 87,863.405 Jan 2026 91,529.7019−$399.45
long5 Jan 2026 91,529.706 Feb 2026 61,636.8032−$3,113.38
short24 Feb 2026 64,656.005 Mar 2026 72,666.809−$1,142.53
long5 Mar 2026 72,666.8018 May 2026 77,457.7074$600.44
short18 May 2026 77,457.7022 Jul 2026 66,556.1065$1,290.23
long22 Jul 2026 66,556.1015 Aug 2026 63,043.6024−$490.63

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
Weis Chop Strategy this page—v4 strategy−7.5%1211.1%
Aggresive Scalper-Swing Crypto Strategy by exlux99lowest highest atrv4 strategy−7.4%316.0%
Donchian Channels Strategy by KrisWaters by kriswatershighest lowest atrv4 strategy+55.8%2123.3%
Chandelier Exit - Strategy by melihtunaatr highest lowestv4 strategy−34.8%1143.2%
ETF trader by FX_mindsatr lowest highestv4 strategy+78.3%1732.7%
Chandelier Exit by Zeal Terminalatr highest lowestv5 indicatorindicator

Where it runs

EngineCompilesRunsMatches TradingView
Zeal Terminal · OpenPineScript v2Yes 18 msYes 1,000 bars in 56 msNot measured
PineTSNo v5 and v6 only—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. PineTS runs Pine Script v5 and v6 only.

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/// © sharatgbhat//@version=4strategy("Weis Chop Strategy", overlay=false, default_qty_type = strategy.percent_of_equity, default_qty_value = 10,max_lines_count = 500, max_labels_count = 500)maxIdLossPcnt = input(1, "Max Intraday Loss(%)", type=input.float)strategy.risk.max_intraday_loss(maxIdLossPcnt, strategy.percent_of_equity)method = input(defval="ATR", options=["ATR", "Traditional", "Part of Price"], title="Renko Assignment Method")methodvalue = input(defval=14.0, type=input.float, minval=0, title="Value")pricesource = input(defval="Close", options=["Close", "Open / Close", "High / Low"], title="Price Source")useClose = pricesource == "Close"useOpenClose = pricesource == "Open / Close" or useCloseuseTrueRange = input(defval="Auto", options=["Always", "Auto", "Never"], title="Use True Range instead of Volume")isOscillating = input(defval=false, type=input.bool, title="Oscillating")normalize = input(defval=false, type=input.bool, title="Normalize")vol = useTrueRange == "Always" or useTrueRange == "Auto" and na(volume) ? tr : volumeop = useClose ? close : openhi = useOpenClose ? close >= op ? close : op : highlo = useOpenClose ? close <= op ? close : op : lowif method == "ATR"    methodvalue := atr(round(methodvalue))if method == "Part of Price"    methodvalue := close / methodvaluecurrclose = float(na)prevclose = nz(currclose[1])prevhigh = prevclose + methodvalueprevlow = prevclose - methodvaluecurrclose := hi > prevhigh ? hi : lo < prevlow ? lo : prevclosedirection = int(na)direction := currclose > prevclose ? 1 : currclose < prevclose ? -1 : nz(direction[1])directionHasChanged = change(direction) != 0directionIsUp = direction > 0directionIsDown = direction < 0barcount = 1barcount := not directionHasChanged and normalize ? barcount[1] + barcount : barcountvol := not directionHasChanged ? vol[1] + vol : volres = barcount > 1 ? vol / barcount : volplot(isOscillating and directionIsDown ? -res : res, style=plot.style_columns, color=directionIsUp ? color.green : color.red, transp=75, linewidth=3, title="Wave Volume")length = input(14, minval=1)ci = 100 * log10(sum(atr(1), length) / (highest(length) - lowest(length))) / log10(length)offset = input(0, "Offset", type = input.integer, minval = -500, maxval = 500)plot(ci, "CHOP", color=#2962FF, offset = offset)band1 = hline(61.8, "Upper Band", color=#787B86, linestyle=hline.style_dashed)band0 = hline(38.2, "Lower Band", color=#787B86, linestyle=hline.style_dashed)fill(band1, band0, color = color.rgb(33, 150, 243, 90), title = "Background")MomentumBull = close>ema(close,8)MomentumBear = close<ema(close,8)Tradecon = crossunder(ci,61.8)if (MomentumBull and directionIsUp and Tradecon)    strategy.entry("Buy", strategy.long)if (MomentumBear and directionIsDown and Tradecon )    strategy.entry("Sell", strategy.short)    strategy.exit("exit","Buy",when=directionIsDown,qty_percent=100,profit=20,loss=10)    strategy.exit("exit","Sell",when=directionIsUp,qty_percent=100,profit=20,loss=10)