Pine Script v4 · Strategy
PMA Strategy Idea
A Pine Script v4 strategy built on EMA (hlc3, 10). It has 6 order rules, 2 entries among them, and trades long and short with the default settings. Exits use a stop loss. Each trade commits 100% of equity and pays 0.075% commission. 6 settings; defaults include EMA1 Period 10, EMA2 Period 20 and EMA3 Period 30.
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 PMA Strategy Idea repaint?
- No
- No repainting patterns were found in the source, and a live tick-by-tick replay matched history on 35 of 35 trades.
- How did PMA Strategy Idea do on BTCUSDT 1D with default settings?
- +51.68%
- From 26 Jan 2024 to 21 Oct 2026, over 129 closed trades, against +102.5% for buy and hold. A backtest, not investment advice.
- Can PMA Strategy Idea 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 PMA Strategy Idea use a stop loss?
- Yes
- strategy.exit sets a stop on line 39, 40.
- Does PMA Strategy Idea run in Zeal Terminal?
- Yes
- It compiles in 11 ms and runs 1,000 bars in 35 ms, in the browser.
BTCUSDT · 1D · default settings
- Plot
- Plot
- Plot
- Winning trade
- Losing trade
- Equity
- Buy and hold
- Net profit
- +51.68%
- $516.77
- Buy and hold
- +102.5%
- same period
- Closed trades
- 129
- 42 won · 87 lost
- Profitable
- 32.6%
- of closed trades
- Profit factor
- 1.19
- gross profit ÷ gross loss
- Max drawdown
- 30.79%
- −$480.08
One run with the author's default settings, $1,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
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 30, 31, 33, 34. The upgraded version below moves each call inside an if block.
-
Note
Uses transp =, which v5 removed line 49
transp = on line 49. v5 folds the transparency into the colour with color.new(c, transp).
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 ema → ta.ema, rising → ta.rising, falling → ta.falling.
- 4 strategy calls use the when = argument (line 30, 31, 33, 34). It is deprecated in v5 and removed in v6, where each call moves inside an if block.
v4 → v5
VerifiedSame 129 trades and the same P&L on BTCUSDT 1D, 1,000 bars, in Zeal Terminal's engine.
- Line 3: //@version=4 → //@version=5
- Line 22: ema → ta.ema
- Line 23: ema → ta.ema
- Line 24: ema → ta.ema
- Line 26: rising → ta.rising
- Line 26: rising → ta.rising
5 more edits
- Line 26: rising → ta.rising
- Line 28: falling → ta.falling
- Line 28: falling → ta.falling
- Line 28: falling → ta.falling
- Line 49: transp = 50 → color.new(colors, 50)
⋯// © QuantCT-//@version=4+//@version=5strategy("PMA Strategy Idea",⋯// ____ Logic-ema1 = ema(hlc3, ema1_period)+ema1 = ta.ema(hlc3, ema1_period)-ema2 = ema(hlc3, ema2_period)+ema2 = ta.ema(hlc3, ema2_period)-ema3 = ema(hlc3, ema3_period)+ema3 = ta.ema(hlc3, ema3_period) -enter_long = (rising(ema1, 1) and rising(ema2, 1) and rising(ema3, 1))+enter_long = (ta.rising(ema1, 1) and ta.rising(ema2, 1) and ta.rising(ema3, 1))exit_long = not enter_long-enter_short = (falling(ema1, 1) and falling(ema2, 1) and falling(ema3, 1))+enter_short = (ta.falling(ema1, 1) and ta.falling(ema2, 1) and ta.falling(ema3, 1))exit_short = not enter_short⋯ema3_plot = plot(ema3, color=colors)-fill(ema1_plot, ema3_plot, color=colors, transp=50)+fill(ema1_plot, ema3_plot, color=color.new(colors, 50))Same 129 trades and the same P&L on BTCUSDT 1D, 1,000 bars, in Zeal Terminal's engine.
- Line 15: input() → input.int()
- Line 16: input() → input.int()
- Line 17: input() → input.int()
- Line 18: input() → input.bool()
- Line 19: input() → input.float()
- Line 20: input() → input.bool()
4 more edits
- Line 30: when = enter_long → if block
- Line 31: when = exit_long → if block
- Line 33: when = enter_short → if block
- Line 34: when = exit_short → if block
⋯// ____ Inputs-ema1_period = input(title="EMA1 Period", defval=10)+ema1_period = input.int(title="EMA1 Period", defval=10)-ema2_period = input(title="EMA2 Period", defval=20)+ema2_period = input.int(title="EMA2 Period", defval=20)-ema3_period = input(title="EMA3 Period", defval=30)+ema3_period = input.int(title="EMA3 Period", defval=30)-long_only = input(title="Long Only", defval=false)+long_only = input.bool(title="Long Only", defval=false)-slp = input(title="Stop-loss (%)", minval=1.0, maxval=25.0, defval=5.0)+slp = input.float(title="Stop-loss (%)", minval=1.0, maxval=25.0, defval=5.0)-use_sl = input(title="Use Stop-Loss", defval=false)+use_sl = input.bool(title="Use Stop-Loss", defval=false)// ____ Logic⋯exit_short = not enter_short-strategy.entry("Long", strategy.long, when=enter_long)+if enter_long+ strategy.entry("Long", strategy.long)-strategy.close("Long", when=exit_long) +if exit_long+ strategy.close("Long") if (not long_only)- strategy.entry("Short", strategy.short, when=enter_short)+ if enter_short+ strategy.entry("Short", strategy.short)- strategy.close("Short", when=exit_short) + if exit_short+ strategy.close("Short") // ____ SL⋯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: 129 before, 404 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.
⋯// © QuantCT-//@version=5+//@version=6strategy("PMA Strategy Idea",⋯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 |
|---|---|---|---|
| EMA1 Period | 10 | int | ema1 |
| EMA2 Period | 20 | int | ema2 |
| EMA3 Period | 30 | int | ema3 |
| Long Only | false | bool | entry Short close Short line 32 |
| Stop-loss (%) | 5.0 | float · min 1.0 · max 25.0 | sl_long sl_short |
| Use Stop-Loss | false | bool | exit SL exit SL line 38 |
What it calculates
- EMA (
ema,ta.emain v5)hlc3, EMA1 Period (10)ema1 · line 22 - EMA (
ema,ta.emain v5)hlc3, EMA2 Period (20)ema2 · line 23 - EMA (
ema,ta.emain v5)hlc3, EMA3 Period (30)ema3 · line 24
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 | enter_long(rising(ema1, 1) and rising(ema2, 1) and rising(ema3, 1)) | On | 30 |
| Close Long | exit_longnot enter_long | On | 31 |
| Open Short short | enter_short(falling(ema1, 1) and falling(ema2, 1) and falling(ema3, 1)) | On | 33 |
| Close Short | exit_shortnot enter_short | On | 34 |
| Exit SL stop | (use_sl) | On | 39 |
| Exit SL stop | (use_sl) | On | 40 |
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.
- 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 | +51.7% | +102.5% | 129 | 33% | 1.19 | 30.8% | 26 Jan 2024 – 21 Oct 2026 |
| BTCUSDT 4h | −16.1% | +5.5% | 131 | 24% | 0.80 | 22.1% | 8 May 2026 – 21 Oct 2026 |
| ETHUSDT 1D | +33.2% | +9.8% | 124 | 27% | 1.09 | 54.6% | 26 Jan 2024 – 21 Oct 2026 |
| ETHUSDT 4h | −23.9% | +8.4% | 155 | 22% | 0.80 | 31.9% | 8 May 2026 – 21 Oct 2026 |
| SOLUSDT 1D | +44.8% | +16.7% | 127 | 31% | 1.11 | 44.1% | 26 Jan 2024 – 21 Oct 2026 |
| SOLUSDT 4h | −4.9% | +21.5% | 124 | 27% | 0.96 | 21.5% | 8 May 2026 – 21 Oct 2026 |
| BNBUSDT 1D | +1.7% | +148.3% | 128 | 34% | 1.01 | 44.8% | 26 Jan 2024 – 21 Oct 2026 |
| BNBUSDT 4h | −19.8% | +17.1% | 137 | 25% | 0.77 | 30.8% | 8 May 2026 – 21 Oct 2026 |
Backtests are simulations on historical data and are not investment advice.
Settings heatmap
Two settings that feed the entry signal, moved around their defaults. The best in-sample pair (EMA1 Period 6, EMA2 Period 34) made +88.9% before 26 Dec 2025 and −1.5% after it, worse than the defaults' +16.9% after. Tuning on the past did not carry forward. 100% of the 64 combinations made money in-sample and 97% out-of-sample.
| EMA2 Period ↓ · EMA1 Period → | 5 | 6 | 7 | 9 | 10 | 12 | 14 | 17 |
|---|---|---|---|---|---|---|---|---|
| 10 | +76% | +83% | +40% | +25% | +35% | +35% | +33% | +33% |
| 12 | +76% | +83% | +40% | +25% | +35% | +29% | +27% | +27% |
| 14 | +73% | +81% | +39% | +24% | +33% | +27% | +16% | +16% |
| 17 | +72% | +80% | +39% | +24% | +33% | +27% | +16% | +31% |
| 20 | +68% | +75% | +35% | +25% | +35% | +29% | +16% | +31% |
| 24 | +70% | +75% | +35% | +25% | +35% | +29% | +16% | +31% |
| 28 | +74% | +76% | +35% | +25% | +35% | +29% | +16% | +31% |
| 34 | +85% | +89% | +45% | +34% | +47% | +41% | +27% | +43% |
| EMA2 Period ↓ · EMA1 Period → | 5 | 6 | 7 | 9 | 10 | 12 | 14 | 17 |
|---|---|---|---|---|---|---|---|---|
| 10 | +2% | +0% | +6% | +5% | +13% | +15% | +15% | +17% |
| 12 | +9% | +8% | +9% | +7% | +15% | +24% | +24% | +25% |
| 14 | +9% | +7% | +9% | +7% | +15% | +24% | +23% | +24% |
| 17 | +4% | +3% | +5% | +9% | +17% | +25% | +24% | +36% |
| 20 | +4% | +3% | +5% | +9% | +17% | +26% | +24% | +36% |
| 24 | +7% | +5% | +5% | +11% | +20% | +28% | +27% | +39% |
| 28 | +7% | +5% | +5% | +10% | +18% | +27% | +25% | +39% |
| 34 | +0% | −2% | −0% | +5% | +13% | +25% | +24% | +39% |
Net P&L of trades opened in each period, as a share of starting capital. marks the defaults and the best in-sample cell. Hover a cell for its trade count. Backtests are simulations on historical data and are not investment advice.
The trades
By market direction
| At entry, last 90 bars | Trades | Won | P&L |
|---|---|---|---|
| Rising market | 35 | 26% | −$329.26 |
| Sideways market | 68 | 37% | $791.44 |
| Falling market | 26 | 31% | $54.59 |
Rising and falling mean the market moved more than 15% over the 90 bars before entry.
How bad could the drawdown be?
55.7%
The 95th percentile of the worst drawdown when the same 129 trades are reshuffled 5,000 times. The bar spans the 5th to 95th percentile, 28.8% to 55.7%; the tick is what actually happened, 28.9%. Order luck alone moves it this much.
All 129 trades
| Side | Entry | Exit | Bars | P&L |
|---|---|---|---|---|
| long | 28 Jan 2024 42,120.60 | 28 Jan 2024 42,120.60 | 0 | −$1.50 |
| short | 28 Jan 2024 42,120.60 | 29 Jan 2024 42,031.10 | 1 | $0.63 |
| long | 29 Jan 2024 42,031.10 | 29 Jan 2024 42,031.10 | 0 | −$1.50 |
| short | 29 Jan 2024 42,031.10 | 30 Jan 2024 43,302.70 | 1 | −$31.75 |
| long | 30 Jan 2024 43,302.70 | 30 Jan 2024 43,302.70 | 0 | −$1.45 |
| short | 30 Jan 2024 43,302.70 | 31 Jan 2024 42,941.10 | 1 | $6.62 |
| long | 31 Jan 2024 42,941.10 | 31 Jan 2024 42,941.10 | 0 | −$1.46 |
| short | 31 Jan 2024 42,941.10 | 1 Feb 2024 42,580.00 | 1 | $6.72 |
| long | 1 Feb 2024 42,580.00 | 1 Feb 2024 42,580.00 | 0 | −$1.46 |
| short | 1 Feb 2024 42,580.00 | 2 Feb 2024 43,082.90 | 1 | −$13.01 |
| long | 2 Feb 2024 43,082.90 | 2 Feb 2024 43,082.90 | 0 | −$1.44 |
| short | 2 Feb 2024 43,082.90 | 3 Feb 2024 43,200.00 | 1 | −$4.06 |
| long | 3 Feb 2024 43,200.00 | 3 Feb 2024 43,200.00 | 0 | −$1.43 |
| short | 3 Feb 2024 43,200.00 | 4 Feb 2024 43,011.10 | 1 | $2.75 |
| long | 4 Feb 2024 43,011.10 | 4 Feb 2024 43,011.10 | 0 | −$1.44 |
| short | 4 Feb 2024 43,011.10 | 5 Feb 2024 42,582.90 | 1 | $8.11 |
| long | 5 Feb 2024 42,582.90 | 5 Feb 2024 42,582.90 | 0 | −$1.45 |
| short | 5 Feb 2024 42,582.90 | 6 Feb 2024 42,708.70 | 1 | −$4.30 |
| long | 6 Feb 2024 42,708.70 | 17 Mar 2024 65,300.60 | 40 | $505.25 |
| long | 25 Mar 2024 67,210.00 | 3 Apr 2024 65,464.00 | 9 | −$40.17 |
| short | 4 Apr 2024 65,963.30 | 5 Apr 2024 68,487.80 | 1 | −$56.62 |
| long | 7 Apr 2024 68,896.00 | 13 Apr 2024 67,116.50 | 6 | −$37.30 |
| short | 14 Apr 2024 63,924.50 | 22 Apr 2024 64,941.20 | 8 | −$23.14 |
| long | 23 Apr 2024 66,819.30 | 25 Apr 2024 64,289.60 | 2 | −$51.35 |
| short | 25 Apr 2024 64,289.60 | 5 May 2024 63,892.00 | 10 | $5.89 |
| short | 9 May 2024 61,193.00 | 14 May 2024 62,940.10 | 5 | −$37.90 |
| short | 15 May 2024 61,577.50 | 16 May 2024 66,206.50 | 1 | −$93.79 |
| long | 16 May 2024 66,206.50 | 30 May 2024 67,652.40 | 14 | $22.96 |
| long | 31 May 2024 68,352.20 | 1 Jun 2024 67,540.00 | 1 | −$15.40 |
| long | 4 Jun 2024 68,809.90 | 9 Jun 2024 69,310.50 | 5 | $6.55 |
| long | 10 Jun 2024 69,648.10 | 12 Jun 2024 67,314.20 | 2 | −$39.98 |
| short | 12 Jun 2024 67,314.20 | 13 Jun 2024 68,264.00 | 1 | −$17.24 |
| short | 14 Jun 2024 66,773.00 | 2 Jul 2024 62,900.00 | 18 | $61.38 |
| short | 3 Jul 2024 62,135.50 | 14 Jul 2024 59,204.00 | 11 | $52.43 |
| long | 16 Jul 2024 64,724.10 | 26 Jul 2024 65,799.90 | 10 | $18.12 |
| long | 27 Jul 2024 67,908.00 | 31 Jul 2024 66,188.00 | 4 | −$32.64 |
| short | 2 Aug 2024 65,354.00 | 10 Aug 2024 60,838.00 | 8 | $80.15 |
| short | 12 Aug 2024 58,712.60 | 14 Aug 2024 60,587.20 | 2 | −$42.31 |
| short | 15 Aug 2024 58,683.40 | 21 Aug 2024 59,013.80 | 6 | −$8.72 |
| long | 24 Aug 2024 64,037.20 | 28 Aug 2024 59,415.00 | 4 | −$89.37 |
| short | 28 Aug 2024 59,415.00 | 11 Sep 2024 57,636.00 | 14 | $32.03 |
| long | 14 Sep 2024 60,498.00 | 17 Sep 2024 58,214.00 | 3 | −$45.37 |
| long | 18 Sep 2024 60,314.00 | 1 Oct 2024 63,327.60 | 13 | $53.81 |
| short | 2 Oct 2024 60,804.90 | 6 Oct 2024 62,058.00 | 4 | −$25.77 |
| long | 7 Oct 2024 62,819.90 | 9 Oct 2024 62,160.50 | 2 | −$13.66 |
| short | 10 Oct 2024 60,636.00 | 12 Oct 2024 62,540.00 | 2 | −$37.06 |
| long | 12 Oct 2024 62,540.00 | 24 Oct 2024 66,668.60 | 12 | $70.23 |
| long | 25 Oct 2024 68,198.30 | 3 Nov 2024 69,374.70 | 9 | $18.24 |
| long | 6 Nov 2024 69,372.00 | 27 Nov 2024 91,965.20 | 21 | $381.26 |
| long | 28 Nov 2024 95,863.10 | 4 Dec 2024 95,849.70 | 6 | −$2.55 |
| long | 5 Dec 2024 98,587.30 | 10 Dec 2024 97,276.50 | 5 | −$23.00 |
| long | 12 Dec 2024 101,125.00 | 20 Dec 2024 97,461.90 | 8 | −$57.77 |
| short | 21 Dec 2024 97,805.40 | 22 Dec 2024 97,292.00 | 1 | $5.54 |
| short | 23 Dec 2024 95,186.30 | 25 Dec 2024 98,663.60 | 2 | −$56.34 |
| long | 26 Dec 2024 99,429.60 | 27 Dec 2024 95,791.60 | 1 | −$54.20 |
| short | 28 Dec 2024 94,299.00 | 3 Jan 2025 96,984.80 | 6 | −$41.10 |
| long | 3 Jan 2025 96,984.80 | 9 Jan 2025 95,060.60 | 6 | −$28.36 |
| short | 9 Jan 2025 95,060.60 | 15 Jan 2025 96,560.90 | 6 | −$22.51 |
| long | 15 Jan 2025 96,560.90 | 28 Jan 2025 102,083.00 | 13 | $71.16 |
| long | 30 Jan 2025 103,733.00 | 2 Feb 2025 100,636.00 | 3 | −$42.28 |
| short | 3 Feb 2025 97,700.60 | 15 Feb 2025 97,500.50 | 12 | $0.72 |
| short | 17 Feb 2025 96,118.10 | 21 Feb 2025 98,305.00 | 4 | −$31.73 |
| short | 22 Feb 2025 96,182.00 | 3 Mar 2025 94,270.00 | 9 | $23.47 |
| short | 4 Mar 2025 86,221.20 | 6 Mar 2025 90,606.00 | 2 | −$68.07 |
| short | 8 Mar 2025 86,801.70 | 16 Mar 2025 84,338.40 | 8 | $33.12 |
| short | 17 Mar 2025 82,574.50 | 20 Mar 2025 86,845.90 | 3 | −$67.34 |
| short | 22 Mar 2025 84,088.80 | 24 Mar 2025 86,082.50 | 2 | −$30.20 |
| long | 25 Mar 2025 87,498.20 | 29 Mar 2025 84,424.40 | 4 | −$42.71 |
| short | 29 Mar 2025 84,424.40 | 2 Apr 2025 85,158.40 | 4 | −$11.48 |
| short | 4 Apr 2025 83,213.10 | 12 Apr 2025 83,423.80 | 8 | −$4.49 |
| long | 13 Apr 2025 85,276.90 | 30 May 2025 105,590.00 | 47 | $262.11 |
| short | 6 Jun 2025 101,509.00 | 8 Jun 2025 105,552.00 | 2 | −$56.67 |
| long | 8 Jun 2025 105,552.00 | 13 Jun 2025 105,672.00 | 5 | −$0.48 |
| long | 17 Jun 2025 106,795.00 | 18 Jun 2025 104,551.00 | 1 | −$29.53 |
| short | 19 Jun 2025 104,887.00 | 25 Jun 2025 106,083.00 | 6 | −$16.57 |
| long | 25 Jun 2025 106,083.00 | 2 Jul 2025 105,681.00 | 7 | −$6.70 |
| long | 3 Jul 2025 108,850.00 | 26 Jul 2025 117,614.00 | 23 | $99.51 |
| long | 27 Jul 2025 117,920.00 | 31 Jul 2025 117,840.00 | 4 | −$2.96 |
| short | 2 Aug 2025 113,298.00 | 8 Aug 2025 117,472.00 | 6 | −$52.06 |
| long | 8 Aug 2025 117,472.00 | 16 Aug 2025 117,342.00 | 8 | −$3.40 |
| short | 19 Aug 2025 116,227.00 | 4 Sep 2025 111,706.00 | 16 | $48.71 |
| short | 5 Sep 2025 110,731.00 | 6 Sep 2025 110,660.00 | 1 | −$1.16 |
| short | 7 Sep 2025 110,188.00 | 8 Sep 2025 111,137.00 | 1 | −$13.65 |
| long | 11 Sep 2025 113,960.00 | 23 Sep 2025 112,651.00 | 12 | −$17.33 |
| short | 23 Sep 2025 112,651.00 | 30 Sep 2025 114,312.00 | 7 | −$21.44 |
| long | 30 Sep 2025 114,312.00 | 11 Oct 2025 112,774.00 | 11 | −$19.38 |
| short | 11 Oct 2025 112,774.00 | 25 Oct 2025 111,005.00 | 14 | $18.15 |
| long | 27 Oct 2025 114,559.00 | 30 Oct 2025 110,021.00 | 3 | −$53.21 |
| short | 30 Oct 2025 110,021.00 | 11 Nov 2025 106,011.00 | 12 | $43.47 |
| short | 12 Nov 2025 103,059.00 | 28 Nov 2025 91,333.90 | 16 | $144.43 |
| short | 2 Dec 2025 86,286.00 | 3 Dec 2025 91,277.90 | 1 | −$84.92 |
| short | 6 Dec 2025 89,330.00 | 9 Dec 2025 90,634.40 | 3 | −$21.67 |
| short | 13 Dec 2025 90,268.40 | 22 Dec 2025 88,658.90 | 9 | $21.63 |
| short | 24 Dec 2025 87,486.00 | 30 Dec 2025 87,237.10 | 6 | $1.81 |
| long | 3 Jan 2026 89,995.10 | 9 Jan 2026 91,100.00 | 6 | $14.50 |
| long | 10 Jan 2026 90,641.30 | 11 Jan 2026 90,504.70 | 1 | −$4.09 |
| long | 12 Jan 2026 91,013.70 | 20 Jan 2026 92,631.00 | 8 | $22.06 |
| short | 21 Jan 2026 88,427.70 | 26 Feb 2026 67,988.00 | 36 | $316.95 |
| short | 28 Feb 2026 65,872.10 | 3 Mar 2026 68,830.10 | 3 | −$78.75 |
| long | 5 Mar 2026 72,666.80 | 7 Mar 2026 68,114.00 | 2 | −$103.67 |
| short | 8 Mar 2026 67,262.90 | 11 Mar 2026 69,948.60 | 3 | −$62.75 |
| long | 11 Mar 2026 69,948.60 | 20 Mar 2026 69,930.00 | 9 | −$2.56 |
| short | 20 Mar 2026 69,930.00 | 25 Mar 2026 70,556.70 | 5 | −$15.17 |
| long | 26 Mar 2026 71,336.50 | 27 Mar 2026 68,820.30 | 1 | −$52.66 |
| short | 27 Mar 2026 68,820.30 | 2 Apr 2026 68,113.90 | 6 | $12.12 |
| short | 3 Apr 2026 66,902.00 | 6 Apr 2026 69,034.20 | 3 | −$46.51 |
| long | 7 Apr 2026 68,853.70 | 29 Apr 2026 76,342.80 | 22 | $144.29 |
| long | 2 May 2026 78,231.10 | 14 May 2026 79,313.60 | 12 | $18.37 |
| long | 15 May 2026 81,090.00 | 16 May 2026 79,113.20 | 1 | −$39.01 |
| short | 18 May 2026 77,457.70 | 14 Jun 2026 64,458.00 | 27 | $244.64 |
| short | 19 Jun 2026 62,958.00 | 23 Jun 2026 64,020.00 | 4 | −$31.51 |
| short | 24 Jun 2026 62,734.60 | 3 Jul 2026 61,560.00 | 9 | $29.00 |
| long | 11 Jul 2026 64,161.70 | 14 Jul 2026 62,334.50 | 3 | −$51.28 |
| short | 14 Jul 2026 62,334.50 | 15 Jul 2026 65,044.00 | 1 | −$74.77 |
| long | 15 Jul 2026 65,044.00 | 18 Jul 2026 63,931.70 | 3 | −$29.50 |
| long | 19 Jul 2026 64,834.20 | 25 Jul 2026 64,140.00 | 6 | −$18.98 |
| short | 26 Jul 2026 64,375.00 | 27 Jul 2026 65,400.00 | 1 | −$26.80 |
| long | 27 Jul 2026 65,400.00 | 28 Jul 2026 63,755.90 | 1 | −$40.24 |
| short | 29 Jul 2026 63,915.00 | 31 Jul 2026 64,780.00 | 2 | −$22.12 |
| long | 31 Jul 2026 64,780.00 | 1 Aug 2026 62,887.90 | 1 | −$44.47 |
| short | 1 Aug 2026 62,887.90 | 5 Aug 2026 64,106.60 | 4 | −$29.35 |
| long | 6 Aug 2026 64,665.20 | 11 Aug 2026 63,970.00 | 5 | −$16.83 |
| short | 12 Aug 2026 63,600.00 | 18 Aug 2026 64,532.10 | 6 | −$21.95 |
| long | 18 Aug 2026 64,532.10 | 3 Sep 2026 77,340.00 | 16 | $263.09 |
| long | 4 Sep 2026 81,270.40 | 9 Sep 2026 78,455.80 | 5 | −$57.72 |
| long | 15 Sep 2026 78,189.20 | 16 Sep 2026 75,644.50 | 1 | −$52.42 |
| long | 19 Sep 2026 80,883.90 | 8 Oct 2026 83,321.80 | 19 | $42.60 |
| short | 9 Oct 2026 81,754.50 | 10 Oct 2026 82,635.60 | 1 | −$18.81 |
| short | 16 Oct 2026 82,245.90 | 20 Oct 2026 81,938.40 | 4 | $3.39 |
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 |
|---|---|---|---|---|---|
| PMA Strategy Idea this page | — | v4 strategy | +51.7% | 129 | 30.8% |
| TEMA-DEMA-HMA Strategy by Tuned_Official | ema rising falling | v4 strategy | +73.8% | 4 | 30.6% |
| Strategy Myth-Busting #13 - MultiEMA+BXTrender - [SP-MYN] by myncrypto | ema rising falling | v5 strategy | −0.3% | 2 | 0.3% |
| Trading Day and Time Session by Dannnnnnny | rising falling | v5 strategy | No trades on this market | ||
| Momentum Strategy by PrattyCharts | ema rising | v4 strategy | No trades on this market | ||
| Trendelicious Strategy by levieux | rising falling | v5 strategy | −12.8% | 9 | 41.4% |
Where it runs
| Engine | Compiles | Runs | Matches TradingView |
|---|---|---|---|
| Zeal Terminal · OpenPineScript v2 | Yes 11 ms | Yes 1,000 bars in 35 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/// © QuantCT//@version=4strategy("PMA Strategy Idea", shorttitle="PMA", overlay=true, pyramiding=0, default_qty_type=strategy.percent_of_equity, default_qty_value=100, initial_capital=1000, commission_type=strategy.commission.percent, commission_value=0.075) // ____ Inputsema1_period = input(title="EMA1 Period", defval=10)ema2_period = input(title="EMA2 Period", defval=20)ema3_period = input(title="EMA3 Period", defval=30)long_only = input(title="Long Only", defval=false)slp = input(title="Stop-loss (%)", minval=1.0, maxval=25.0, defval=5.0)use_sl = input(title="Use Stop-Loss", defval=false)// ____ Logicema1 = ema(hlc3, ema1_period)ema2 = ema(hlc3, ema2_period)ema3 = ema(hlc3, ema3_period) enter_long = (rising(ema1, 1) and rising(ema2, 1) and rising(ema3, 1))exit_long = not enter_longenter_short = (falling(ema1, 1) and falling(ema2, 1) and falling(ema3, 1))exit_short = not enter_shortstrategy.entry("Long", strategy.long, when=enter_long)strategy.close("Long", when=exit_long) if (not long_only) strategy.entry("Short", strategy.short, when=enter_short) strategy.close("Short", when=exit_short) // ____ SLsl_long = strategy.position_avg_price * (1- (slp/100))sl_short = strategy.position_avg_price * (1 + (slp/100))if (use_sl) strategy.exit(id="SL", from_entry="Long", stop=sl_long) strategy.exit(id="SL", from_entry="Short", stop=sl_short)// ____ Plotscolors = enter_long ? #27D600 : enter_short ? #E30202 : color.orangeema1_plot = plot(ema1, color=colors)ema2_plot = plot(ema2, color=colors)ema3_plot = plot(ema3, color=colors)fill(ema1_plot, ema3_plot, color=colors, transp=50)