Zeal Terminal Open in Zeal Terminal

Pine Script v5 · Strategy

TradeIQ - Crazy Scalping Trading Strategy [Kaspricci]

A Pine Script v5 strategy built on MOM or SMA (7), Highest (close, 7) and Lowest (close, 7). It has 6 order rules, 2 entries among them, and trades long and short with the default settings. Exits use a stop loss. Each trade is one contract and pays no commission. 10 settings; defaults include TMO Length 7, TMO Source close and AMA Source close.

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 TradeIQ - Crazy Scalping Trading Strategy [Kaspricci] repaint?
No
No repainting patterns were found in the source, and a live tick-by-tick replay matched history on 3 of 3 trades.
How did TradeIQ - Crazy Scalping Trading Strategy [Kaspricci] do on BTCUSDT 1D with default settings?
+1,326.30%
From 26 Jan 2024 to 21 Oct 2026, over 6 closed trades, against +102.5% for buy and hold. A backtest, not investment advice.
Does TradeIQ - Crazy Scalping Trading Strategy [Kaspricci] 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: 6 before, 0 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 TradeIQ - Crazy Scalping Trading Strategy [Kaspricci] use a stop loss?
Yes
strategy.exit sets a stop on line 104, 110.
Does TradeIQ - Crazy Scalping Trading Strategy [Kaspricci] run in Zeal Terminal?
Yes
It compiles in 51 ms and runs 1,000 bars in 382 ms, in the browser.

BTCUSDT · 1D · default settings

  • MA
  • Extremities
  • Bullish Circle
  • Bearish Circle
  • Bullish Label
  • Bearish Label
  • 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 (10)
40,00060,00080,000100,000120,000AprJulOct2025AprJulOct2026AprJulOct$13,989$2,025Equity from $1,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
+1,326.30%
$13,263.00
Buy and hold
+102.5%
same period
Closed trades
6
2 won · 4 lost
Profitable
33.3%
of closed trades
Profit factor
2.01
gross profit ÷ gross loss
Max drawdown
1,046.36%
−$10,463.60

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

  • Likely bug

    ta.highest(high, slLength) ignores the settings line 91

    Line 91 hard-codes high where line 15 uses “TMO Source”. Changing those settings moves one band but not this one.

    ta.highest(high, slLength)ta.highest(tmoSource, slLength)
  • Likely bug

    ta.lowest(low, slLength) ignores the settings line 92

    Line 92 hard-codes low where line 16 uses “TMO Source”. Changing those settings moves one band but not this one.

    ta.lowest(low, slLength)ta.lowest(tmoSource, slLength)
  • Check

    No commission

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

  • 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
TMO Settings
TMO Length7int · min 1osc up dn
TMO Sourceclosesourceosc up dn
AMA Settings
AMA SourceclosesourcesrcFiltered deviation c
AMA Length50int · min 2x deviation os_css ohlc_os line 39 line 46
Factor2.0float · min 1deviation
As Smoothed CandlestrueboolMA line 71 plotcandle
Show Alternating ExtremitiestrueboolExtremities
AMA Kernel Parameters
LagControl the lag of the moving average (higher = more lag)1.0float · min 0 · step .1w
OvershootControl the overshoot amplitude of the moving average (higher = overshoots with an higher amplitude)0.5float · min 0 · step .1w
Stop Loss Settings
SL PeriodNumber of bars for swing high / low10int · min 1recentSwingHigh recentSwingLow

