Pine Script v5 · Strategy
Parabolic SAR Heikin Ashi MTF Candle Scalper
A Pine Script v5 strategy with no technical-analysis calculation. It has 3 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. 6 settings; defaults include Timeframe 15, Start 0.05 and Increment 0.02.
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 Parabolic SAR Heikin Ashi MTF Candle Scalper repaint?
- No
- No repainting patterns were found in the source. The live replay was not measured: it had no trades to compare.
- How did Parabolic SAR Heikin Ashi MTF Candle Scalper 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, so there is no result to report. Its code limits trading to a session window, which can leave these candles out. It closed no trades on the other markets either. A backtest, not investment advice.
- Does Parabolic SAR Heikin Ashi MTF Candle Scalper run in Pine Script v6?
- No
- The v6 version does not run in Zeal Terminal's engine: Pine Script v6 Error at @L16:C4: a 'bool' cannot be 'na' in Pine Script v6 — declare it as true or false. The v6 version is shown for reference and is not offered as a download.
- Does Parabolic SAR Heikin Ashi MTF Candle Scalper use a stop loss?
- No
- Every exit waits for a signal; nothing limits a losing trade before it fires.
- Does Parabolic SAR Heikin Ashi MTF Candle Scalper run in Zeal Terminal?
- Yes
- It compiles in 15 ms and runs 1,000 bars in 44 ms, in the browser.
BTCUSDT · 1D · default settings
- Winning trade
- Losing trade
- Equity
- Buy and hold
Needs heikinashi:SYMBOL 15 data, not available: a lower timeframe than the chart; the engine does not evaluate intrabar data Needs heikinashi:BINANCE:BTCUSDT 15 data, not available: a lower timeframe than the chart; the engine does not evaluate intrabar data Values that depend on it are empty on this chart.
- 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
- 0.00%
- $0.00
One run with the author's default settings, $1,000,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
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
3 settings have no label
In the settings dialog timeframe (line 5), start (line 70), increment (line 71) show an empty name. The labels on this page come from the variable names.
-
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 83, 84. The upgraded version below moves each call inside an if block.
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 |
|---|---|---|---|
| Timeframe (no label in the script) | 15 | timeframe | close_mtf open_mtf high_mtf low_mtf |
| Start (no label in the script) | 0.05 | float · step 0.01 | acceleration out |
| Increment (no label in the script) | 0.02 | float · step 0.01 | out |
| Max Value | 0.2 | float · step 0.01 | out |
| Entry time | 0900-1000 | session | entry_candle_time |
| Exit time | 1200-1600 | session | exit_candle_time |
What it calculates
No technical-analysis calculation: the script works on prices and settings directly.
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 | longclose_mtf[1] > out | On | 83 |
| Open short short | shortclose_mtf[1] < out | On | 84 |
| Close | (exit_candle_time) | On | 86 |
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 data4 request.security call(s), none with lookahead on.
- 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
Not run on other markets: the script requests heikinashi:SYMBOL 15, heikinashi:BINANCE:BTCUSDT 15, and that data is not available here (a lower timeframe than the chart; the engine does not evaluate intrabar data; a lower timeframe than the chart; the engine does not evaluate intrabar data). Its results would rest on empty values.
Similar scripts
No other indicator or strategy here shares enough of its calculations.
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.
- 2 strategy calls use the when = argument (line 83, 84). It is deprecated in v5 and removed in v6, where each call moves inside an if block.
- No v6-only features. v6 is not needed to run this script.
Clean v5
Not verifiedNeither version placed a trade on any of the 8 markets, so there was nothing to compare.
- Line 83: when = long → if block
- Line 84: when = short → if block
⋯if(entry_candle_time)- strategy.entry("long",strategy.long,when=long)+ if long+ strategy.entry("long",strategy.long)- strategy.entry("short",strategy.short,when=short)+ if short+ strategy.entry("short",strategy.short)if(exit_candle_time)⋯Does it run in Pine Script v6?
No
The v6 version does not run in Zeal Terminal's engine: Pine Script v6 Error at @L16:C4: a 'bool' cannot be 'na' in Pine Script v6 — declare it as true or false. The v6 version is shown for reference and is not offered as a download. It differs from the v5 version by 1 edit.
⋯// © exlux99-//@version=5+//@version=6strategy("SAR HA MTF Scalper ", overlay=true)⋯Where it runs
| Engine | Compiles | Runs | Matches TradingView |
|---|---|---|---|
| Zeal Terminal · OpenPineScript v2 | Yes 15 ms | With a workaround 1,000 bars in 44 ms | Not measured |
| PineTS | Not tested | Not tested | Not measured |
The engine's host API cannot yet declare a chart's symbol and timeframe, so this page sets them on the engine directly for each market.
“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/// © exlux99//@version=5strategy("SAR HA MTF Scalper ", overlay=true)timeframe=input.timeframe('15', "Resolution")close_mtf = request.security(ticker.heikinashi(syminfo.tickerid), timeframe, close)open_mtf = request.security(ticker.heikinashi(syminfo.tickerid), timeframe, open)high_mtf = request.security(ticker.heikinashi(syminfo.tickerid), timeframe, high)low_mtf = request.security(ticker.heikinashi(syminfo.tickerid), timeframe, low)////////////////// The same on Pinepine_sar(start, inc, max) => var float result = na var float maxMin = na var float acceleration = na var bool isBelow = na bool isFirstTrendBar = false if bar_index == 1 if close_mtf > close_mtf[1] isBelow := true maxMin := high_mtf result := low_mtf[1] else isBelow := false maxMin := low_mtf result := high_mtf[1] isFirstTrendBar := true acceleration := start result := result + acceleration * (maxMin - result) if isBelow if result > low_mtf isFirstTrendBar := true isBelow := false result := math.max(high_mtf, maxMin) maxMin := low_mtf acceleration := start else if result < high_mtf isFirstTrendBar := true isBelow := true result := math.min(low_mtf, maxMin) maxMin := high_mtf acceleration := start if not isFirstTrendBar if isBelow if high_mtf > maxMin maxMin := high_mtf acceleration := math.min(acceleration + inc, max) else if low_mtf < maxMin maxMin := low_mtf acceleration := math.min(acceleration + inc, max) if isBelow result := math.min(result, low_mtf[1]) if bar_index > 1 result := math.min(result, low_mtf[2]) else result := math.max(result, high_mtf[1]) if bar_index > 1 result := math.max(result, high_mtf[2]) result////////////////start = input.float(0.05, step=0.01)increment = input.float(0.02,step=0.01)maximum = input.float(0.2, "Max Value",step=0.01)out = pine_sar(start,increment,maximum)long = close_mtf[1] > outshort = close_mtf[1] < outentry_time = input.session(title='Entry time', defval='0900-1000') exit_time = input.session(title='Exit time', defval='1200-1600') BarInSession(sess) => not na(time(timeframe.period, sess))entry_candle_time = BarInSession(entry_time)exit_candle_time = BarInSession(exit_time)if(entry_candle_time) strategy.entry("long",strategy.long,when=long) strategy.entry("short",strategy.short,when=short)if(exit_candle_time) strategy.close_all()