Zeal Terminal Open in Zeal Terminal

Pine Script v5 · Strategy

Morning Scalp Strategy

A Pine Script v5 strategy built on Lowest (low, 5), Highest (high, 5) and EMA (rdiff, b, 3). It has 3 order rules, 1 entry among them, and trades long only with the default settings. Exits use a profit target and no stop loss. Each trade is 0 contracts and pays 0.02 commission. 9 settings; defaults include Test Period Start StartDate, Test Period End EndDate and Quantity 100.

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 Morning Scalp Strategy repaint?
No
No repainting patterns were found in the source. The live replay was not measured: it had no trades to compare.
How did Morning Scalp Strategy 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 code limits trading to a date window, which can leave this period out. It closed no trades on the other markets either. A backtest, not investment advice.
Does Morning Scalp Strategy run in Pine Script v6?
Not tested
Neither version placed a trade on any of the 8 markets, so there was nothing to compare. The v6 version is shown for reference and is not offered as a download.
Does Morning Scalp Strategy use a stop loss?
No
Its exits set a profit target but no stop.
Does Morning Scalp Strategy run in Zeal Terminal?
Yes
It compiles in 32 ms and runs 1,000 bars in 59 ms, in the browser.

BTCUSDT · 1D · default settings

  • Stochastic Momentum Index
  • SMI Signal Line
  • Over Bought
  • Over Sold
  • RSICrossover
  • 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,000AprJulOct2025AprJulOct2026AprJulOctStochastic Momentum Index$3,000$6,076Equity from $3,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. 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.
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, $3,000 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

    No stop loss

    strategy.exit is used without a stop, loss or trailing stop.

  • Note

    3 settings have no label

    In the settings dialog testPeriodStart (line 8), testPeriodEnd (line 9), EMA50Len (line 54) 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.

SettingDefaultType and rangeFeeds
Test Period Start (no label in the script)StartDatetimeentry Long line 73
Test Period End (no label in the script)EndDatetimeentry Long line 73
Quantity100int · min 1QuantityOnClose entry Long
Percent K Length5intll hh
Percent D Length3intavgrel avgdiff SMIsignal
Over Bought40floatOver Bought mycol2
Over Sold-40intOver Sold mycol1
EMA50Len (no label in the script)50intEMA50
Take Profit %10.0floatTargetPrice

What it calculates

  • Lowestlow, Percent K Length (5)ll · line 31
  • Highesthigh, Percent K Length (5)hh · line 32
  • EMAta.ema(rdiff, b), Percent D Length (3)avgrel · line 36
  • EMAta.ema(diff, b), Percent D Length (3)avgdiff · line 37
  • EMASMI, Percent D Length (3)SMIsignal · line 40
  • CrossoverSMI, SMIsignalCrossoverIndex · line 41
  • CrossunderSMI, SMIsignalCrossunderIndex · line 42
  • EMAclose, EMA50Len (50)EMA50 · line 55
  • VWAPclosevwapLine · line 58

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.

lowlowprice dataaPercent K Lengthsetting · 5highhighprice databPercent D Lengthsetting · 3closecloseprice dataEMA50LenEMA50Lensetting · 50hlc3 · volumehlc3 · volumeprice dataQuantityOnLongQuantitysetting · 100longProfitPerTake Profit %setting · 10.0ovrbgtOver Soldsetting · -40ovrsldOver Boughtsetting · 40timetimeprice datatestPeriodStartTest Period Startsetting · StartDatetestPeriodEndTest Period Endsetting · EndDatellLowest→ llhhHighest→ hhavgrelEMA→ avgrelavgdiffEMA→ avgdiffSMIsignalEMA→ SMIsignalCrossoverIndexCrossover→ CrossoverIndexCrossunderIndexCrossunder→ CrossunderIndexEMA50EMA→ EMA50vwapLineVWAP→ vwapLineQuantityOnCloseQuantityOnClosevalueMarketOpen, MorningMarketOpen · Morning2 valuesdiffdiffvaluerdiffrdiffvalueSMISMIvalueTargetPriceTargetPricevalueprofittargetprofittargetvaluecondentrycondentryconditionstoplossstoplossconditionmycol1, mycol2Colourmycol1 · mycol2entry:LongOpen Longstrategy.entryexit:Longexit Longstrategy.exitclose:LongClose Longstrategy.closeplot:43Stochastic Momentum Ind…plotplot:44SMI Signal Lineplotplot:45Over Boughtplotplot:46Over Soldplotplot:47RSICrossoverplotfill:50Fillfill × 2fill:51Fillfill × 2