What it calculates

  • MOM / SMAta.sma(ta.sma(tmoSource, tmoLength), tmoLength), TMO Length (7)osc · line 9
  • HighestTMO Source (close), TMO Length (7)up · line 15
  • LowestTMO Source (close), TMO Length (7)dn · line 16
  • Crossunder / Changeta.change(osc), 0phosc · line 18
  • Crossover / Changeta.change(osc), 0plosc · line 19
  • Valuewhenphosc, osc, 0bear · line 21
  • Valuewhenplosc, osc, 0bull · line 22
  • SMAmath.abs(amaSource - srcFiltered), AMA Length (50)deviation · line 52
  • Crosshigh, uppercrossHigh · line 56
  • Crosslow, lowercrossLow · line 57
  • RSIsrcFiltered, AMA Length (50)os_css · line 62
  • RSIc, AMA Length (50)ohlc_os · line 76
  • Highesthigh, SL Period (10)recentSwingHigh · line 91
  • Lowestlow, SL Period (10)recentSwingLow · line 92

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 datatmoLengthTMO Lengthsetting · 7amaLengthAMA Lengthsetting · 50amaMultiFactorsetting · 2.0highhighprice datalowlowprice dataslLengthSL Periodsetting · 10amaAlphaLagsetting · 1.0amaBetaOvershootsetting · 0.5oscMOM / SMA→ oscupHighest→ updnLowest→ dnphoscCrossunder / Change→ phoscploscCrossover / Change→ ploscbearValuewhen→ bearbullValuewhen→ bulldeviationSMA→ deviationcrossHighCross→ crossHighcrossLowCross→ crossLowos_cssRSI→ os_cssohlc_osRSI→ ohlc_osrecentSwingHighHighest→ recentSwingHighrecentSwingLowLowest→ recentSwingLowxxvaluewwvaluesumsumvaluesrcFiltered, csrcFiltered · c2 valuesupper, lowerupper · lower2 valuesososvalueextextvaluehhvaluellvaluebodybodyvalueslLongslLongvalueslShortslShortvaluenewOrderID, curOrderIDnewOrderID · curOrderID2 valuesalertMessagealertMessagevaluelongEntrylongEntryconditionshortEntryshortEntryconditionlongExitlongExitconditionshortExitshortExitconditioncandleSizeIncreasingcandleSizeIncreasingconditionlongEntryCondlongEntryCondconditionshortEntryCondshortEntryCondconditionoscColor, extColorColouroscColor · extColorentry:newOrderIDOpen newOrderIDstrategy.entryexit:Stop Loss Longexit Stop Loss Longstrategy.exitclose:curOrderIDClose curOrderIDstrategy.closeexit:Stop Loss Shortexit Stop Loss Shortstrategy.exitplot:64MAplotplot:65Extremitiesplotplotcandle:77plotcandleplotcandleplotshape:79plotshapeplotshapeplotshape:80plotshapeplotshapeplotshape:81plotshapeplotshapeplotshape:82plotshapeplotshapebgcolor:93bgcolorbgcolorbgcolor:94bgcolorbgcolor

Order rules

OrderFires whenBy defaultLine
Open newOrderID long(longEntry)On103
Exit Stop Loss Long stop(longEntry)On104
Close curOrderID(longExit)On106
Open newOrderID short(shortEntry)On109
Exit Stop Loss Short stop(shortEntry)On110
Close curOrderID(shortExit)On112

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.

3/3trades 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+1,326.3%+102.5%633%2.011,046.4%26 Jan 2024 – 21 Oct 2026
BTCUSDT 4h−326.4%+5.5%20%0.00400.2%8 May 2026 – 21 Oct 2026
ETHUSDT 1D+65.6%+9.8%617%2.2759.9%26 Jan 2024 – 21 Oct 2026
ETHUSDT 4h−12.6%+8.4%714%0.4221.0%8 May 2026 – 21 Oct 2026
SOLUSDT 1D0.0%+16.7%00%—0.0%26 Jan 2024 – 21 Oct 2026
SOLUSDT 4h−0.5%+21.5%650%0.480.8%8 May 2026 – 21 Oct 2026
BNBUSDT 1D+2.1%+148.3%367%3.766.6%26 Jan 2024 – 21 Oct 2026
BNBUSDT 4h+12.4%+17.1%450%9.751.7%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 market30%−$11,543.80
Sideways market1100%$6,024.87
Falling market250%$18,781.90

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

How bad could the drawdown be?

7,268.2%

The 95th percentile of the worst drawdown when the same 6 trades are reshuffled 5,000 times. The bar spans the 5th to 95th percentile, 125.8% to 7,268.2%; the tick is what actually happened, 730.6%. Order luck alone moves it this much.

0%8,358%
All 6 trades
SideEntryExitBarsP&L
short9 Nov 2024 76,509.8010 Nov 2024 77,200.001−$690.21
short20 Dec 2024 97,461.9018 Jan 2025 104,077.0029−$6,615.61
short21 Aug 2025 114,271.001 Sep 2025 108,246.0011$6,024.87
short28 Jan 2026 89,250.003 Mar 2026 68,830.1034$20,419.90
short5 Aug 2026 64,106.6019 Aug 2026 65,744.6014−$1,638.04
short17 Sep 2026 76,206.0018 Sep 2026 80,444.001−$4,237.98

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
TradeIQ - Crazy Scalping Trading Strategy [Kaspricci] this page—v5 strategy+1,326.3%61,046.4%
Stochastic RSI + WMA + SMA strat by tweakerIDrsi sma lowest highest valuewhenv4 strategy−11.9%437.9%
VuManChu Cipher B + Divergences Strategy by nattichai001valuewhen cross lowest highest rsi smav4 strategy+76.6%17518.4%
Trend Bounce [racer8] by racer8highest lowest sma valuewhenv4 strategy+2.4%2232.2%
Stochastic RSI by Zeal Terminalrsi highest lowest smav5 indicatorindicator
Correlation Strategy by tweakerIDlowest highest valuewhen rsi smav4 strategydoes not run in Zeal Terminal

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.

  • 2 settings use the untyped input() (line 28, 29). 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

