Zeal Terminal Open in Zeal Terminal

Pine Script v4 · Strategy

Só Trade Top - Média de 8 - Augusto Backes

A Pine Script v4 strategy built on SMA or EMA (close[1], 8). It has 2 order rules, 1 entry among them, and trades long only with the default settings. Exits wait for a signal; there is no stop loss. Each trade commits 100% of equity and pays no commission. 3 settings; defaults include Tipo de Média EMA and Comprimento 8.

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 Só Trade Top - Média de 8 - Augusto Backes repaint?
No
No repainting patterns were found in the source, and a live tick-by-tick replay matched history on 1 of 1 trades.
How did Só Trade Top - Média de 8 - Augusto Backes do on BTCUSDT 1D with default settings?
+65.90%
From 26 Jan 2024 to 21 Oct 2026, over 8 closed trades, against +102.5% for buy and hold. A backtest, not investment advice.
Can Só Trade Top - Média de 8 - Augusto Backes be converted to Pine Script v5?
Yes
The upgrade takes 1 step, from v4; each was run before and after on the same candles with identical results, and the v5 script can be downloaded below.
Does Só Trade Top - Média de 8 - Augusto Backes use a stop loss?
No
Every exit waits for a signal; nothing limits a losing trade before it fires.
Does Só Trade Top - Média de 8 - Augusto Backes run in Zeal Terminal?
Yes
It compiles in 21 ms and runs 1,000 bars in 57 ms, in the browser.

BTCUSDT · 1D · default settings

  • Média
  • Engolfo de Alta
  • Martelo de Alta
  • PFR de Alta
  • Engolfo de Baixa
  • Martelo de Baixa
  • PFR de Baixa
  • Winning trade
  • Losing trade
  • Equity
  • Buy and hold
40,00060,00080,000100,000120,000AprJulOct2025AprJulOct2026AprJulOct$18,076$20,253Equity from $10,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. Zeal Terminal's engine currently reads an order side written as true as a short, whatever it says; this page passes the same side as strategy.long or strategy.short (line 32) so the engine trades the way the script says. 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. The live re-run is not offered here: the script requests BINANCE:BTCUSDT 1W, which this page cannot load in your browser.
Net profit
+65.90%
$6,590.01
Buy and hold
+102.5%
same period
Closed trades
8
3 won · 5 lost
Profitable
37.5%
of closed trades
Profit factor
2.10
gross profit ÷ gross loss
Max drawdown
32.16%
−$4,550.73

One run with the author's default settings, $10,000 starting capital, commission as the script sets it. A long 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 stop loss

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

  • Check

    No commission

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

  • Check

    Every trade uses all the equity

    default_qty_value is 100% of equity.

  • 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 32, 33. The upgraded version below moves each call inside an if block.

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 security → request.security, sma → ta.sma, ema → ta.ema, abs → math.abs, min → math.min, max → math.max.
  • 2 strategy calls use the when = argument (line 32, 33). It is deprecated in v5 and removed in v6, where each call moves inside an if block.

v4 → v5

Verified

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

  • Line 3: //@version=4 → //@version=5
  • Line 6: input(type = input.integer) → input.int()
  • Line 8: security → request.security
  • Line 8: sma → ta.sma
  • Line 8: security → request.security
  • Line 8: ema → ta.ema
9 more edits
  • Line 12: abs → math.abs
  • Line 12: min → math.min
  • Line 12: max → math.max
  • Line 12: abs → math.abs
  • Line 16: abs → math.abs
  • Line 16: max → math.max
  • Line 16: min → math.min
  • Line 16: abs → math.abs
  • Line 32: strategy.entry(…, true) → strategy.entry(…, strategy.long)