Order rules

OrderFires whenBy defaultLine
Open Long long(condentry) and time > testPeriodStart and time < testPeriodEnd and MorningOn74
Exit Long limitprofittarget and strategy.position_size > 0On77
Close LongstoplossOn80

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 1D0.0%+102.5%00%—0.0%26 Jan 2024 – 21 Oct 2026
BTCUSDT 4h0.0%+5.5%00%—0.0%8 May 2026 – 21 Oct 2026
ETHUSDT 1D0.0%+9.8%00%—0.0%26 Jan 2024 – 21 Oct 2026
ETHUSDT 4h0.0%+8.4%00%—0.0%8 May 2026 – 21 Oct 2026
SOLUSDT 1D0.0%+16.7%00%—0.0%26 Jan 2024 – 21 Oct 2026
SOLUSDT 4h0.0%+21.5%00%—0.0%8 May 2026 – 21 Oct 2026
BNBUSDT 1D0.0%+148.3%00%—0.0%26 Jan 2024 – 21 Oct 2026
BNBUSDT 4h0.0%+17.1%00%—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.

ScriptSharesTypeNetTradesMax drawdown
Morning Scalp Strategy this page—v5 strategy0.0%00.0%
CC Trend strategy 2- Downtrend Short by CheatCode1ema highest lowestv5 strategyNo trades on this market
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

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.

  • 5 settings use the untyped input() (line 25, 26, 28, 54, 61). 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 verified

Neither version placed a trade on any of the 8 markets, so there was nothing to compare.

  • Line 25: input() → input.int()
  • Line 26: input() → input.int()
  • Line 28: input() → input.int()
  • Line 54: input() → input.int()
  • Line 61: input() → input.float()
⋯               //STOCK MOMENTUM INDEX//-a = input(5, 'Percent K Length')+a = input.int(5, 'Percent K Length')-b = input(3, 'Percent D Length')+b = input.int(3, 'Percent D Length')ovrsld = input.float(40, 'Over Bought')-ovrbgt = input(-40, 'Over Sold')+ovrbgt = input.int(-40, 'Over Sold')//lateleave = input(14, "Number of candles", type=input.integer)⋯                // Input EMA9 and EMA21 -EMA50Len      = input( 50 )+EMA50Len      = input.int( 50 )EMA50         = ta.ema(close, EMA50Len)⋯                        //PROFIT TARGET//-longProfitPer   = input(10.0, title='Take Profit %') / 100+longProfitPer   = input.float(10.0, title='Take Profit %') / 100TargetPrice     = strategy.position_avg_price * (1 + longProfitPer) ⋯

Does it run in Pine Script v6?

Not tested

Neither version placed a trade on any of the 8 markets, so there was nothing to compare. The v6 version is shown for reference and is not offered as a download. It differs from the v5 version by 1 edit.

⋯// © Trading_Bites-//@version=5+//@version=6strategy('Morning Scalp', overlay=false, pyramiding=2, initial_capital=3000, default_qty_value=0, commission_value=0.02, max_labels_count=500)⋯

Where it runs