VerifiedDownload the v5 script

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

  • Line 28: input() → input.bool()
  • Line 29: input() → input.bool()
⋯amaMulti    = input.float(defval = 2.0, title = "Factor", minval = 1)-amaShowCd   = input(defval = true , title = "As Smoothed Candles")+amaShowCd   = input.bool(defval = true , title = "As Smoothed Candles")-amaShowEx   = input(defval = true,   title = "Show Alternating Extremities")+amaShowEx   = input.bool(defval = true,   title = "Show Alternating Extremities")amaAlpha    = input.float(1.0, "Lag",       minval=0, step=.1, tooltip='Control the lag of the moving average (higher = more lag)', group= 'AMA Kernel Parameters')⋯

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

⋯// © Kaspricci-//@version=5+//@version=6strategy("TradeIQ - Crazy Scalping Trading Strategy [Kaspricci]", overlay=true, initial_capital = 1000, currency = currency.USD)⋯

Where it runs

EngineCompilesRunsMatches TradingView
Zeal Terminal · OpenPineScript v2Yes 51 msYes 1,000 bars in 382 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/// © Kaspricci//@version=5strategy("TradeIQ - Crazy Scalping Trading Strategy [Kaspricci]", overlay=true, initial_capital = 1000, currency = currency.USD)headlineTMO = "TMO Settings"tmoLength   = input.int(7, "TMO Length", minval = 1, group = headlineTMO)tmoSource   = input.source(close, "TMO Source", group = headlineTMO)// calculate valuesosc         = ta.mom(ta.sma(ta.sma(tmoSource, tmoLength), tmoLength), tmoLength)// determine color of historgramoscColor    = osc > osc[1] and osc > 0 ? #00c42b : osc < osc[1] and osc > 0 ? #4ee567 : osc < osc[1] and osc < 0 ? #ff441f : osc > osc[1] and osc < 0 ? #c03920 : na// plot histogram//plot(osc, "OSC", oscColor, linewidth = 3, style = plot.style_histogram)// conditon to find highs and lowsup          = ta.highest(tmoSource, tmoLength)dn          = ta.lowest(tmoSource, tmoLength)// define conditions to be used for finding divergencephosc = ta.crossunder(ta.change(osc), 0)plosc = ta.crossover (ta.change(osc), 0)// test for divergencebear = osc > 0 and phosc and ta.valuewhen(phosc,osc,0) < ta.valuewhen(phosc,osc,1) and ta.valuewhen(phosc,up,0) > ta.valuewhen(phosc,up,1) ? 1 : 0bull = osc < 0 and plosc and ta.valuewhen(plosc,osc,0) > ta.valuewhen(plosc,osc,1) and ta.valuewhen(plosc,dn,0) < ta.valuewhen(plosc,dn,1) ? 1 : 0// -------------------------------------------------------------------------------------------------------------headlineAMA = "AMA Settings"amaSource   = input.source(defval = close, title = "AMA Source", group = headlineAMA)amaLength   = input.int(defval = 50, title = "AMA Length", minval = 2, group = headlineAMA)amaMulti    = input.float(defval = 2.0, title = "Factor", minval = 1)amaShowCd   = input(defval = true , title = "As Smoothed Candles")amaShowEx   = input(defval = true,   title = "Show Alternating Extremities")amaAlpha    = input.float(1.0, "Lag",       minval=0, step=.1, tooltip='Control the lag of the moving average (higher = more lag)', group= 'AMA Kernel Parameters')amaBeta     = input.float(0.5, "Overshoot", minval=0, step=.1, tooltip='Control the overshoot amplitude of the moving average (higher = overshoots with an higher amplitude)', group='AMA Kernel Parameters')// -------------------------------------------------------------------------------------------------------------headlineSL = "Stop Loss Settings"slLength    = input.int(defval = 10, title = "SL Period", minval = 1, group = headlineSL, tooltip = "Number of bars for swing high / low")// -------------------------------------------------------------------------------------------------------------var b       = array.new_float(0)var float x = naif barstate.isfirst    for i = 0 to amaLength - 1        x := i / (amaLength - 1)        w = math.sin(2 * 3.14159 * math.pow(x, amaAlpha)) * (1 - math.pow(x, amaBeta))        array.push(b, w)// local function to filter the sourcefilter(series float x) =>    sum = 0.    for i = 0 to amaLength - 1        sum := sum + x[i] * array.get(b,i)        sum / array.sum(b)// apply filter function on source seriessrcFiltered = filter(amaSource)deviation   = ta.sma(math.abs(amaSource - srcFiltered), amaLength) * amaMultiupper       = srcFiltered + deviationlower       = srcFiltered - deviation//----crossHigh   = ta.cross(high, upper)crossLow    = ta.cross(low, lower)var os      = 0os          := crossHigh ? 1 : crossLow ? 0 : os[1]ext         = os * upper + (1 - os) * lower//----os_css = ta.rsi(srcFiltered, amaLength) / 100extColor    = os == 1 ? #30FF85 : #ff1100plot(srcFiltered, "MA", amaShowCd ? na : color.black, 2, editable = false)plot(amaShowEx ? ext : na, "Extremities", ta.change(os) ? na : extColor, 2, editable=false)// handle smoothed candlesvar float h = navar float l = navar float c = navar float body = naif amaShowCd    h := filter(high)    l := filter(low)    c := filter(amaSource)    body := math.abs(math.avg(c[1], c[2]) - c)ohlc_os = ta.rsi(c, amaLength) / 100plotcandle(math.avg(c[1], c[2]), h, l, c, "Smooth Candles", #434651, bordercolor = na, editable = false, display = amaShowCd ? display.all : display.none)// -------------------------------------------------------------------------------------------------------------plotshape(bull ? ext : na, "Bullish Circle", shape.circle,    location.absolute, color = #00c42b, size=size.tiny)plotshape(bear ? ext : na, "Bearish Circle", shape.circle,    location.absolute, color = #ff441f, size=size.tiny)plotshape(bull ? ext : na, "Bullish Label",  shape.labeldown, location.absolute, color = #00c42b, text="Buy", textcolor=color.white, size=size.tiny)plotshape(bear ? ext : na, "Bearish Label",  shape.labelup,   location.absolute, color = #ff441f, text="Sell", textcolor=color.white, size=size.tiny)// -------------------------------------------------------------------------------------------------------------candleSizeIncreasing = body[2] < body[1] and body[1] < body[0]longEntryCond   = os == 1 and bullshortEntryCond  = os == 0 and bearlongEntry       = strategy.opentrades == 0 and candleSizeIncreasing and not candleSizeIncreasing[1] and ta.barssince(longEntryCond)  < ta.barssince(os == 0) and ta.barssince(longEntryCond) < ta.barssince(bear)shortEntry      = strategy.opentrades == 0 and candleSizeIncreasing and not candleSizeIncreasing[1] and ta.barssince(shortEntryCond) < ta.barssince(os == 1) and ta.barssince(shortEntryCond) < ta.barssince(bull)longExit        = strategy.opentrades > 0 and strategy.position_size > 0 and (bear or os == 0)shortExit       = strategy.opentrades > 0 and strategy.position_size < 0 and (bull or os == 1)recentSwingHigh = ta.highest(high, slLength) // highest high of last candlesrecentSwingLow  = ta.lowest(low,   slLength) // lowest low of recent candlesbgcolor(longEntry  ? color.rgb(76, 175, 79, 90) : na)bgcolor(shortEntry ? color.rgb(255, 82, 82, 90) : na)slLong          = (close - recentSwingLow) / syminfo.mintick  // stop loss in ticksslShort         = (recentSwingHigh - close) / syminfo.mintick // stop loss in ticksnewOrderID         = str.tostring(strategy.closedtrades + strategy.opentrades + 1)curOrderID         = str.tostring(strategy.closedtrades + strategy.opentrades)alertMessageForEntry = "Trade {0} - New {1} Entry at price: {2} with stop loss at: {3}"if (longEntry)    alertMessage = str.format(alertMessageForEntry, newOrderID, "Long", close, recentSwingLow)        strategy.entry(newOrderID, strategy.long, alert_message = alertMessage)    strategy.exit("Stop Loss Long", newOrderID, loss = slLong, alert_message = "Stop Loss for Trade " + newOrderID)if(longExit)    strategy.close(curOrderID, alert_message = "Close Trade " + curOrderID)if (shortEntry)    alertMessage = str.format(alertMessageForEntry, newOrderID, "Short", close, recentSwingLow)    strategy.entry(newOrderID, strategy.short, alert_message = alertMessage)    strategy.exit("Stop Loss Short", newOrderID, loss = slShort, alert_message = "Stop Loss for Trade " + newOrderID)if(shortExit)    strategy.close(curOrderID, alert_message = "Close Trade " + curOrderID)