Zeal Terminal Open in Zeal Terminal

Pine Script v5 · Strategy

BUY-SELL on the levels only

A Pine Script v5 strategy built on Lowest (low, 100), Highest (high, 100) and Supertrend (2.5, 10). It has 2 order rules and no entry of its own. Exits wait for a signal; there is no stop loss. Each trade is one contract and pays 0.05% commission. 2 settings; defaults include ATR Length 10 and Factor 2.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 BUY-SELL on the levels only repaint?
No
No repainting patterns were found in the source. The live replay was not measured: it had no trades to compare.
How did BUY-SELL on the levels only 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.
Does BUY-SELL on the levels only 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 BUY-SELL on the levels only use a stop loss?
No
Every exit waits for a signal; nothing limits a losing trade before it fires.
Does BUY-SELL on the levels only run in Zeal Terminal?
Yes
It compiles in 43 ms and runs 1,000 bars in 542 ms, in the browser.

BTCUSDT · 1D · default settings

  • Max
  • Min
  • max
  • min
  • Plot
  • Up Trend
  • Down Trend
  • Plot
  • 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 (2)
50,000100,000AprJulOct2025AprJulOct2026AprJulOct$5,000$10,126Equity from $5,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
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, $5,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

    Every exit waits for a signal. Nothing limits a losing trade before the exit condition fires.

  • 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
ATR Length10intsupertrend direction
Factor2.5float · step 0.01supertrend direction

