Zeal Terminal Open in Zeal Terminal

Pine Script v4 · Strategy

FMC

A Pine Script v4 strategy built on SMA (close, 100), RSI (close, 2) and Crossover (Vrsi, 70). 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. 12 settings; defaults include Source close, SMA Length 100 and RSI Length 2.

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 FMC repaint?
No
No repainting patterns were found in the source, and a live tick-by-tick replay matched history on 12 of 12 trades.
How did FMC do on BTCUSDT 1D with default settings?
+139.48%
From 26 Jan 2024 to 21 Oct 2026, over 44 closed trades, against +102.5% for buy and hold. A backtest, not investment advice.
Can FMC 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 FMC use a stop loss?
No
Every exit waits for a signal; nothing limits a losing trade before it fires.
Does FMC run in Zeal Terminal?
Yes
It compiles in 11 ms and runs 1,000 bars in 46 ms, in the browser.

BTCUSDT · 1D · default settings

  • Bollinger SMA
  • Bollinger Upper Band
  • Bollinger Lower Band
  • 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 (12)
40,00060,00080,000100,000120,000AprJulOct2025AprJulOct2026AprJulOct$23,948$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 long = true as a short, whatever it says; this page passes the same side as strategy.long or strategy.short (line 61) so the engine trades the way the script says.
Net profit
+139.48%
$13,948.00
Buy and hold
+102.5%
same period
Closed trades
44
29 won · 15 lost
Profitable
65.9%
of closed trades
Profit factor
1.24
gross profit ÷ gross loss
Max drawdown
111.91%
−$32,314.50

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

  • Likely bug

    crossover(percent_bb, 1) ignores the settings line 47

    Line 47 hard-codes 1 where line 20 uses “RSI Overbought Threshold”. Changing those settings moves one band but not this one.

    crossover(percent_bb, 1)crossover(percent_bb, rsi_ob_threshold)
  • Likely bug

    crossunder(percent_bb, 0) ignores the settings line 48

    Line 48 hard-codes 0 where line 21 uses “RSI Overbought Threshold”. Changing those settings moves one band but not this one.

    crossunder(percent_bb, 0)crossunder(percent_bb, rsi_ob_threshold)
  • 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.

  • Note

    Uses transp =, which v5 removed line 55

    transp = on line 55. v5 folds the transparency into the colour with color.new(c, transp).

  • Note

    Uses long =, which v5 renamed line 61

    long = on line 61. v5 writes it as direction = strategy.long or strategy.short.

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

v4 → v5

Verified

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

  • Line 3: //@version=4 → //@version=5
  • Line 9: sma → ta.sma
  • Line 17: rsi → ta.rsi
  • Line 20: crossover → ta.crossover
  • Line 21: crossunder → ta.crossunder
  • Line 22: crossunder → ta.crossunder
19 more edits
  • Line 23: crossover → ta.crossover
  • Line 24: crossover → ta.crossover
  • Line 25: crossunder → ta.crossunder
  • Line 28: crossover → ta.crossover
  • Line 29: crossunder → ta.crossunder
  • Line 32: sma → ta.sma
  • Line 34: stdev → ta.stdev
  • Line 37: crossover → ta.crossover
  • Line 38: crossunder → ta.crossunder
  • Line 39: crossunder → ta.crossunder
  • Line 40: crossover → ta.crossover
  • Line 41: crossover → ta.crossover
  • Line 42: crossunder → ta.crossunder
  • Line 47: crossover → ta.crossover
  • Line 48: crossunder → ta.crossunder
  • Line 51: crossover → ta.crossover
  • Line 52: crossunder → ta.crossunder
  • Line 55: transp = 80 → color.new(color.teal, 80)
  • Line 61: long = true → direction = strategy.long
