Pine Script v5 · Strategy
Scalping Support Resistance Strategy
A Pine Script v5 strategy built on Lowest (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 and a profit target. Each trade is one contract and pays no commission. 8 settings; defaults include Symbol BTC, Balance 20 and Take Percent 1.
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 Scalping Support Resistance Strategy repaint?
- Yes
- At least one pattern in the source can repaint: intrabar recalculation.
- Does Scalping Support Resistance Strategy run in Pine Script v6?
- Not tested
- The v5 script does not run in Zeal Terminal's engine (Pine Script v5 Error at @L18:C0: no source was supplied for the library 'HPotter/RouterOrdersIron/1'. Libraries cannot be fetched from TradingView; supply the source in the 'libraries' option. No libraries were supplied.), so this step could not be checked. The v6 version is shown for reference and is not offered as a download.
- Does Scalping Support Resistance Strategy use a stop loss?
- Yes
- strategy.exit sets a stop on line 8, 15.
- Does Scalping Support Resistance Strategy run in Zeal Terminal?
- No
- Not yet: it imports the library HPotter/RouterOrdersIron/1, whose source is not available here, so it does not run here
Review
What a careful reader of this script would point out, found by checking the source.
-
Check
No commission
The backtest assumes free trading. Results on any real exchange will be lower.
-
Note
8 settings have no label
In the settings dialog symbol (line 19), ID (line 20), balance (line 21), TakePercent (line 22), StopPercent (line 23), LookBack (line 24), PointBack (line 25), ShowBackTest (line 26) 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.
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 |
|---|---|---|---|
| Symbol (no label in the script) | BTC | string | msg line 43 line 45 |
| ID (no label in the script) | | string | msg line 43 line 45 |
| Balance (no label in the script) | 20 | float · min 12 | msg line 43 line 45 |
| Take Percent (no label in the script) | 1 | float · min 0.00001 | Take |
| Stop Percent (no label in the script) | 1 | float · min 0.00001 | Stop |
| Look Back (no label in the script) | 10 | int | LLS lineLevel |
| Point Back (no label in the script) | 5 | int | Level |
| Show Back Test (no label in the script) | false | bool | Work |
What it calculates
- Lowesthlc3, Look Back (10)
LLS · line 33
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 |
|---|---|---|---|
| cancel_all | every bar | On | 4 |
| Open Long long | every bar | On | 6 |
| Exit Exit stop and limit | every bar | On | 8 |
| cancel_all | every bar | On | 11 |
| Open Short short | every bar | On | 13 |
| Exit Exit stop and limit | every bar | On | 15 |
Each order is guarded by the setting shown. “Off” orders never fire unless that setting is switched on.
Does it repaint?
Yes
At least one pattern in the source can repaint; it is marked Check below.
The live replay needs a run, and this script does not run in Zeal Terminal yet; the answer comes from the checks on the source alone.
- ClearHigher-timeframe dataThe script requests no other symbol or timeframe.
- ClearFuture-bar referencesNo negative history offsets such as close[-1].
- CheckIntrabar recalculationreads realtime-only state. Live values can differ from history.
- 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.
Similar scripts
Indicators and strategies built from the same calculations.
| Script | Shares | Type | Net | Trades | Max drawdown |
|---|---|---|---|---|---|
| I11L - Reversal Trading Ideas by Larry Connors by I11L | lowest | v5 strategy | +101.7% | 119 | 58.8% |
| Exponential Stochastic Strategy by faytterro | lowest | v5 strategy | +64.1% | 85 | 42.2% |
| STRATEGY TESTER ENGINE - ON CHART DISPLAY - PLUG & PLAY by FiatDropout | lowest | v4 strategy | +496.9% | 997 | 732.3% |
| Alex Days HiLo Rajib by 14rajib | lowest | v4 strategy | No trades on this market | ||
| Donchian Strat EXMO by pskoroplas | lowest | v4 strategy | +12.1% | 22 | 68.0% |
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.
- No v6-only features. v6 is not needed to run this script.
Clean v5
VerifiedNothing to change.
Does it run in Pine Script v6?
Not tested
The v5 script does not run in Zeal Terminal's engine (Pine Script v5 Error at @L18:C0: no source was supplied for the library 'HPotter/RouterOrdersIron/1'. Libraries cannot be fetched from TradingView; supply the source in the 'libraries' option. No libraries were supplied.), so this step could not be checked. The v6 version is shown for reference and is not offered as a download. It differs from the v5 version by 1 edit.
⋯ strategy.exit('Exit', 'Short', limit = Level-Take, stop = Level + Stop, alert_message = msg)-//@version=5+//@version=6strategy("Iron Support Resistance Automat", shorttitle="Iron SRA", overlay = true, calc_on_order_fills = true)⋯Where it runs
| Engine | Compiles | Runs | Matches TradingView |
|---|---|---|---|
| Zeal Terminal · OpenPineScript v2 | No It imports the library HPotter/RouterOrdersIron/1, whose source is not available here, so it does not run here | 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/// © HPotterTradeLong(Level, Take, Stop, ID, symbol, balance) => strategy.cancel_all() msg = ROI.MsgDoLongMKT(ID, symbol, balance) strategy.entry("Long", strategy.long, stop = Level, alert_message = msg) msg := ROI.MsgDoLongMKT(ID, symbol, 0) strategy.exit('Exit', 'Long', limit = Level+Take, stop = Level - Stop, alert_message = msg) TradeShort(Level, Take, Stop, ID, symbol,balance) => strategy.cancel_all() msg = ROI.MsgDoShortMKT(ID, symbol, balance) strategy.entry("Short", strategy.short, stop = Level, alert_message = msg) msg := ROI.MsgDoShortMKT(ID, symbol, 0) strategy.exit('Exit', 'Short', limit = Level-Take, stop = Level + Stop, alert_message = msg)//@version=5strategy("Iron Support Resistance Automat", shorttitle="Iron SRA", overlay = true, calc_on_order_fills = true)import HPotter/RouterOrdersIron/1 as ROIsymbol = input.string("BTC")ID = input.string("")balance = input.float(20, minval=12)TakePercent= input.float(1, minval=0.00001)StopPercent= input.float(1, minval=0.00001)LookBack = input.int(10)PointBack = input.int(5)ShowBackTest = input.bool(false)var Green = color.new(color.green, 0)var Red = color.new(color.red, 0)var Blue = color.new(color.blue, 0)var Work = ShowBackTestif barstate.islastconfirmedhistory or barstate.isrealtime Work := trueLLS = ta.lowest(hlc3, LookBack)Level = LLS[PointBack]var line lineLevel = na clr = close > Level ? Red : Green line.delete(lineLevel)lineLevel := line.new(bar_index-LookBack, LLS[LookBack], bar_index, Level, color = clr)Take = Level * TakePercent / 100 Stop = Level * StopPercent / 100 if Work and strategy.position_size == 0 if close < Level TradeLong(Level, Take, Stop, ID, symbol, balance) if close > Level TradeShort(Level, Take, Stop, ID, symbol, balance)barcolor(strategy.position_size < 0 ? Red : strategy.position_size > 0 ? Green: Blue)