What it calculates

  • Lowestlow, 100lowest0 · line 10
  • Highesthigh, 100highest0 · line 11
  • SupertrendFactor (2.5), ATR Length (10)supertrend · line 36
  • SupertrendFactor (2.5), ATR Length (10)direction · line 36

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 datahighhighprice datahigh · low · closehigh · low · closeprice datafactorFactorsetting · 2.5atrPeriodATR Lengthsetting · 10closecloseprice dataopenopenprice datalowest0Lowest→ lowest0highest0Highest→ highest0supertrendSupertrend→ supertrenddirectionSupertrend→ directionlast_minlast_minvaluelast_maxlast_maxvalueggvalueSELL_amountSELL_amountvaluestrategy_shortstrategy_shortvalueorder:str.tostring(i)order str.tostring(i)strategy.orderorder:str.tostring(strategy_short)order str.tostring(stra…strategy.orderplot:27Maxplotplot:28Minplotplot:29maxplotplot:30minplotfill:31Fillfill × 4fill:32Fillfill × 4plot:37plotplotplot:38Up Trendplotplot:39Down Trendplotfill:40Fillfill × 4fill:41Fillfill × 4plot:67plotplot

Order rules

OrderFires whenBy defaultLine
order str.tostring(i) longarray.get(count_of_orders, i) > 0On50
order str.tostring(strategy_short) shortarray.get(price_to_sellBue, i) <= open[0] and array.get(price_to_sellBue, i) >= close[0]On63

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
BUY-SELL on the levels only this page—v5 strategy0.0%00.0%
Buy-Sell on the levels by Arivadislowest highest supertrendv5 strategyNo trades on this market
AlignedMA and Cumulative HighLow Strategy by Trendoscopesupertrend highest lowestv4 strategy+32.4%2234.1%
Alex Days HiLo Rajib by 14rajibhighest lowestv4 strategyNo trades on this market
Donchian Strat EXMO by pskoroplashighest lowestv4 strategy+12.1%2268.0%
Average Highest High and Lowest Low Swinger Strategy by exlux99lowest highestv4 strategy+6.4%2049.6%

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.

  • 1 setting uses the untyped input() (line 34). 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 34: input() → input.int()
⋯//Supertrend-atrPeriod = input(10, "ATR Length")+atrPeriod = input.int(10, "ATR Length")factor = input.float(2.5, "Factor", step = 0.01)⋯

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.

⋯// © svatvlad1993-//@version=5+//@version=6strategy("test for more freq","BUY/SELL test for more freq",pyramiding=100 , overlay=true, currency=currency.USDT, commission_type=strategy.commission.percent,⋯

Where it runs

EngineCompilesRunsMatches TradingView
Zeal Terminal · OpenPineScript v2Yes 43 msYes 1,000 bars in 542 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/// © svatvlad1993//@version=5strategy("test for more freq","BUY/SELL test for more freq",pyramiding=100 , overlay=true, currency=currency.USDT, commission_type=strategy.commission.percent,     commission_value=0.05,initial_capital=5000, margin_long=10, margin_short=10, max_lines_count = 500, max_labels_count = 500, max_bars_back = 5000)//, default_qty_type=strategy.percent_of_equity, default_qty_value=4)// tail-resistance for buyvar last_min = low[0]var last_max = high[0]var permission_for_buy = 0lowest0 = ta.lowest(low,100)highest0 = ta.highest(high,100)if close > last_max    if lowest0 != 0        last_min := lowest0    else        last_min := close - (close * 0.02)    last_max := high    permission_for_buy := 1    if close < last_min    last_min := low    if highest0 != 0        last_max := highest0    else        last_max := close + (close * 0.02)    permission_for_buy := 0plot_diaps1 = plot(permission_for_buy != 0? na : last_max, title='Max',color=color.new(#ff0000, 95),style=plot.style_cross,trackprice=true )plot_diaps2 = plot(permission_for_buy != 0? na : last_min, title='Min',color=color.new(#ff0000, 95),style=plot.style_cross,trackprice=true )plot_diaps3 = plot(permission_for_buy != 1? na : last_max, title='max',color=color.new(color.green, 95),style=plot.style_cross,trackprice=true )plot_diaps4 = plot(permission_for_buy != 1? na : last_min, title='min',color=color.new(color.green, 95),style=plot.style_cross,trackprice=true )fill(plot_diaps1, plot_diaps2,color=color.new(#ff0000, 95))fill(plot_diaps3, plot_diaps4,color=color.new(color.green, 95))//SupertrendatrPeriod = input(10, "ATR Length")factor = input.float(2.5, "Factor", step = 0.01)[supertrend, direction] = ta.supertrend(factor, atrPeriod)bodyMiddle = plot((open + close) / 2, display=display.none)upTrend = plot(direction < 0 ? supertrend : na, "Up Trend", color = color.teal, style=plot.style_linebr)downTrend = plot(direction < 0? na : supertrend, "Down Trend", color = color.maroon, style=plot.style_linebr)fill(bodyMiddle, upTrend, color.new(color.teal, 75), fillgaps=false)fill(bodyMiddle, downTrend, color.new(color.maroon, 75), fillgaps=false)// levels sell/buyvar float[] price_to_sellBue = array.from(1.01, 1.02, 1.03, 1.04, 1.05, 1.06, 1.071, 1.082, 1.093, 1.104, 1.115, 1.126, 1.137, 1.148, 1.159, 1.171, 1.183, 1.195, 1.207, 1.219, 1.231, 1.243, 1.255, 1.268, 1.281, 1.294, 1.307, 1.32, 1.333, 1.346, 1.359, 1.373, 1.387, 1.401, 1.415, 1.429, 1.443, 1.457, 1.472, 1.487, 1.502, 1.517, 1.532, 1.547, 1.562, 1.578, 1.594, 1.61, 1.626, 1.642, 1.658, 1.675, 1.692, 1.709, 1.726, 1.743, 1.76, 1.778, 1.796, 1.814, 1.832, 1.85, 1.869, 1.888, 1.907, 1.926, 1.945, 1.964, 1.984, 2.004, 2.024, 2.044, 2.064, 2.085, 2.106, 2.127, 2.148, 2.169, 2.191, 2.213, 2.235, 2.257, 2.28, 2.303, 2.326, 2.349, 2.372, 2.396, 2.42, 2.444, 2.468, 2.493, 2.518, 2.543, 2.568, 2.594, 2.62, 2.646, 2.672, 2.699, 2.726, 2.753,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 ,2.0 ,2.0 ,2.0)//loops for sale/buyfor i = 0 to 139    if array.get(price_to_sellBue, i) >= open[0] and array.get(price_to_sellBue, i) <= close[0] and     direction[0] < 0 and permission_for_buy != 0        if array.get(count_of_orders, i) > 0            strategy.order(str.tostring(i), strategy.long, 15)            g = array.get(count_of_orders, i)            array.set(count_of_orders, i, g - 2)            breakvar SELL_amount = 0var strategy_short = 0for i = 0 to 139    if array.get(price_to_sellBue, i) <= open[0] and array.get(price_to_sellBue, i) >= close[0]        for j = 0 to i-1             if array.get(count_of_orders, j) != 2                strategy_short := strategy_short + 1                array.set(count_of_orders, j, 2)                SELL_amount := SELL_amount + 15        strategy.order(str.tostring(strategy_short),strategy.short, SELL_amount)        SELL_amount := 0        break// добавить SMA и продавать при низходящем трендеplot(strategy.equity)