⋯// © oliverbadaoui-//@version=4+//@version=5strategy("FMC", overlay=true, pyramiding=0, initial_capital=10000)⋯sma_length = input(100, title="SMA Length")-Vsma=sma(source, sma_length)+Vsma=ta.sma(source, sma_length)// RELATIVE STRENGTH INDEX (RSI) ⋯rsi_os_earlywarning_threshold = input(25, title="RSI Oversold Early Warning")-Vrsi = rsi(source, rsi_length)+Vrsi = ta.rsi(source, rsi_length)rsi_ob = Vrsi > rsi_ob_thresholdrsi_os = Vrsi < rsi_os_threshold-rsi_ob_crossover = crossover(Vrsi, rsi_ob_threshold)+rsi_ob_crossover = ta.crossover(Vrsi, rsi_ob_threshold)-rsi_ob_crossunder = crossunder(Vrsi, rsi_ob_threshold)+rsi_ob_crossunder = ta.crossunder(Vrsi, rsi_ob_threshold)-rsi_os_crossunder = crossunder(Vrsi, rsi_os_threshold)+rsi_os_crossunder = ta.crossunder(Vrsi, rsi_os_threshold)-rsi_os_crossover = crossover(Vrsi, rsi_os_threshold)+rsi_os_crossover = ta.crossover(Vrsi, rsi_os_threshold)-rsi_mid_crossover = crossover(Vrsi, rsi_mid)+rsi_mid_crossover = ta.crossover(Vrsi, rsi_mid)-rsi_mid_crossunder = crossunder(Vrsi, rsi_mid)+rsi_mid_crossunder = ta.crossunder(Vrsi, rsi_mid)rsi_above_mid = Vrsi > rsi_midrsi_below_mid = Vrsi < rsi_mid-rsi_ob_earlywarning = crossover(Vrsi, rsi_ob_earlywarning_threshold)+rsi_ob_earlywarning = ta.crossover(Vrsi, rsi_ob_earlywarning_threshold)-rsi_os_earlywarning = crossunder(Vrsi, rsi_os_earlywarning_threshold)+rsi_os_earlywarning = ta.crossunder(Vrsi, rsi_os_earlywarning_threshold)// BOLLINGER BANDS (BB) bb_sma_length = input(20, title="Bollinger SMA Length")-bb_sma = sma(source, bb_sma_length)+bb_sma = ta.sma(source, bb_sma_length)stdev_mult = input(2, title="Number of St. Devs.")-Vstdev = stdev_mult * stdev(source, bb_sma_length)+Vstdev = stdev_mult * ta.stdev(source, bb_sma_length)upperband = bb_sma + Vstdevlowerband = bb_sma - Vstdev-upper_bb_crossover = crossover(source,upperband)+upper_bb_crossover = ta.crossover(source,upperband)-upper_bb_crossunder = crossunder(source,upperband)+upper_bb_crossunder = ta.crossunder(source,upperband)-bb_sma_crossunder = crossunder(source, bb_sma)+bb_sma_crossunder = ta.crossunder(source, bb_sma)-bb_sma_crossover = crossover(source, bb_sma)+bb_sma_crossover = ta.crossover(source, bb_sma)-lower_bb_crossover = crossover(source, lowerband)+lower_bb_crossover = ta.crossover(source, lowerband)-lower_bb_crossunder = crossunder(source, lowerband)+lower_bb_crossunder = ta.crossunder(source, lowerband)above_upper_bb = source > upperband⋯percent_bb_os = percent_bb < 0-percent_bb_ob_crossover = crossover(percent_bb, 1)+percent_bb_ob_crossover = ta.crossover(percent_bb, 1)-percent_bb_os_crossunder = crossunder(percent_bb, 0)+percent_bb_os_crossunder = ta.crossunder(percent_bb, 0)percent_bb_ob_earlywarning_threshold = input(0.9, title="BB Overbought Early Warning")percent_bb_os_earlywarning_threshold = input(0.1, title="BB Oversold Early Warning")-percent_bb_ob_earlywarning = crossover(percent_bb, percent_bb_ob_earlywarning_threshold)+percent_bb_ob_earlywarning = ta.crossover(percent_bb, percent_bb_ob_earlywarning_threshold)-percent_bb_os_earlywarning = crossunder(percent_bb, percent_bb_os_earlywarning_threshold)+percent_bb_os_earlywarning = ta.crossunder(percent_bb, percent_bb_os_earlywarning_threshold)// PLOTS & SIGNALS// BB-bb_sma_plot = plot(series=bb_sma, title="Bollinger SMA", color=color.teal, transp=80)+bb_sma_plot = plot(series=bb_sma, title="Bollinger SMA", color=color.new(color.teal, 80))upperband_plot = plot(series=upperband, title="Bollinger Upper Band", color=color.rgb(26, 80, 74), linewidth=1)⋯if(rsi_os)-    strategy.entry(id="Bull", long=true)+    strategy.entry(id="Bull", direction = strategy.long)if(rsi_ob)⋯

