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
84 lines of Pine Script v4 from 3Commas Bollinger Strategy.pine, published under GPL-3.0. Keep the author's credit and licence lines when you reuse it.
3Commas Bollinger Strategy plots short and long simple moving averages, offset bands, and the average entry price of the open deal. A long starts when price crosses the lower band inside a chosen date range. Base and safety order sizes, volume and step scales, and a maximum safety-order count shape the position. Percent stop-loss and take-profit inputs are available, though the supplied excerpt does not show an exit being placed.
The inputs you can change from the gear icon on the chart. Defaults are the author's.
Setting
Type
Default
Variable
Simple bot
string
composite
bot_type
3Commas Bot ID
string
bot_id
Bot Email Token
string
email_token
Base order size
int
500
base_order_size
Safety order size
int
1000
safety_order_size
Safety Order Vol Scale (%)
float
1.83
volume_scale
Safety Order Step Scale (%)
float
1.55
safety_step
Max Number of Safety Orders
int
4
safety_max
Initial SO Deviation (%)
float
0.8
initial_deviation_input
Long Stop Loss (%)
int
15
stoploss_input
Long Take Profit (%)
float
1.4
takeprofit_input
Short MA Window
int
20
sma_short_val
Show all 22 settings
Setting
Type
Default
Variable
Long MA Window
int
100
sma_long_val
Upper Band Offset
float
2.5
ubOffset
Lower Band Offset
float
2.5
lbOffset
Entrry at Cross Over/Under Lower
string
over
cross
Start Date
int
1
startDate
Start Month
int
1
startMonth
Start Year
int
2016
startYear
End Date
int
31
endDate
End Month
int
12
endMonth
End Year
int
2022
endYear
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 plots Bollinger Bands on the price chart with adjustable length, standard deviation, and offset. It defines buy and sell zones using candle size percentage and body size thresholds. Long positions enter when the lower zone is breached without con
The Mean Reversion Strategy Template calculates a baseline mean using SMA, EMA, or VWAP alongside upper and lower deviation bands based on standard deviation, ATR, or percentage offsets. It generates long and short entries when price touches, bounces from, or
This strategy generates buy and sell signals based on Bollinger Band crossovers combined with a simple moving average trend filter. It enters a long position when price crosses above the lower band while trading above the SMA filter line, and enters a short po
This strategy executes trades based on price interactions with standard Bollinger Bands plotted on the price chart. It calculates a simple moving average basis line along with upper and lower standard deviation bands. Long entries are triggered when price cros
This strategy scaffold calculates a standard Volume Weighted Average Price (VWAP) alongside upper and lower volatility bands set 1.5 ATRs away. It generates long entry signals when a confirmed bar closes below the lower band and short entry signals when a conf
This strategy plots a simple moving average basis and upper and lower Bollinger bands on the price chart, with a fill between the bands. It also calculates RSI. It opens one long trade when RSI is above 25, price is at or below the lower band, and no position