⋯// © Valente_F-//@version=4+//@version=5strategy("Só Trade Top - Média de 8 - Augusto Backes", overlay=true, max_bars_back = 5000, default_qty_type = strategy.percent_of_equity, default_qty_value = 100, initial_capital = 10000, commission_type = strategy.commission.percent, process_orders_on_close = true)tipo_media = input(title="Tipo de Média", defval="EMA", options=["SMA", "EMA"],inline = "3",  group = "SETUP MÉDIA DE 8", tooltip = "Média utilizada para os cálculos do Setup")-c_media = input(defval = 8, title = "Comprimento", type = input.integer,inline = "3",  group = "SETUP MÉDIA DE 8")+c_media = input.int(defval = 8, title = "Comprimento",inline = "3",  group = "SETUP MÉDIA DE 8")cb_raro = input(true, title="Habilitar Sinal Raro", group = "SETUP MÉDIA DE 8", tooltip = "Sinais normais são caracterizados por Engolfos, Martelos e Preço de Fechamento de Reversão com FECHAMENTO acima da Média de 8. Sinais Raros são caracterizados pelas mesmas figuras, mas com FECHAMENTO e ABERTURA acima da média de 8. O mesmo vale para sinais de venda.")-media8 = tipo_media == "SMA" ? security(syminfo.tickerid, "1W", sma(close[1], c_media)) : security(syminfo.tickerid, "1W", ema(close[1], c_media))+media8 = tipo_media == "SMA" ? request.security(syminfo.tickerid, "1W", ta.sma(close[1], c_media)) : request.security(syminfo.tickerid, "1W", ta.ema(close[1], c_media))plot(media8, title = "Média", color = color.green, linewidth = 2)⋯candle_engolfo = (close > open and close[1] < open[1] and close >= open[1] and open <= close[1] ) and close>media8-candle_martelo = 2*abs(close-open) < (min(close, open)-low) and (high - max(close, open)) < abs(close-open) and close>open and close>media8+candle_martelo = 2*math.abs(close-open) < (math.min(close, open)-low) and (high - math.max(close, open)) < math.abs(close-open) and close>open and close>media8candle_fr = low < low[1] and low < low[2] and close > close[1] and close > open  and close>media8⋯vcandle_engolfo = (close < open and close[1] > open[1] and close <= open[1] and open >= close[1]) and close<media8-vcandle_martelo = 2*abs(close-open) < (high-max(close, open)) and (min(close, open)-low) < abs(close-open) and close<open  and close<media8+vcandle_martelo = 2*math.abs(close-open) < (high-math.max(close, open)) and (math.min(close, open)-low) < math.abs(close-open) and close<open  and close<media8vcandle_fr = high > high[1] and high > high[2] and close < close[1] and close < open  and close<media8⋯plotshape(venda and vcandle_fr and strategy.position_size>0, title = "PFR de Baixa", style = shape.labelup, location =  location.belowbar, color = color.red, text = "PFR de Baixa", textcolor = color.white)-strategy.entry("Compra", true, when = compra)+strategy.entry("Compra", strategy.long, when = compra)strategy.close("Compra", when = venda)

Clean v5

VerifiedDownload the v5 script

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

  • Line 5: input() → input.string()
  • Line 7: input() → input.bool()
  • Line 32: when = compra → if block
  • Line 33: when = venda → if block
⋯strategy("Só Trade Top - Média de 8 - Augusto Backes", overlay=true, max_bars_back = 5000, default_qty_type = strategy.percent_of_equity, default_qty_value = 100, initial_capital = 10000, commission_type = strategy.commission.percent, process_orders_on_close = true)-tipo_media = input(title="Tipo de Média", defval="EMA", options=["SMA", "EMA"],inline = "3",  group = "SETUP MÉDIA DE 8", tooltip = "Média utilizada para os cálculos do Setup")+tipo_media = input.string(title="Tipo de Média", defval="EMA", options=["SMA", "EMA"],inline = "3",  group = "SETUP MÉDIA DE 8", tooltip = "Média utilizada para os cálculos do Setup")c_media = input.int(defval = 8, title = "Comprimento",inline = "3",  group = "SETUP MÉDIA DE 8")-cb_raro = input(true, title="Habilitar Sinal Raro", group = "SETUP MÉDIA DE 8", tooltip = "Sinais normais são caracterizados por Engolfos, Martelos e Preço de Fechamento de Reversão com FECHAMENTO acima da Média de 8. Sinais Raros são caracterizados pelas mesmas figuras, mas com FECHAMENTO e ABERTURA acima da média de 8. O mesmo vale para sinais de venda.")+cb_raro = input.bool(true, title="Habilitar Sinal Raro", group = "SETUP MÉDIA DE 8", tooltip = "Sinais normais são caracterizados por Engolfos, Martelos e Preço de Fechamento de Reversão com FECHAMENTO acima da Média de 8. Sinais Raros são caracterizados pelas mesmas figuras, mas com FECHAMENTO e ABERTURA acima da média de 8. O mesmo vale para sinais de venda.")media8 = tipo_media == "SMA" ? request.security(syminfo.tickerid, "1W", ta.sma(close[1], c_media)) : request.security(syminfo.tickerid, "1W", ta.ema(close[1], c_media))⋯plotshape(venda and vcandle_fr and strategy.position_size>0, title = "PFR de Baixa", style = shape.labelup, location =  location.belowbar, color = color.red, text = "PFR de Baixa", textcolor = color.white)-strategy.entry("Compra", strategy.long, when = compra)+if compra+    strategy.entry("Compra", strategy.long)-strategy.close("Compra", when = venda)+if venda+    strategy.close("Compra")

Does it run in Pine Script v6?

Yes

Same 8 trades and the same P&L on BTCUSDT 1D, 1,000 bars, in Zeal Terminal's engine. Both versions were run on Zeal Terminal's engine, and the results are identical. It differs from the v5 version by 1 edit.