Clean v5

VerifiedDownload the v5 script

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

  • Line 6: input() → input.source()
  • Line 8: input() → input.int()
  • Line 11: input() → input.int()
  • Line 12: input() → input.int()
  • Line 13: input() → input.int()
  • Line 14: input() → input.int()
6 more edits
  • Line 15: input() → input.int()
  • Line 16: input() → input.int()
  • Line 31: input() → input.int()
  • Line 33: input() → input.int()
  • Line 49: input() → input.float()
  • Line 50: input() → input.float()
⋯// GLOBAL VARIABLES-source = input(close, title="Source")+source = input.source(close, title="Source")//SMA-sma_length = input(100, title="SMA Length")+sma_length = input.int(100, title="SMA Length")Vsma=ta.sma(source, sma_length)// RELATIVE STRENGTH INDEX (RSI) -rsi_length = input(2, title="RSI Length")+rsi_length = input.int(2, title="RSI Length")-rsi_ob_threshold = input(70, title="RSI Overbought Threshold")+rsi_ob_threshold = input.int(70, title="RSI Overbought Threshold")-rsi_os_threshold = input(10, title="RSI Oversold Threshold")+rsi_os_threshold = input.int(10, title="RSI Oversold Threshold")-rsi_mid = input(50, title="RSI Midrange")+rsi_mid = input.int(50, title="RSI Midrange")-rsi_ob_earlywarning_threshold = input(75, title="RSI Overbought Early Warning")+rsi_ob_earlywarning_threshold = input.int(75, title="RSI Overbought Early Warning")-rsi_os_earlywarning_threshold = input(25, title="RSI Oversold Early Warning")+rsi_os_earlywarning_threshold = input.int(25, title="RSI Oversold Early Warning")Vrsi = ta.rsi(source, rsi_length)⋯// BOLLINGER BANDS (BB) -bb_sma_length = input(20, title="Bollinger SMA Length")+bb_sma_length = input.int(20, title="Bollinger SMA Length")bb_sma = ta.sma(source, bb_sma_length)-stdev_mult = input(2, title="Number of St. Devs.")+stdev_mult = input.int(2, title="Number of St. Devs.")Vstdev = stdev_mult * ta.stdev(source, bb_sma_length)⋯percent_bb_os_crossunder = ta.crossunder(percent_bb, 0)-percent_bb_ob_earlywarning_threshold = input(0.9, title="BB Overbought Early Warning")+percent_bb_ob_earlywarning_threshold = input.float(0.9, title="BB Overbought Early Warning")-percent_bb_os_earlywarning_threshold = input(0.1, title="BB Oversold Early Warning")+percent_bb_os_earlywarning_threshold = input.float(0.1, title="BB Oversold Early Warning")percent_bb_ob_earlywarning = ta.crossover(percent_bb, percent_bb_ob_earlywarning_threshold)⋯

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: 44 before, 39 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.

⋯// © oliverbadaoui-//@version=5+//@version=6strategy("FMC", overlay=true, pyramiding=0, initial_capital=10000)⋯

Settings

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

