- Platform
-
- Thinkorswim
Here is a simple indicator that signals when reversal to midline of Bollinger Bands is expected.
Code:
# Bollinger Bands Reversal to Mean
# Free for use. Header credits must be included when any form of the code included in this package is used.
# Any indicator built on this indicator needs to attribute the original author's work
# v1.0 - barbaros - released for b4indicators.com
def upper = BollingerBands().UpperBand;
def mid = BollingerBands().MidLine;
def lower = BollingerBands().LowerBand;
plot buy = low[1] < lower[1] and close > high[1] and close < mid;
buy.SetPaintingStrategy(PaintingStrategy.BOOLEAN_ARROW_UP);
buy.SetDefaultColor(Color.CYAN);
plot sell = high[1] > upper[1] and close < low[1] and close > mid;
sell.SetPaintingStrategy(PaintingStrategy.BOOLEAN_ARROW_DOWN);
sell.SetDefaultColor(Color.MAGENTA);
Alert(buy[1], "Buy", Alert.BAR, Sound.Ding);
Alert(sell[1], "Sell", Alert.BAR, Sound.Ding);