Download the v6 script

⋯// © Valente_F-//@version=5+//@version=6strategy("Só Trade Top - Média de 8 - Augusto Backes", overlay=true, max_bars_back = 5000, default_qty_type = strategy.percent_of_equity, default_qty_value = 100, initial_capital = 10000, commission_type = strategy.commission.percent, process_orders_on_close = true)⋯

Settings

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

SettingDefaultType and rangeFeeds
SETUP MÉDIA DE 8
Tipo de MédiaMédia utilizada para os cálculos do SetupEMAstring · options ["SMA", "EMA"]media8
Comprimento8int (written input.integer)media8
Habilitar Sinal RaroSinais normais são caracterizados por Engolfos, Martelos e Preço de Fechamento de Reversão com FECHAMENTO acima da Média de 8. Sinais Raros são caracterizados pelas mesmas figuras, mas com FECHAMENTO e ABERTURA acima da média de 8. O mesmo vale para sinais de venda.trueboolline 19

What it calculates

  • SMA / EMA (sma, ta.sma in v5)close[1], Comprimento (8) · chosen by Tipo de Médiamedia8 · line 8

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 datatipo_mediaTipo de Médiasetting · EMAc_mediaComprimentosetting · 8openopenprice datahighhighprice datalowlowprice datamedia8SMA / EMA→ media8 · by Tipo de Médiacompracompraconditionvendavendaconditioncandle_engolfo, vcandle_engolfocandle_engolfo · vcandl…2 conditionscandle_martelo, vcandle_martelocandle_martelo · vcandl…2 conditionscandle_frcandle_frconditionvcandle_frvcandle_frconditionentry:CompraOpen Comprastrategy.entryclose:CompraClose Comprastrategy.closeplot:9Médiaplotbarcolor:25barcolorbarcolorplotshape:26Engolfo de Altaplotshapeplotshape:27Martelo de Altaplotshapeplotshape:28PFR de Altaplotshapeplotshape:29Engolfo de Baixaplotshapeplotshape:30Martelo de Baixaplotshapeplotshape:31PFR de Baixaplotshape

Order rules

OrderFires whenBy defaultLine
Open Compra longcompra(candle_engolfo or candle_martelo or candle_fr) ⟶ compra and open > media8 ⟶ compraOn32
Close Compravenda(vcandle_engolfo or vcandle_martelo or vcandle_fr) ⟶ venda and open <media8 ⟶ vendaOn33

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.

1/1trades 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 data2 security call(s), none with lookahead on.
  • 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 timingprocess_orders_on_close = true: orders fill at the signal bar's close.

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+65.9%+102.5%838%2.1032.2%26 Jan 2024 – 21 Oct 2026
BTCUSDT 4h−11.9%+5.5%30%0.0012.5%8 May 2026 – 21 Oct 2026
ETHUSDT 1D+29.6%+9.8%944%1.3450.1%26 Jan 2024 – 21 Oct 2026
ETHUSDT 4h+21.3%+8.4%250%4.819.7%8 May 2026 – 21 Oct 2026
SOLUSDT 1D−2.7%+16.7%944%0.9735.5%26 Jan 2024 – 21 Oct 2026
SOLUSDT 4h+10.9%+21.5%333%1.6816.6%8 May 2026 – 21 Oct 2026
BNBUSDT 1D+119.2%+148.3%743%2.6831.5%26 Jan 2024 – 21 Oct 2026
BNBUSDT 4h+13.0%+17.1%250%2.939.5%8 May 2026 – 21 Oct 2026

Higher-timeframe data for request.security(): BINANCE:BTCUSDT 1W (Binance BTCUSDT 1w), fetched from Binance's public market data for each market.

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

The trades

By market direction

At entry, last 90 barsTradesWonP&L
Rising market20%−$1,090.74
Sideways market560%$10,611.00
Falling market10%−$2,930.25

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

How bad could the drawdown be?

32.3%

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

0%37%
All 8 trades
SideEntryExitBarsP&L
long29 Jan 2024 43,302.7017 Apr 2024 61,277.4079$4,150.94
long25 Apr 2024 64,498.3028 Apr 2024 63,118.603−$302.71
long17 May 2024 67,024.0023 Jun 2024 63,210.0037−$788.03
long19 Jul 2024 66,660.0011 Aug 2024 58,712.6023−$1,557.08
long24 Sep 2024 64,262.707 Feb 2025 96,506.80136$5,771.74
long24 Apr 2025 93,980.5029 Aug 2025 108,377.00127$2,646.35
long15 Sep 2025 115,350.0014 Oct 2025 113,028.0029−$400.94
long15 Apr 2026 74,810.0012 Jun 2026 63,580.0058−$2,930.25

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
Só Trade Top - Média de 8 - Augusto Backes this page—v4 strategy+65.9%832.2%
MACD Long Strat by TheGrindTodayema smav4 strategy+24.0%7920.1%
Stock trending strategy by exlux99ema smav4 strategy+35.3%2114.7%
4-Hour Stochastic EMA Trend by slymnturkogluema smav4 strategyNo trades on this market
4X EMA and volume strategy by SoftKill21ema smav4 strategy+1.8%325.8%
Simple Momentum Strategy Based on SMA, EMA and Volume by slip_streamsma emav4 strategy+7.4%1827.4%

