1Copy the scriptPress Copy script above, or the copy button on the code below.
2Open the Pine EditorOpen a TradingView chart and choose Pine Editor at the bottom of the screen.
3Paste over the templateCreate a new strategy, select all of the template text and paste. Press Save and give it a name.
4Add it to the chartPress Add to chart. The trades and results appear in the Strategy Tester tab; adjust the settings with the gear icon.
Source Code
202 lines of Pine Script v5 from utils-pine/template1.pine, published under MPL-2.0 (file header). Keep the author's credit and licence lines when you reuse it.
Boilerplate Configurable Strategy [Yosiet] filters trades by weekday, session, date range, and an optional news window, and can restrict direction or invert the side. Risk settings include a percentage loss cap, consecutive losing-day and drawdown limits, plus ATR or static reward targets and an optional trailing stop. It draws on the price chart. The provided excerpt does not show completed exit orders.
The inputs you can change from the gear icon on the chart. Defaults are the author's.
Setting
Type
Default
Variable
Strategy Type
string
SQUEEZE
strategyType
Length
int
20
length
Wide BB Multiplier
float
1.5
mult1
Narrow BB Multiplier
float
2.0
mult2
Monday
bool
true
enableMon
Tuesday
bool
true
enableTue
Wednesday
bool
true
enableWed
Thursday
bool
true
enableThu
Friday
bool
true
enableFri
Saturday
bool
true
enableSat
Sunday
bool
true
enableSun
Trading Session (HHmm-HHmm)
string
0000-0000
sessionInput
Show all 30 settings
Setting
Type
Default
Variable
Daily Exit Time
session
1600-1700
exitTime
Start Date
time
timestamp("1 Jan 2024")
startDate
End Date
time
timestamp("31 Jan 2025")
endDate
Enable News Filter
bool
false
enableNewsFilter
News Time (UTC)
time
timestamp("2023-01-01 14:30")
newsTime
News Window (minutes)
int
5
newsWindow
Trade Direction
string
Both
tradeDirection
Inverse Trade Side
bool
false
tradeInverse
Max Loss per Trade (%)
float
2.0
maxLossPerc
Max Consecutive Losing Days
int
3
maxLosingDays
Max Drawdown (%)
float
10.0
maxDD
RR Mode
string
ATR
rrMode
ATR Length
int
14
atrLength
ATR Multiplier
float
1.5
atrMultiplier
Static RR Ratio
float
2.0
staticRR
Enable Trailing Stop
bool
false
useTrail
Trail Activation (%)
float
15
trailStart
Trail Distance (%)
float
0.5
trailDist
Third-party code. ForexR did not write, test or endorse this script, and the summary above was generated automatically from its code and README. Indicators describe the past, and a strategy's backtest can look better than live trading, especially when a script repaints. Check it in the Strategy Tester and on a demo account before you rely on it.
This strategy trades directional momentum breakouts for crude oil on the price chart. It enters long or short positions when a fast exponential moving average crosses a slow exponential moving average, provided that current Average True Range exceeds its movin
This strategy plots Bollinger bands and a simple moving average on the price chart. It opens a short when price crosses above the upper band while below the average, and a long when price crosses below the lower band while above the average. Entries are allowe
This strategy executes long and short trades on the price chart by combining multi-timeframe smoothed Heikin-Ashi trends, higher-timeframe Hull Moving Average variations, and an ATR-based trailing stop. Users can adjust timeframes, smoothing lengths, Hull form
This strategy draws two moving averages on the price chart and uses their bias to open long or short trades. It places the stop beyond a swing high or low using an ATR risk multiple, then sets a limit exit from the reward-to-risk ratio. An optional ATR trail c
Gold Multi-TF NYSE Scalper v2 is an intraday trading strategy for XAUUSD that seeks momentum entries by aligning RSI and EMA bias across multiple timeframes. It filters trades using an optional NYSE session clock and an ATR volatility spike check. Entries exit
ORB Hunter is an Opening Range Breakout strategy that identifies price breakouts beyond a defined opening session window (such as 09:30 to 09:45 EST). It places long or short trades when price crosses the opening range bounds with buffer, confirmed by optional