SettingDefaultType and rangeFeeds
SourceclosesourceVsma Vrsi bb_sma Vstdev upper_bb_crossover upper_bb_crossunder bb_sma_crossunder bb_sma_crossover lower_bb_crossover lower_bb_crossunder above_upper_bb percent_bb
SMA Length100intVsma
RSI Length2intVrsi
RSI Overbought Threshold70intrsi_ob rsi_ob_crossover rsi_ob_crossunder
RSI Oversold Threshold10intrsi_os rsi_os_crossunder rsi_os_crossover
RSI Midrange50intrsi_mid_crossover rsi_mid_crossunder rsi_above_mid rsi_below_mid
RSI Overbought Early Warning75intrsi_ob_earlywarning
RSI Oversold Early Warning25intrsi_os_earlywarning
Bollinger SMA Length20intbb_sma Vstdev
Number of St. Devs.2intVstdev
BB Overbought Early Warning0.9floatpercent_bb_ob_earlywarning
BB Oversold Early Warning0.1floatpercent_bb_os_earlywarning

What it calculates

  • SMA (sma, ta.sma in v5)Source (close), SMA Length (100)Vsma · line 9
  • RSI (rsi, ta.rsi in v5)Source (close), RSI Length (2)Vrsi · line 17
  • Crossover (crossover, ta.crossover in v5)Vrsi, RSI Overbought Threshold (70)rsi_ob_crossover · line 20
  • Crossunder (crossunder, ta.crossunder in v5)Vrsi, RSI Overbought Threshold (70)rsi_ob_crossunder · line 21
  • Crossunder (crossunder, ta.crossunder in v5)Vrsi, RSI Oversold Threshold (10)rsi_os_crossunder · line 22
  • Crossover (crossover, ta.crossover in v5)Vrsi, RSI Oversold Threshold (10)rsi_os_crossover · line 23
  • Crossover (crossover, ta.crossover in v5)Vrsi, RSI Midrange (50)rsi_mid_crossover · line 24
  • Crossunder (crossunder, ta.crossunder in v5)Vrsi, RSI Midrange (50)rsi_mid_crossunder · line 25
  • Crossover (crossover, ta.crossover in v5)Vrsi, RSI Overbought Early Warning (75)rsi_ob_earlywarning · line 28
  • Crossunder (crossunder, ta.crossunder in v5)Vrsi, RSI Oversold Early Warning (25)rsi_os_earlywarning · line 29
  • SMA (sma, ta.sma in v5)Source (close), Bollinger SMA Length (20)bb_sma · line 32
  • Stdev (stdev, ta.stdev in v5)Source (close), Bollinger SMA Length (20)Vstdev · line 34
  • Crossover (crossover, ta.crossover in v5)Source (close), upperbandupper_bb_crossover · line 37
  • Crossunder (crossunder, ta.crossunder in v5)Source (close), upperbandupper_bb_crossunder · line 38
  • Crossunder (crossunder, ta.crossunder in v5)Source (close), bb_smabb_sma_crossunder · line 39
  • Crossover (crossover, ta.crossover in v5)Source (close), bb_smabb_sma_crossover · line 40
  • Crossover (crossover, ta.crossover in v5)Source (close), lowerbandlower_bb_crossover · line 41
  • Crossunder (crossunder, ta.crossunder in v5)Source (close), lowerbandlower_bb_crossunder · line 42
  • Crossover (crossover, ta.crossover in v5)percent_bb, 1percent_bb_ob_crossover · line 47
  • Crossunder (crossunder, ta.crossunder in v5)percent_bb, 0percent_bb_os_crossunder · line 48
  • Crossover (crossover, ta.crossover in v5)percent_bb, BB Overbought Early Warning (0.9)percent_bb_ob_earlywarning · line 51
  • Crossunder (crossunder, ta.crossunder in v5)percent_bb, BB Oversold Early Warning (0.1)percent_bb_os_earlywarning · line 52

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 datasma_lengthSMA Lengthsetting · 100rsi_lengthRSI Lengthsetting · 2rsi_ob_thresholdRSI Overbought Thresholdsetting · 70rsi_os_thresholdRSI Oversold Thresholdsetting · 10rsi_midRSI Midrangesetting · 50rsi_ob_earlywarning_thresholdRSI Overbought Early Wa…setting · 75rsi_os_earlywarning_thresholdRSI Oversold Early Warn…setting · 25bb_sma_lengthBollinger SMA Lengthsetting · 20stdev_multNumber of St. Devs.setting · 2percent_bb_ob_earlywarning_thresholdBB Overbought Early War…setting · 0.9percent_bb_os_earlywarning_thresholdBB Oversold Early Warni…setting · 0.1VsmaSMA→ VsmaVrsiRSI→ Vrsirsi_ob_crossoverCrossover→ rsi_ob_crossoverrsi_ob_crossunderCrossunder→ rsi_ob_crossunderrsi_os_crossunderCrossunder→ rsi_os_crossunderrsi_os_crossoverCrossover→ rsi_os_crossoverrsi_mid_crossoverCrossover→ rsi_mid_crossoverrsi_mid_crossunderCrossunder→ rsi_mid_crossunderrsi_ob_earlywarningCrossover→ rsi_ob_earlywarningrsi_os_earlywarningCrossunder→ rsi_os_earlywarningbb_smaSMA→ bb_smaVstdevStdev→ Vstdevupper_bb_crossoverCrossover→ upper_bb_crossoverupper_bb_crossunderCrossunder→ upper_bb_crossunderbb_sma_crossunderCrossunder→ bb_sma_crossunderbb_sma_crossoverCrossover→ bb_sma_crossoverlower_bb_crossoverCrossover→ lower_bb_crossoverlower_bb_crossunderCrossunder→ lower_bb_crossunderpercent_bb_ob_crossoverCrossover→ percent_bb_ob_crossoverpercent_bb_os_crossunderCrossunder→ percent_bb_os_crossunderpercent_bb_ob_earlywarningCrossover→ percent_bb_ob_earlywarningpercent_bb_os_earlywarningCrossunder→ percent_bb_os_earlywarningupperband, lowerbandupperband · lowerband2 valuespercent_bbpercent_bbvaluersi_obrsi_obconditionrsi_osrsi_osconditionrsi_above_mid, rsi_below_midrsi_above_mid · rsi_bel…2 conditionsabove_upper_bbabove_upper_bbconditionpercent_bb_ob, percent_bb_ospercent_bb_ob · percent…2 conditionsentry:BullOpen Bullstrategy.entryclose:BullClose Bullstrategy.closeplot:55Bollinger SMAplotplot:56Bollinger Upper Bandplotplot:57Bollinger Lower Bandplotfill:Bollinger BackgroundBollinger Backgroundfill