Where it runs

EngineCompilesRunsMatches TradingView
Zeal Terminal · OpenPineScript v2Yes 21 msWith a workaround 1,000 bars in 57 msNot measured
PineTSNo v5 and v6 only—Not measured

Zeal Terminal's engine currently reads an order side written as true as a short, whatever it says; this page passes the same side as strategy.long or strategy.short (line 32) so the engine trades the way the script says. 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. 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/// © Valente_F//@version=4strategy("Só Trade Top - Média de 8 - Augusto Backes", overlay=true, max_bars_back = 5000, default_qty_type = strategy.percent_of_equity, default_qty_value = 100, initial_capital = 10000, commission_type = strategy.commission.percent, process_orders_on_close = true)tipo_media = input(title="Tipo de Média", defval="EMA", options=["SMA", "EMA"],inline = "3",  group = "SETUP MÉDIA DE 8", tooltip = "Média utilizada para os cálculos do Setup")c_media = input(defval = 8, title = "Comprimento", type = input.integer,inline = "3",  group = "SETUP MÉDIA DE 8")cb_raro = input(true, title="Habilitar Sinal Raro", group = "SETUP MÉDIA DE 8", tooltip = "Sinais normais são caracterizados por Engolfos, Martelos e Preço de Fechamento de Reversão com FECHAMENTO acima da Média de 8. Sinais Raros são caracterizados pelas mesmas figuras, mas com FECHAMENTO e ABERTURA acima da média de 8. O mesmo vale para sinais de venda.")media8 = tipo_media == "SMA" ? security(syminfo.tickerid, "1W", sma(close[1], c_media)) : security(syminfo.tickerid, "1W", ema(close[1], c_media))plot(media8, title = "Média", color = color.green, linewidth = 2)lookback_swing=5candle_engolfo = (close > open and close[1] < open[1] and close >= open[1] and open <= close[1] ) and close>media8candle_martelo = 2*abs(close-open) < (min(close, open)-low) and (high - max(close, open)) < abs(close-open) and close>open and close>media8candle_fr = low < low[1] and low < low[2] and close > close[1] and close > open  and close>media8compra = (candle_engolfo or candle_martelo or candle_fr) vcandle_engolfo = (close < open and close[1] > open[1] and close <= open[1] and open >= close[1]) and close<media8vcandle_martelo = 2*abs(close-open) < (high-max(close, open)) and (min(close, open)-low) < abs(close-open) and close<open  and close<media8vcandle_fr = high > high[1] and high > high[2] and close < close[1] and close < open  and close<media8venda = (vcandle_engolfo or vcandle_martelo or vcandle_fr) if cb_raro    compra := compra and open > media8    venda := venda and open <media8else    compra := compra    venda := vendabarcolor(compra and strategy.position_size==0?color.green:venda and strategy.position_size>0?color.red : color.new(color.black, 100))plotshape(compra and candle_engolfo and strategy.position_size==0, title = "Engolfo de Alta", style = shape.labeldown, color = color.green, text = "Engolfo de Alta", textcolor = color.white)plotshape(compra and candle_martelo and strategy.position_size==0, title = "Martelo de Alta", style = shape.labeldown, color = color.green, text = "Martelo de Alta", textcolor = color.white)plotshape(compra and candle_fr and strategy.position_size==0, title = "PFR de Alta", style = shape.labeldown, color = color.green, text = "PFR de Alta", textcolor = color.white)plotshape(venda and vcandle_engolfo and strategy.position_size>0, title = "Engolfo de Baixa", style = shape.labelup, location =  location.belowbar, color = color.red, text = "Engolfo de Baixa", textcolor = color.white)plotshape(venda and vcandle_martelo and strategy.position_size>0, title = "Martelo de Baixa", style = shape.labelup, location =  location.belowbar, color = color.red, text = "Martelo de Baixa", textcolor = color.white)plotshape(venda and vcandle_fr and strategy.position_size>0, title = "PFR de Baixa", style = shape.labelup, location =  location.belowbar, color = color.red, text = "PFR de Baixa", textcolor = color.white)strategy.entry("Compra", true, when = compra)strategy.close("Compra", when = venda)