Strategy · Pine Script v5 · On the chart

Bollinger Trend - Strategy V1

by jackseg80

This strategy executes trend-following trades based on Bollinger Band breakouts confirmed by a long-term moving average filter.

View on GitHub

GitHub stars4on the repository
Pine versionv5runs as is
Lines of code119
Settings12inputs
LicenceNone stated
Last update2 years ago17 Jan 2024

Add It to Your TradingView Chart

  1. 1Copy the scriptPress Copy script above. It reads the file straight from GitHub.
  2. 2Open the Pine EditorOpen a TradingView chart and choose Pine Editor at the bottom of the screen.
  3. 3Paste over the templateCreate a new strategy, select all of the template text and paste. Press Save and give it a name.
  4. 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

The code stays on GitHub. The author has not published this script under an open licence, so ForexR does not show its code. Copy script reads the file straight from GitHub into your clipboard, so you can still try it on your own chart. Ask the author before reusing the code anywhere else.

Overview

A long position opens when the price crosses above the upper Bollinger Band, provided the band spread meets a minimum threshold and price is above the moving average filter. Long positions close when the price drops below the middle basis line. Symmetrical logic applies to short positions. Users can adjust band parameters, spread limits, filter MA types, and backtest date ranges. The script draws directly on the main price chart and lacks hard stop-loss orders.

Details

Published by

jackseg80 on GitHub

Type

Strategy, Pine Script v5

Draws

On the price chart

Category

Volatility & bands, Trend, Moving averages, Breakout

Markets

Crypto

Timeframes

Any timeframe

Risk Notes

  • The strategy enters trades without a stop loss

Topics

javascriptpythonanalysisbacktestingcryptotrading-bot

Settings

The inputs you can change from the gear icon on the chart. Defaults are the author's.

SettingTypeDefaultVariable
Sourcesourceclosesrc
Window of the Bollinger Bandint100length
Standard Deviation of the Bollinger Bandfloat2.1mult
Minimal spread between the two Bollinger Bandfloat0.0spread_input
Enablebooltrueshow_ma
MA lengthint480ma_input
Select MA TypestringMAselect_ma
Long Positionsbooltrueuse_longs
Short Positionsboolfalseuse_short
Analysis period ?booltrueuse_period
Start datetimetimestamp("01 Jan 2020")startDate
End Datetimetimestamp("01 Jan 2025")endDate
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.

Similar Pine Scripts

106 stars

This strategy runs on the price chart and enters long when a fast simple moving average crosses above a slow one, and short on the opposite cross, while closing the other side. Entries also need ATR above a filter, a pullback check, a minimum candle-body chang

Strategy v5 TrendMoving averages
Updated 2 years ago · GPL-3.0 GitHub repository of 9:22 5 MIN 15 MIN BANKNIFTY

均线突破交易系统

by tangly1024
76 stars

This strategy trades long breakouts of a fast and a slow moving average on the price chart. It opens a long position when price crosses above either average, using a percentage of equity as size. It reduces the position by a set share when the high reaches the

Strategy v5 TrendMoving averages
Updated 4 months ago · None stated GitHub repository of 均线突破交易系统
16 stars

This strategy plots Donchian channels, trailing stops, and profit targets directly on the price chart. It enters breakout trades using a 55-bar Donchian channel and sizes positions according to an ATR-based risk percentage per unit. The system adds units as pr

Strategy v6 TrendBreakout
Updated 11 months ago · None stated GitHub repository of Seykota Alt 10: Profit Targets
4 stars

The Keltner Channel Strategy is a breakout system plotted directly on the main price chart. It calculates upper and lower channel bands around an exponential or simple moving average using ATR, True Range, or bar range multiplied by a specified factor. A long

Strategy v5 TrendVolatility & bands
Updated 5 months ago · None stated GitHub repository of Keltner Channel Strategy

This strategy combines Bollinger Bands and Bollinger Band Width to trigger breakout trades during periods of low volatility. It opens long positions when price crosses above the upper band while band width is below its 100-period moving average, and opens shor

Strategy v5 TrendVolatility & bands
Updated 4 years ago · CC0-1.0 GitHub repository of Greeffer's Bolinger Band Hedge Strategy

More strategys

Trade Your Charts With a Regulated Broker

Compare brokers that connect to TradingView, with spreads, minimum deposits and leverage side by side.

Compare brokers