Order rules

OrderFires whenBy defaultLine
Open Bull long(rsi_os)On61
Close Bull(rsi_ob)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, and the live replay matched history.

12/12trades 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+139.5%+102.5%4466%1.24111.9%26 Jan 2024 – 21 Oct 2026
BTCUSDT 4h−31.6%+5.5%4271%0.85143.1%8 May 2026 – 21 Oct 2026
ETHUSDT 1D+13.2%+9.8%4665%1.4310.5%26 Jan 2024 – 21 Oct 2026
ETHUSDT 4h−0.3%+8.4%3967%0.964.9%8 May 2026 – 21 Oct 2026
SOLUSDT 1D−0.7%+16.7%4657%0.690.9%26 Jan 2024 – 21 Oct 2026
SOLUSDT 4h+0.1%+21.5%4470%1.290.2%8 May 2026 – 21 Oct 2026
BNBUSDT 1D+6.6%+148.3%4976%2.702.0%26 Jan 2024 – 21 Oct 2026
BNBUSDT 4h−0.2%+17.1%4374%0.881.3%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 market1782%$30,637.70
Sideways market1443%−$12,766.20
Falling market1369%−$3,923.53

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

How bad could the drawdown be?

76.0%

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

0%87%
All 44 trades
SideEntryExitBarsP&L
long24 Feb 2024 50,744.2026 Feb 2024 51,728.802$984.70
long17 Mar 2024 65,300.6025 Mar 2024 67,210.008$1,909.36
long3 Apr 2024 65,464.007 Apr 2024 68,896.004$3,432.01
long14 Apr 2024 63,924.5021 Apr 2024 64,940.607$1,016.06
long29 Apr 2024 63,118.604 May 2024 62,882.005−$236.61
long12 Jun 2024 67,314.201 Jul 2024 62,772.0019−$4,542.22
long5 Jul 2024 57,050.0010 Jul 2024 58,050.005$999.98
long1 Aug 2024 64,628.009 Aug 2024 61,686.008−$2,942.01
long28 Aug 2024 59,415.0010 Sep 2024 57,042.0013−$2,372.99
long1 Oct 2024 63,327.605 Oct 2024 62,086.004−$1,241.60
long10 Oct 2024 60,636.0012 Oct 2024 62,540.002$1,903.98
long5 Nov 2024 67,850.007 Nov 2024 75,572.002$7,721.98
long26 Nov 2024 93,010.0030 Nov 2024 97,460.004$4,449.99
long20 Dec 2024 97,461.9025 Dec 2024 98,663.605$1,201.72
long29 Jan 2025 101,336.0030 Jan 2025 103,733.001$2,397.73
long3 Feb 2025 97,700.6011 Feb 2025 97,430.808−$269.77
long25 Feb 2025 91,552.903 Mar 2025 94,270.006$2,717.11
long10 Mar 2025 80,734.5016 Mar 2025 84,338.406$3,603.96
long30 Mar 2025 82,648.502 Apr 2025 85,158.403$2,509.82
long7 Apr 2025 78,430.0010 Apr 2025 82,615.203$4,185.22
long30 May 2025 105,590.003 Jun 2025 105,858.004$268.25
long6 Jun 2025 101,509.008 Jun 2025 105,552.002$4,043.46
long21 Jun 2025 103,298.0024 Jun 2025 105,334.003$2,035.96
long1 Aug 2025 115,764.005 Aug 2025 115,055.004−$709.04
long19 Aug 2025 116,227.0023 Aug 2025 116,936.004$708.95
long23 Sep 2025 112,651.0029 Sep 2025 112,164.006−$487.03
long11 Oct 2025 112,774.0021 Oct 2025 110,532.0010−$2,242.40
long31 Oct 2025 108,323.003 Nov 2025 110,541.003$2,217.82
long5 Nov 2025 101,497.0010 Nov 2025 104,723.005$3,225.72
long14 Nov 2025 99,692.0025 Nov 2025 88,300.0011−$11,392.00
long2 Dec 2025 86,286.004 Dec 2025 93,429.902$7,143.94
long15 Dec 2025 88,172.2020 Dec 2025 88,136.905−$35.21
long20 Jan 2026 92,631.0028 Jan 2026 89,250.008−$3,381.00
long30 Jan 2026 84,650.2014 Feb 2026 68,854.0015−$15,796.20
long19 Feb 2026 66,461.0021 Feb 2026 68,020.002$1,559.00
long24 Feb 2026 64,656.0026 Feb 2026 67,988.002$3,332.03
long23 Mar 2026 67,859.0024 Mar 2026 70,906.401$3,047.45
long28 Mar 2026 66,407.301 Apr 2026 68,284.504$1,877.21
long19 May 2026 77,001.9026 May 2026 77,322.007$320.13
long28 May 2026 74,449.3012 Jun 2026 63,626.0015−$10,823.30
long19 Jun 2026 62,958.003 Jul 2026 61,560.0014−$1,398.01
long12 Aug 2026 63,600.0018 Aug 2026 64,532.106$932.10
long11 Sep 2026 76,568.7015 Sep 2026 78,189.204$1,620.47
long8 Oct 2026 83,321.8012 Oct 2026 83,773.104$451.31

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
FMC this page—v4 strategy+139.5%44111.9%
Bottom catch strategy by footlzsma stdev rsiv4 strategy+3.9%37.1%
Madri by Mdemoiorsi sma stdevv4 strategy+25.0%436.4%
Bollinger Bands and RSI Short Selling (by Coinrule) by Coinrulesma stdev rsiv5 strategy+7.6%34.3%
Shorting when Bollinger Band Above Price with RSI (by Coinrule) by Coinrulesma stdev rsiv5 strategyNo trades on this market
RSI_Boll-TP-SL by BigCoinHuntersma stdev rsiv5 strategyNo trades on this market

