Zeal Terminal Open in Zeal Terminal

Pine Script v4 · Strategy

Basic SMA 200 Strategy

A Pine Script v4 strategy built on SMA (close, 200), Crossover (close, MA) and Crossunder (close, MA). 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 is one contract and pays no commission. 1 setting; defaults include Moving Average Length 200.

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 Basic SMA 200 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 Basic SMA 200 Strategy do on BTCUSDT 1D with default settings?
+9.37%
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 Basic SMA 200 Strategy 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 Basic SMA 200 Strategy use a stop loss?
No
Every exit waits for a signal; nothing limits a losing trade before it fires.
Does Basic SMA 200 Strategy run in Zeal Terminal?
Yes
It compiles in 7 ms and runs 1,000 bars in 15 ms, in the browser.

BTCUSDT · 1D · default settings

  • Moving Average
  • Entry
  • Exit
  • 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 (1)
40,00060,00080,000100,000120,000AprJulOct2025AprJulOct2026AprJulOct$124,740$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
+9.37%
$9,369.57
Buy and hold
+102.5%
same period
Closed trades
12
2 won · 10 lost
Profitable
16.7%
of closed trades
Profit factor
1.51
gross profit ÷ gross loss
Max drawdown
9.08%
−$10,036.70

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

  • Note

    No slippage

    Fills are assumed at the exact open price. Add slippage in the properties for a more realistic test.

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 sma → ta.sma, crossover → ta.crossover, crossunder → ta.crossunder.

v4 → v5

VerifiedDownload the v5 script

Same 12 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: sma → ta.sma
  • Line 10: crossover → ta.crossover
  • Line 15: crossunder → ta.crossunder
⋯// © Ichimoku-Trading by TradersEldorado-//@version=4+//@version=5strategy("simple MA 200 cross", overlay=true)//Inputs-MA_Len = input(title="Moving Average Length", type=input.integer, defval=200)+MA_Len = input.int(title="Moving Average Length", defval=200)//Moving Average-MA = sma(close, MA_Len)+MA = ta.sma(close, MA_Len)//Entry -longCondition = crossover(close, MA)+longCondition = ta.crossover(close, MA)if (longCondition)⋯//Exit-exitCondition = crossunder(close, MA)+exitCondition = ta.crossunder(close, MA)if (exitCondition)⋯

Clean v5

Verified

Nothing to change.

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, 10 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.

⋯// © Ichimoku-Trading by TradersEldorado-//@version=5+//@version=6strategy("simple MA 200 cross", overlay=true)⋯

Settings

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

SettingDefaultType and rangeFeeds
Moving Average Length200int (written input.integer)MA

What it calculates

  • SMA (sma, ta.sma in v5)close, Moving Average Length (200)MA · line 8
  • Crossover (crossover, ta.crossover in v5)close, MAlongCondition · line 10
  • Crossunder (crossunder, ta.crossunder in v5)close, MAexitCondition · line 15

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 dataMA_LenMoving Average Lengthsetting · 200MASMA→ MAlongConditionCrossover→ longConditionexitConditionCrossunder→ exitConditionentry:LongOpen Longstrategy.entryclose:LongClose Longstrategy.closeplot:20Moving Averageplotplotshape:21Entryplotshapeplotshape:22Exitplotshape

Order rules

OrderFires whenBy defaultLine
Open Long long(longCondition)On12
Close Long(exitCondition)On17

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 1D+9.4%+102.5%1217%1.519.1%26 Jan 2024 – 21 Oct 2026
BTCUSDT 4h+9.3%+5.5%1520%2.224.8%8 May 2026 – 21 Oct 2026
ETHUSDT 1D+0.3%+9.8%714%1.540.3%26 Jan 2024 – 21 Oct 2026
ETHUSDT 4h+0.8%+8.4%540%59.340.0%8 May 2026 – 21 Oct 2026
SOLUSDT 1D−0.0%+16.7%714%0.690.0%26 Jan 2024 – 21 Oct 2026
SOLUSDT 4h+0.0%+21.5%1520%3.200.0%8 May 2026 – 21 Oct 2026
BNBUSDT 1D−0.1%+148.3%2313%0.580.2%26 Jan 2024 – 21 Oct 2026
BNBUSDT 4h+0.1%+17.1%147%2.740.1%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 market0—$0.00
Sideways market1020%$13,342.60
Falling market20%−$3,973.01

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

How bad could the drawdown be?

15.0%

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.1% to 15.0%; the tick is what actually happened, 7.5%. Order luck alone moves it this much.

0%17%
All 12 trades
SideEntryExitBarsP&L
long24 Aug 2024 64,037.2027 Aug 2024 62,834.003−$1,203.24
long25 Sep 2024 64,262.7026 Sep 2024 63,152.001−$1,110.69
long27 Sep 2024 65,174.001 Oct 2024 63,327.604−$1,846.39
long15 Oct 2024 66,084.0010 Mar 2025 80,734.50146$14,650.50
long13 Mar 2025 83,680.1014 Mar 2025 81,115.801−$2,564.34
long15 Mar 2025 83,983.2017 Mar 2025 82,574.502−$1,408.67
long20 Mar 2025 86,845.9021 Mar 2025 84,223.401−$2,622.55
long24 Mar 2025 86,082.5029 Mar 2025 84,424.405−$1,658.12
long23 Apr 2025 93,443.0018 Oct 2025 106,432.00178$12,988.70
long20 Oct 2025 108,643.0023 Oct 2025 107,567.003−$1,075.32
long24 Oct 2025 110,078.0031 Oct 2025 108,323.007−$1,755.32
long1 Nov 2025 109,608.004 Nov 2025 106,583.003−$3,024.96

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
Basic SMA 200 Strategy this page—v4 strategy+9.4%129.1%
Follow the Crypto Shorts by xtradernetsmav4 strategyNo trades on this market
buy down and sell high trend 200 sma and ma cross by willi130503smav4 strategyNo trades on this market
Mayer Multiple Strategy by xtradernetsmav4 strategyNo trades on this market
Moving Average Cross Strategy early Closing by Geduldtradersmav4 strategy+73.8%20151.5%
MFI Simple Strategy by OztheWozsmav5 strategy−0.2%283.2%

Where it runs

EngineCompilesRunsMatches TradingView
Zeal Terminal · OpenPineScript v2Yes 7 msYes 1,000 bars in 15 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/// © Ichimoku-Trading by TradersEldorado//@version=4strategy("simple MA 200 cross", overlay=true)//InputsMA_Len = input(title="Moving Average Length", type=input.integer, defval=200)//Moving AverageMA = sma(close, MA_Len)//Entry longCondition = crossover(close, MA)if (longCondition)    strategy.entry("Long", strategy.long)    //ExitexitCondition = crossunder(close, MA)if (exitCondition)    strategy.close("Long")    //Plotplot(MA, title="Moving Average")plotshape(longCondition, style=shape.arrowup, color=color.green, location=location.belowbar, size=size.normal, title="Entry", text="Entry")plotshape(exitCondition, style=shape.arrowdown, color=color.red, location=location.abovebar, size=size.normal, title="Exit", text="Exit")