Pine Script v5 · Strategy
Forex Midpoint Stratejisi For Nasdaq
A Pine Script v5 strategy built on SMA (close, 44), Highest or Lowest (high, 131) and Crossover (smoothingLine, midtopdeger[kaydirma]). It has 2 order rules, 2 entries among them, and trades long and short with the default settings. Exits wait for a signal; there is no stop loss. Each trade is one contract and pays no commission. 7 settings; defaults include Başlangıç Period 131, Kaydırma Seviyesi 14 and Yüzde Seviyesi 0.0006.
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 Forex Midpoint Stratejisi For Nasdaq repaint?
- No
- No repainting patterns were found in the source, and a live tick-by-tick replay matched history on 4 of 4 trades.
- How did Forex Midpoint Stratejisi For Nasdaq do on BTCUSDT 1D with default settings?
- −2.07%
- From 26 Jan 2024 to 21 Oct 2026, over 15 closed trades, against +102.5% for buy and hold. A backtest, not investment advice.
- Does Forex Midpoint Stratejisi For Nasdaq 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: 15 before, 16 after on BTCUSDT 1D, 1,000 bars, in Zeal Terminal's engine. It is shown for reference and is not offered as a download.
- Does Forex Midpoint Stratejisi For Nasdaq use a stop loss?
- No
- Every exit waits for a signal; nothing limits a losing trade before it fires.
- Does Forex Midpoint Stratejisi For Nasdaq run in Zeal Terminal?
- Yes
- It compiles in 13 ms and runs 1,000 bars in 22 ms, in the browser.
BTCUSDT · 1D · default settings
- SMA
- Highest
- Crossover
- Crossover
- Winning trade
- Losing trade
- Equity
- Buy and hold
- Net profit
- −2.07%
- −$20,706.40
- Buy and hold
- +102.5%
- same period
- Closed trades
- 15
- 5 won · 10 lost
- Profitable
- 33.3%
- of closed trades
- Profit factor
- 0.76
- gross profit ÷ gross loss
- Max drawdown
- 6.31%
- −$65,122.60
One run with the author's default settings, $1,000,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.
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 |
|---|---|---|---|
| Başlangıç Period | 131 | int | midpoint1 |
| Kaydırma Seviyesi | 14 | int | buycross sellcross |
| Yüzde Seviyesi | 0.0006 | float · step 0.0001 | midyuzdeseviyesi |
| Length | 44 | int · min 1 | out |
| Source | close | source | out |
| Smoothing | |||
| Method | EMA | string · options ["SMA", "EMA", "SMMA (RMA)", "WMA", "VWMA"] | smoothingLine |
| Length | 53 | int · min 1 · max 100 | smoothingLine |
What it calculates
- SMASource (close), Length (44)
out · line 10 - Highest / Lowesthigh, Başlangıç Period (131)
midpoint1 · line 25 - CrossoversmoothingLine, midtopdeger[kaydirma]
buycross · line 30 - Crossovermidtopdeger[kaydirma], smoothingLine
sellcross · line 31
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 BUY long | (buycross) | On | 34 |
| Open SELL short | (sellcross) | On | 42 |
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 | −2.1% | +102.5% | 15 | 33% | 0.76 | 6.3% | 26 Jan 2024 – 21 Oct 2026 |
| BTCUSDT 4h | −1.6% | +5.5% | 19 | 47% | 0.42 | 2.1% | 8 May 2026 – 21 Oct 2026 |
| ETHUSDT 1D | −0.1% | +9.8% | 11 | 45% | 0.73 | 0.3% | 26 Jan 2024 – 21 Oct 2026 |
| ETHUSDT 4h | −0.1% | +8.4% | 13 | 38% | 0.47 | 0.1% | 8 May 2026 – 21 Oct 2026 |
| SOLUSDT 1D | −0.0% | +16.7% | 13 | 46% | 0.98 | 0.0% | 26 Jan 2024 – 21 Oct 2026 |
| SOLUSDT 4h | −0.0% | +21.5% | 17 | 35% | 0.50 | 0.0% | 8 May 2026 – 21 Oct 2026 |
| BNBUSDT 1D | +0.1% | +148.3% | 15 | 60% | 2.65 | 0.0% | 26 Jan 2024 – 21 Oct 2026 |
| BNBUSDT 4h | −0.0% | +17.1% | 15 | 20% | 0.87 | 0.0% | 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 bars | Trades | Won | P&L |
|---|---|---|---|
| Rising market | 3 | 0% | −$36,770.40 |
| Sideways market | 5 | 40% | $11,522.90 |
| Falling market | 7 | 43% | $4,541.12 |
Rising and falling mean the market moved more than 15% over the 90 bars before entry.
How bad could the drawdown be?
7.8%
The 95th percentile of the worst drawdown when the same 15 trades are reshuffled 5,000 times. The bar spans the 5th to 95th percentile, 3.5% to 7.8%; the tick is what actually happened, 5.8%. Order luck alone moves it this much.
All 15 trades
| Side | Entry | Exit | Bars | P&L |
|---|---|---|---|---|
| short | 19 Aug 2024 58,427.30 | 20 Aug 2024 59,438.50 | 1 | −$1,011.15 |
| long | 20 Aug 2024 59,438.50 | 26 Nov 2024 93,010.00 | 98 | $33,571.50 |
| short | 26 Nov 2024 93,010.00 | 12 Dec 2024 101,125.00 | 16 | −$8,114.99 |
| long | 12 Dec 2024 101,125.00 | 3 Apr 2025 82,516.30 | 112 | −$18,608.70 |
| short | 3 Apr 2025 82,516.30 | 2 Jun 2025 105,643.00 | 60 | −$23,126.60 |
| long | 2 Jun 2025 105,643.00 | 16 Nov 2025 95,596.20 | 167 | −$10,046.70 |
| short | 16 Nov 2025 95,596.20 | 19 Nov 2025 92,960.80 | 3 | $2,635.40 |
| long | 19 Nov 2025 92,960.80 | 20 Nov 2025 91,555.00 | 1 | −$1,405.87 |
| short | 20 Nov 2025 91,555.00 | 2 Dec 2025 86,286.00 | 12 | $5,268.95 |
| long | 2 Dec 2025 86,286.00 | 18 Dec 2025 86,243.20 | 16 | −$42.78 |
| short | 18 Dec 2025 86,243.20 | 23 Jun 2026 64,020.00 | 187 | $22,223.20 |
| long | 23 Jun 2026 64,020.00 | 9 Jul 2026 62,290.00 | 16 | −$1,730.00 |
| short | 9 Jul 2026 62,290.00 | 10 Jul 2026 63,230.00 | 1 | −$940.00 |
| long | 10 Jul 2026 63,230.00 | 11 Jul 2026 64,161.70 | 1 | $931.71 |
| short | 11 Jul 2026 64,161.70 | 28 Sep 2026 84,472.00 | 79 | −$20,310.30 |
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 |
|---|---|---|---|---|---|
| Forex Midpoint Stratejisi For Nasdaq this page | — | v5 strategy | −2.1% | 15 | 6.3% |
| ChBrkOutStrategySMA by anshuanshu333 | sma highest lowest | v4 strategy | −4.5% | 42 | 20.9% |
| KDJ Strategy @ionvolution by ionvolution | sma highest lowest | v5 strategy | No trades on this market | ||
| Trading range display with Box by potatoshop | sma highest lowest | v5 strategy | +0.7% | 27 | 3.9% |
| Open Drive by Marcns_ | highest lowest sma | v5 strategy | No trades on this market | ||
| Trend Bounce [racer8] by racer8 | highest lowest sma | v4 strategy | +2.4% | 22 | 32.2% |
Upgrade and export
Written in Pine Script v5. The clean-v5 step types the settings and moves when = into if blocks, which v6 requires; it is run before and after like any upgrade.
- 3 settings use the untyped input() (line 5, 6, 9). It still compiles in v6; input.int, input.float or input.source state the type.
- No v6-only features. v6 is not needed to run this script.
Same 15 trades and the same P&L on BTCUSDT 1D, 1,000 bars, in Zeal Terminal's engine.
- Line 5: input() → input.int()
- Line 6: input() → input.int()
- Line 9: input() → input.source()
⋯strategy('Forex Midpoint Stratejisi For Nasdaq ', overlay=true)-BPeriod = input(131, 'Başlangıç Period')+BPeriod = input.int(131, 'Başlangıç Period')-kaydirma = input(14, 'Kaydırma Seviyesi')+kaydirma = input.int(14, 'Kaydırma Seviyesi')yuzdeseviyesi = input.float(0.0006, 'Yüzde Seviyesi', step=0.0001)len = input.int(44, minval=1, title="Length")-src = input(close, title="Source")+src = input.source(close, title="Source")out = ta.sma(src, len)⋯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: 15 before, 16 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.
⋯// © MGULHANN-//@version=5+//@version=6strategy('Forex Midpoint Stratejisi For Nasdaq ', overlay=true)⋯Where it runs
| Engine | Compiles | Runs | Matches TradingView |
|---|---|---|---|
| Zeal Terminal · OpenPineScript v2 | Yes 13 ms | Yes 1,000 bars in 22 ms | Not measured |
| PineTS | Not tested | Not tested | 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.
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/// © MGULHANN//@version=5strategy('Forex Midpoint Stratejisi For Nasdaq ', overlay=true)BPeriod = input(131, 'Başlangıç Period')kaydirma = input(14, 'Kaydırma Seviyesi')yuzdeseviyesi = input.float(0.0006, 'Yüzde Seviyesi', step=0.0001)len = input.int(44, minval=1, title="Length")src = input(close, title="Source")out = ta.sma(src, len)ma(source, length, type) => switch type "SMA" => ta.sma(source, length) "EMA" => ta.ema(source, length) "SMMA (RMA)" => ta.rma(source, length) "WMA" => ta.wma(source, length) "VWMA" => ta.vwma(source, length)typeMA = input.string(title = "Method", defval = "EMA", options=["SMA", "EMA", "SMMA (RMA)", "WMA", "VWMA"], group="Smoothing")smoothingLength = input.int(title = "Length", defval = 53, minval = 1, maxval = 100, group="Smoothing")smoothingLine = ma(out, smoothingLength, typeMA)//plot(smoothingLine, title="Smoothing Line", color=color.red, linewidth = 2)//zararDurdurmaYuzde = input.float(0.2, title='Zarar Durdurma %', step=0.01) / 100//karAlmaYuzde = input.float(0.5, title='Kar Alma %', step=0.01) / 100//MIDPOINT HESAPLAmidpoint1 = ta.highest(high, BPeriod) + ta.lowest(low, BPeriod)midpoint2 = midpoint1 / 2midyuzdeseviyesi = midpoint2 * yuzdeseviyesimidtopdeger = midyuzdeseviyesi + midpoint2//GİRİŞ KOŞULLARIbuycross = ta.crossover(smoothingLine, midtopdeger[kaydirma]) //? aort > ta.sma(close,50) : nasellcross = ta.crossover(midtopdeger[kaydirma], smoothingLine) // ? aort < ta.sma(close,50) : na//LONG GİRİŞif (buycross) strategy.entry("BUY", strategy.long) //longKarAl = strategy.position_avg_price * (1 + karAlmaYuzde) //longZararDurdur = strategy.position_avg_price * (1 - zararDurdurmaYuzde) //strategy.exit("Long Exit","Long", stop=longZararDurdur) //SHORT GİRİŞ if (sellcross) strategy.entry("SELL", strategy.short) //shortKarAl = strategy.position_avg_price * (1 - karAlmaYuzde) //shortZararDurdur = strategy.position_avg_price * (1 + zararDurdurmaYuzde) //strategy.exit("Short Exit","Short", stop=shortZararDurdur) //plot(midtopdeger, offset=kaydirma, linewidth=2, color=color.blue)