Pine Script v4 · Strategy
Mayer Multiple Strategy
A Pine Script v4 strategy built on SMA (close, 200). 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. 3 settings; defaults include Price SMA Length 200, Threshold 1.48 and Exit Level 1.70.
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 Mayer Multiple 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 Mayer Multiple 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; it opened a long position that was still open on the last bar, so there is no result to report. On ETHUSDT 1D it did trade; that row of the markets table below has its figures. A backtest, not investment advice.
- Can Mayer Multiple 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 Mayer Multiple Strategy use a stop loss?
- No
- Every exit waits for a signal; nothing limits a losing trade before it fires.
- Does Mayer Multiple Strategy run in Zeal Terminal?
- Yes
- It compiles in 5 ms and runs 1,000 bars in 17 ms, in the browser.
BTCUSDT · 1D · default settings
- SMA
- Winning trade
- Losing trade
- Equity
- Buy and hold
- 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
- 40.52%
- −$40,516.90
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.
-
Note
Uses an argument v6 removed
when = on line 14. 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 sma → ta.sma, crossunder → ta.crossunder, crossover → ta.crossover.
- 1 strategy call uses the when = argument (line 14). It is deprecated in v5 and removed in v6, where each call moves inside an if block.
v4 → v5
VerifiedSame 1 trades and the same P&L on ETHUSDT 1D, 1,000 bars, in Zeal Terminal's engine.
- Line 3: //@version=4 → //@version=5
- Line 6: input(type = input.integer) → input.int()
- Line 7: input(type = input.float) → input.float()
- Line 8: input(type = input.float) → input.float()
- Line 10: sma → ta.sma
- Line 12: crossunder → ta.crossunder
- Line 14: crossover → ta.crossover
⋯// © xtradernet-//@version=4+//@version=5// Quick script to backtest a strategy based on Mayer Multiplestrategy("Mayer Multiple Strategy", shorttitle="Mayer_Crypto", overlay=true)-length = input(200, type=input.integer, title="Price SMA Length")+length = input.int(200, title="Price SMA Length")-threshold = input(1.48, step=.1, type=input.float, title="Threshold")+threshold = input.float(1.48, step=.1, title="Threshold")-exit = input(1.70, step=.1, type=input.float, title="Exit Level")+exit = input.float(1.70, step=.1, title="Exit Level")// Bitcoin price / 200 day moving average value = Mayer Multiple-ma = sma(close, length)+ma = ta.sma(close, length)multiple = close / ma-if (crossunder(threshold,multiple))+if (ta.crossunder(threshold,multiple)) strategy.entry("Long", strategy.long, comment="MayerLong")-strategy.close("Long", when=crossover(multiple,exit), comment="MayerClose")+strategy.close("Long", when=ta.crossover(multiple,exit), comment="MayerClose")Same 1 trades and the same P&L on ETHUSDT 1D, 1,000 bars, in Zeal Terminal's engine.
- Line 14: when = ta.crossover(multiple,exit) → if block
⋯ strategy.entry("Long", strategy.long, comment="MayerLong")-strategy.close("Long", when=ta.crossover(multiple,exit), comment="MayerClose")+if ta.crossover(multiple,exit)+ strategy.close("Long", comment="MayerClose")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: 1 before, 1 after on ETHUSDT 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.
⋯// © xtradernet-//@version=5+//@version=6// Quick script to backtest a strategy based on Mayer Multiple⋯Settings
Every input the script declares, with its default and what it feeds. Bounds are the ones the script enforces.
| Setting | Default | Type and range | Feeds |
|---|---|---|---|
| Price SMA Length | 200 | int (written input.integer) | ma |
| Threshold | 1.48 | float · step .1 | entry Long line 12 |
| Exit Level | 1.70 | float · step .1 | close Long |
What it calculates
- SMA (
sma,ta.smain v5)close, Price SMA Length (200)ma · line 10
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.
Order rules
| Order | Fires when | By default | Line |
|---|---|---|---|
| Open Long long | (crossunder(threshold,multiple)) | On | 13 |
| Close Long | crossover(multiple,exit) | On | 14 |
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.
- 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.
| Market | Net | Buy and hold | Trades | Won | Profit factor | Max drawdown | Period |
|---|---|---|---|---|---|---|---|
| BTCUSDT 1D | 0.0% | +102.5% | 0 | 0% | — | 40.5% | 26 Jan 2024 – 21 Oct 2026 |
| BTCUSDT 4h | 0.0% | +5.5% | 0 | 0% | — | 0.0% | 8 May 2026 – 21 Oct 2026 |
| ETHUSDT 1D | +0.8% | +9.8% | 1 | 100% | — | 3.0% | 26 Jan 2024 – 21 Oct 2026 |
| ETHUSDT 4h | 0.0% | +8.4% | 0 | 0% | — | 0.0% | 8 May 2026 – 21 Oct 2026 |
| SOLUSDT 1D | 0.0% | +16.7% | 0 | 0% | — | 0.2% | 26 Jan 2024 – 21 Oct 2026 |
| SOLUSDT 4h | 0.0% | +21.5% | 0 | 0% | — | 0.0% | 8 May 2026 – 21 Oct 2026 |
| BNBUSDT 1D | +0.4% | +148.3% | 2 | 100% | — | 0.1% | 26 Jan 2024 – 21 Oct 2026 |
| BNBUSDT 4h | 0.0% | +17.1% | 0 | 0% | — | 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.
| Script | Shares | Type | Net | Trades | Max drawdown |
|---|---|---|---|---|---|
| Mayer Multiple Strategy this page | — | v4 strategy | 0.0% | 0 | 40.5% |
| Follow the Crypto Shorts by xtradernet | sma | v4 strategy | No trades on this market | ||
| buy down and sell high trend 200 sma and ma cross by willi130503 | sma | v4 strategy | No trades on this market | ||
| Moving Average Cross Strategy early Closing by Geduldtrader | sma | v4 strategy | +73.8% | 20 | 151.5% |
| MFI Simple Strategy by OztheWoz | sma | v5 strategy | −0.2% | 28 | 3.2% |
| 3 Higher High Price & Vol - BTST next day Gap up by SharemarketRaja | sma | v4 strategy | No trades on this market | ||
Where it runs
| Engine | Compiles | Runs | Matches TradingView |
|---|---|---|---|
| Zeal Terminal · OpenPineScript v2 | Yes 5 ms | Yes 1,000 bars in 17 ms | Not measured |
| PineTS | No 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/// © xtradernet//@version=4// Quick script to backtest a strategy based on Mayer Multiplestrategy("Mayer Multiple Strategy", shorttitle="Mayer_Crypto", overlay=true)length = input(200, type=input.integer, title="Price SMA Length")threshold = input(1.48, step=.1, type=input.float, title="Threshold")exit = input(1.70, step=.1, type=input.float, title="Exit Level")// Bitcoin price / 200 day moving average value = Mayer Multiplema = sma(close, length)multiple = close / maif (crossunder(threshold,multiple)) strategy.entry("Long", strategy.long, comment="MayerLong")strategy.close("Long", when=crossover(multiple,exit), comment="MayerClose")