Where it runs

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

Zeal Terminal's engine currently reads an order side written as long = true as a short, whatever it says; this page passes the same side as strategy.long or strategy.short (line 61) so the engine trades the way the script says.

“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/// © oliverbadaoui//@version=4strategy("FMC", overlay=true, pyramiding=0, initial_capital=10000)// GLOBAL VARIABLESsource = input(close, title="Source")//SMAsma_length = input(100, title="SMA Length")Vsma=sma(source, sma_length)// RELATIVE STRENGTH INDEX (RSI) rsi_length = input(2, title="RSI Length")rsi_ob_threshold = input(70, title="RSI Overbought Threshold")rsi_os_threshold = input(10, title="RSI Oversold Threshold")rsi_mid = input(50, title="RSI Midrange")rsi_ob_earlywarning_threshold = input(75, title="RSI Overbought Early Warning")rsi_os_earlywarning_threshold = input(25, title="RSI Oversold Early Warning")Vrsi = rsi(source, rsi_length)rsi_ob = Vrsi > rsi_ob_thresholdrsi_os = Vrsi < rsi_os_thresholdrsi_ob_crossover = crossover(Vrsi, rsi_ob_threshold)rsi_ob_crossunder = crossunder(Vrsi, rsi_ob_threshold)rsi_os_crossunder = crossunder(Vrsi, rsi_os_threshold)rsi_os_crossover = crossover(Vrsi, rsi_os_threshold)rsi_mid_crossover = crossover(Vrsi, rsi_mid)rsi_mid_crossunder = crossunder(Vrsi, rsi_mid)rsi_above_mid = Vrsi > rsi_midrsi_below_mid = Vrsi < rsi_midrsi_ob_earlywarning = crossover(Vrsi, rsi_ob_earlywarning_threshold)rsi_os_earlywarning = crossunder(Vrsi, rsi_os_earlywarning_threshold)// BOLLINGER BANDS (BB) bb_sma_length = input(20, title="Bollinger SMA Length")bb_sma = sma(source, bb_sma_length)stdev_mult = input(2, title="Number of St. Devs.")Vstdev = stdev_mult * stdev(source, bb_sma_length)upperband = bb_sma + Vstdevlowerband = bb_sma - Vstdevupper_bb_crossover = crossover(source,upperband)upper_bb_crossunder = crossunder(source,upperband)bb_sma_crossunder = crossunder(source, bb_sma)bb_sma_crossover = crossover(source, bb_sma)lower_bb_crossover = crossover(source, lowerband)lower_bb_crossunder = crossunder(source, lowerband)above_upper_bb = source > upperbandpercent_bb = (source - lowerband) / (upperband - lowerband)percent_bb_ob = percent_bb > 1percent_bb_os = percent_bb < 0percent_bb_ob_crossover = crossover(percent_bb, 1)percent_bb_os_crossunder = crossunder(percent_bb, 0)percent_bb_ob_earlywarning_threshold = input(0.9, title="BB Overbought Early Warning")percent_bb_os_earlywarning_threshold = input(0.1, title="BB Oversold Early Warning")percent_bb_ob_earlywarning = crossover(percent_bb, percent_bb_ob_earlywarning_threshold)percent_bb_os_earlywarning = crossunder(percent_bb, percent_bb_os_earlywarning_threshold)// PLOTS & SIGNALS// BBbb_sma_plot = plot(series=bb_sma, title="Bollinger SMA", color=color.teal, transp=80)upperband_plot = plot(series=upperband, title="Bollinger Upper Band", color=color.rgb(26, 80, 74), linewidth=1)lowerband_plot = plot(series=lowerband, title="Bollinger Lower Band", color=color.rgb(26, 80, 74), linewidth=1)fill(upperband_plot, lowerband_plot, title = "Bollinger Background", color=color.rgb(0, 137, 123, 96))// FMCif(rsi_os)    strategy.entry(id="Bull", long=true)if(rsi_ob)    strategy.close("Bull")// if(rsi_ob)//     strategy.entry(id="Bear", long=false)// if(rsi_os)//     strategy.close("Bear")// Bam_geo_put_1 = rsi_ob_crossover and percent_bb_ob// Bam_geo_call_1 = rsi_os_crossunder and percent_bb_os// Bam_geo_put_2 = percent_bb_ob_crossover and rsi_ob// Bam_geo_call_2 = percent_bb_os_crossunder and rsi_os// Bam_geo_put_warning_1 = rsi_ob_earlywarning and percent_bb_ob// Bam_geo_call_warning_1 = rsi_os_earlywarning and percent_bb_os// Bam_geo_put_warning_2 = percent_bb_ob_earlywarning and rsi_ob// Bam_geo_call_warning_2 = percent_bb_os_earlywarning and rsi_os// plotchar(Bam_geo_put_1, title="Buy Puts", char="★", location=location.top, color=color.black, size=size.small)// plotchar(Bam_geo_call_1, title="Buy Calls", char="★", location=location.top, color=color.black, size=size.small)// plotchar(Bam_geo_put_2, title="Buy Puts", char="★", location=location.top, color=color.black, size=size.small)// plotchar(Bam_geo_call_2, title="Buy Puts", char="★", location=location.top, color=color.black, size=size.small)// plotchar(rsi_ob_earlywarning, char="!", location=location.belowbar, color=color.red, size=size.tiny)// plotchar(rsi_os_earlywarning, char="!", location=location.belowbar, color=color.red, size=size.tiny)// plotchar(percent_bb_ob_earlywarning, char="!", location=location.abovebar, color=color.red, size=size.tiny)// plotchar(percent_bb_os_earlywarning, char="!", location=location.belowbar, color=color.red, size=size.tiny)// // EARLY WARNING TRADES TO ACT AS ALERTS// // For when RSI crossover leads and then BB condition is satisfied// // if(Bam_geo_call_warning_1)// //     strategy.entry(id="Call warning 1", long=true)// //     strategy.close("Call warning 1")    // // if(Bam_geo_put_warning_1)// //     strategy.entry(id="Put warning 1", long=false)// //     strategy.close("Put warning 1")    // // For when BB crossover leads and then RSI condition is satisfied// if(Bam_geo_call_warning_2)//     strategy.entry(id="Call warning 2", long=true)//     strategy.close("Call warning 2")    // if(Bam_geo_put_warning_2)//     strategy.entry(id="Put warning 2", long=false)//     strategy.close("Put warning 2")// // EXECUTION OF REAL ORDERS// // For when RSI crossover leads and then BB condition is satisfied// if(Bam_geo_call_1)//     strategy.entry(id="Call 1", long=true)// if(rsi_os_crossover)//     strategy.close("Call 1")    // if(Bam_geo_put_1)//     strategy.entry(id="Put 1", long=false)// if(rsi_ob_crossunder)//     strategy.close("Put 1")    // // For when BB crossover leads and then RSI condition is satisfied// if(Bam_geo_call_2)//     strategy.entry(id="Call 2", long=true)// if(rsi_os_crossover)//     strategy.close("Call 2")    // if(Bam_geo_put_2)//     strategy.entry(id="Put 2", long=false)// if(rsi_ob_crossunder)//     strategy.close("Put 2")