Strategy · Pine Script v4 · On the chart

Bollinger bands And Aroon Scalping

by hasnocool· code credited to relevantLeader16058

This strategy plots Bollinger Bands on the price chart using the middle band as a simple moving average and standard deviation bands.

View on GitHub

GitHub stars106on the repository
Pine versionv4older, still runs
Lines of code36
Settings14inputs
LicenceGPL-3.0
Last update2 years ago18 Sep 2024

Add It to Your TradingView Chart

  1. 1Copy the scriptPress Copy script above, or the copy button on the code below.
  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

36 lines of Pine Script v4 from Bollinger Bands And Aroon Scalping (by Coinrule).pine, published under GPL-3.0. Keep the author's credit and licence lines when you reuse it.

Bollinger Bands And Aroon Scalping (by Coinrule).pine
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
// © relevantLeader16058
//@version=4
strategy(shorttitle='Bollinger bands And Aroon Scalping',title='Bollinger bands And Aroon Scalping (by Coinrule)', overlay=true, initial_capital = 1000, process_orders_on_close=true, default_qty_type = strategy.percent_of_equity, default_qty_value = 30, commission_type=strategy.commission.percent, commission_value=0.1)
//Backtest dates
fromMonth = input(defval = 1,    title = "From Month",      type = input.integer, minval = 1, maxval = 12)
fromDay   = input(defval = 1,    title = "From Day",        type = input.integer, minval = 1, maxval = 31)
fromYear  = input(defval = 2020, title = "From Year",       type = input.integer, minval = 1970)
thruMonth = input(defval = 1,    title = "Thru Month",      type = input.integer, minval = 1, maxval = 12)
thruDay   = input(defval = 1,    title = "Thru Day",        type = input.integer, minval = 1, maxval = 31)
thruYear  = input(defval = 2112, title = "Thru Year",       type = input.integer, minval = 1970)
showDate  = input(defval = true, title = "Show Date Range", type = input.bool)
start     = timestamp(fromYear, fromMonth, fromDay, 00, 00)        // backtest start window
finish    = timestamp(thruYear, thruMonth, thruDay, 23, 59)        // backtest finish window
window()  => time >= start and time <= finish ? true : false       // create function "within window of time"
// BB inputs and calculations
lengthBB = input(20, minval=1)
src = input(close, title="Source")
mult = input(2.0, minval=0.001, maxval=50, title="StdDev")
basis = sma(src, lengthBB)
dev = mult * stdev(src, lengthBB)
upper = basis + dev
lower = basis - dev
offset = input(0, "Offset", type = input.integer, minval = -500, maxval = 500)
lengthAr = input(288, minval=1)
AroonUP = 100 * (highestbars(high, lengthAr+1) + lengthAr)/lengthAr
AroonDown = 100 * (lowestbars(low, lengthAr+1) + lengthAr)/lengthAr
Confirmation = input(90, "Aroon Confirmation")
Stop = input(70, "Aroon Stop")
Bullish = crossunder (close, basis)
Bearish = crossunder (close, upper)
//Entry 
strategy.entry(id="long", long = true, when = Bullish and AroonUP > Confirmation and window())
//Exit
strategy.close("long", when = Bearish or AroonUP < Stop and window())
Expand (53 lines)

Overview

Bollinger bands And Aroon Scalping signals long entries when the close price crosses below the middle band combined with Aroon up trending above 90 and within the specified backtest time window. The strategy exits the long position when the close crosses below the upper band or the Aroon up indicator drops below 70. It uses 30 percent of equity for position sizing with a 0.1 percent commission per trade. The main settings allow adjustment of Bollinger length, standard deviation multiplier, Aroon length, confirmation threshold, and stop threshold. It draws the Bollinger Bands directly on the price chart.

Details

Published by

hasnocool on GitHub

Code credit

relevantLeader16058, as written in the script's header

Type

Strategy, Pine Script v4

Draws

On the price chart

Category

Moving averages, Volatility & bands, Oscillators & momentum, Scalping

Markets

Crypto

Timeframes

Any timeframe

Risk Notes

  • The strategy enters trades without a stop loss

Topics

analysisbtcusdtcryptocurrencydatapandaspythonsimulationtradingtradingview

Settings

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

SettingTypeDefaultVariable
From Monthint1fromMonth
From Dayint1fromDay
From Yearint2020fromYear
Thru Monthint1thruMonth
Thru Dayint1thruDay
Thru Yearint2112thruYear
Show Date RangebooltrueshowDate
lengthBBint20lengthBB
Sourcesourceclosesrc
StdDevfloat2.0mult
Offsetint0offset
lengthArint288lengthAr
Show all 14 settings
SettingTypeDefaultVariable
Aroon Confirmationint90Confirmation
Aroon Stopint70Stop
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

330 stars

This strategy plots MACD line, signal line, Bollinger Bands, and RSI on the price chart. It signals long entries on MACD crossover above signal with RSI below 50 and price below BB basis, plus optional DMI filter. Short entries are available but disabled by de

Strategy v5 Oscillators & momentumVolatility & bands
Updated 2 months ago · None stated GitHub repository of MACD + BB + RSI [Alorse]
257 stars

This strategy is designed for 1-minute S&P 500 futures trading using multi-timeframe data and Fibonacci-weighted standard deviation bands around volume-weighted moving averages. It requests data from multiple higher timeframes without lookahead to prevent repa

Strategy v5 Volatility & bandsMoving averages
Updated 6 weeks ago · None stated GitHub repository of ES - Futures 1M No Repaint Fixed

Take Profits & Stop Losses

by PythonForForex
64 stars

This educational strategy demonstrates moving average crossovers filtered by RSI momentum, incorporating ATR-based risk management. It calculates a 10-period SMA, a 30-period SMA, a 14-period RSI, and a 14-period ATR. Long entries trigger when the fast SMA cro

Strategy v5 Moving averagesOscillators & momentum
Updated 4 years ago · None stated GitHub repository of Take Profits & Stop Losses

Momentum Rider DAILY FINAL

by greenpeas007
58 stars

This strategy combines exponential moving averages (EMA 9, 21, 50), RSI, MACD, and Supertrend indicators to enter long positions. It triggers trades using six dynamic setups based on momentum breakouts, EMA crossovers, and pullbacks. Position sizing is compute

Strategy v6 TrendOscillators & momentum Repaints
Updated 4 months ago · Custom licence GitHub repository of Momentum Rider DAILY FINAL

Bollinger bands examples

by tradingstrategy-ai
53 stars

This strategy plots exponential-moving-average Bollinger bands on the price chart and calculates RSI. It opens a long position when close crosses above the upper band while RSI is at or above a threshold, the date filter allows trading, and no position is open

Strategy v5 Volatility & bandsOscillators & momentum
Updated 3 years ago · None stated GitHub repository of Bollinger bands examples
53 stars

This strategy trades EUR/USD on the price chart using a fast and slow exponential moving average crossover filtered by RSI. It enters long when the fast EMA crosses above the slow EMA while RSI is above 50 and below the overbought level, and enters short on th

Strategy v6 TrendMoving averages
Updated 2 months ago · MPL-2.0 GitHub repository of EUR/USD EMA9-21 + RSI Scalping 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