EngineCompilesRunsMatches TradingView
Zeal Terminal · OpenPineScript v2Yes 32 msWith a workaround 1,000 bars in 59 msNot measured
PineTSNot testedNot testedNot 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/// © Trading_Bites//@version=5strategy('Morning Scalp', overlay=false, pyramiding=2, initial_capital=3000, default_qty_value=0, commission_value=0.02, max_labels_count=500)                    // Initial InputsStartDate =         timestamp('15Aug 2022 14:00 +0000')EndDate =           timestamp('15Aug 2022 20:00 +0000')testPeriodStart =   input.time(StartDate, 'Start of trading')testPeriodEnd =     input.time(EndDate, 'End of trading')QuantityOnLong =    input.int(title="Quantity", defval=100,  minval=1)QuantityOnClose =   QuantityOnLong////////////////////////////////////////////////////////////////////////-- Time In Rangetimeinrange(res, sess) =>    not na(time(res, sess))                //Market Open//marketopen = '0930-1600'MarketOpen = timeinrange(timeframe.period, marketopen)//////////////////////////////////////////////////////////////////////                //Market Hour//morning =   '1000-1210'Morning =   timeinrange(timeframe.period, morning)//////////////////////////////////////////////////////////////////////////               //STOCK MOMENTUM INDEX//a = input(5, 'Percent K Length')b = input(3, 'Percent D Length')ovrsld = input.float(40, 'Over Bought')ovrbgt = input(-40, 'Over Sold')//lateleave = input(14, "Number of candles", type=input.integer)// Range Calculationll = ta.lowest(low, a)hh = ta.highest(high, a)diff = hh - llrdiff = close - (hh + ll) / 2// Nested Moving Average for smoother curvesavgrel = ta.ema(ta.ema(rdiff, b), b)avgdiff = ta.ema(ta.ema(diff, b), b)// SMI calculationsSMI = avgdiff != 0 ? avgrel / (avgdiff / 2) * 100 : 0SMIsignal = ta.ema(SMI, b)CrossoverIndex = ta.crossover(SMI, SMIsignal)CrossunderIndex = ta.crossunder(SMI, SMIsignal)plot1 = plot(SMI, color=color.new(color.aqua, 0), title='Stochastic Momentum Index', linewidth=1, style=plot.style_line)plot2 = plot(SMIsignal, color=color.new(color.red, 0), title='SMI Signal Line', linewidth=1, style=plot.style_line)hline = plot(ovrsld, color=color.new(color.red, 0), title='Over Bought')lline = plot(ovrbgt, color=color.new(color.green, 0), title='Over Sold')plot(CrossoverIndex ? close : na, color=color.new(color.aqua, 0), style=plot.style_cross, linewidth=2, title='RSICrossover')mycol1 = SMIsignal > -ovrbgt ? color.red : namycol2 = SMIsignal < -ovrsld ? color.green : nafill(plot1, hline, color=color.new(mycol1, 80))fill(plot2, lline, color=color.new(mycol2, 80))//////////////////////////////////////////////////////////////////////                // Input EMA9 and EMA21 EMA50Len      = input( 50 )EMA50         = ta.ema(close, EMA50Len)//////////////////////////////////////////////////////////////////////////                // -------- VWAP  ----------//vwapLine =      ta.vwap(close)////////////////////////////////////////////////////////////////////////                        //PROFIT TARGET//longProfitPer   = input(10.0, title='Take Profit %') / 100TargetPrice     = strategy.position_avg_price * (1 + longProfitPer) //plot              (strategy.position_size > 0 ? TargetPrice : na, style=plot.style_linebr, color=color.green, linewidth=1, title="Price Target")                      //BUY STRATEGY CONDITION//condentry =     ta.crossover(SMI, SMIsignal) and SMI < 0profittarget =  TargetPricestoploss =     close < EMA50///////////////////////////STRATEGY BUILD//////////////////////////////////////if MarketOpen        if close > EMA50         if (condentry) and time > testPeriodStart and time < testPeriodEnd and Morning            strategy.entry('Long', strategy.long, qty = QuantityOnLong)                    if profittarget and strategy.position_size > 0             strategy.exit(id="Long", limit=TargetPrice)                 if stoploss    strategy.close('Long', qty = QuantityOnClose)