petergluis
Active member
I convert Bull Market Support Band for ThinkorSwim.
This moving average indicator is a bull market support band. It's significance comes from the previous bull runs where the price was bouncing off or riding from a distance the support band until the end of the market cycle.
https://www.tradingview.com/script/uSBR7cFa-Bull-Market-Support-Band-20w-SMA-21w-EMA/
This moving average indicator is a bull market support band. It's significance comes from the previous bull runs where the price was bouncing off or riding from a distance the support band until the end of the market cycle.
https://www.tradingview.com/script/uSBR7cFa-Bull-Market-Support-Band-20w-SMA-21w-EMA/
Ruby:
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
// © legroszach
//@version=4
study("Bull Market Support Band", overlay=true, resolution="W")
source = close
smaLength = 20
emaLength = 21
sma = sma(source, smaLength)
ema = ema(source, emaLength)
outSma = security(syminfo.tickerid, timeframe.period, sma)
outEma = security(syminfo.tickerid, timeframe.period, ema)
smaPlot = plot(outSma, color=color.red, title="20w SMA")
emaPlot = plot(outEma, color=color.green, title="21w EMA")
// thanks @bbrujas for the heads up
fill(smaPlot, emaPlot, color=color.new(color.orange, 75), fillgaps=true)
Ruby:
#[URL]https://www.tradingview.com/script/uSBR7cFa-Bull-Market-Support-Band-20w-SMA-21w-EMA/[/URL]
#© legroszach
def source = close;
def smaLength = 20;
def emaLength = 21;
def sma = Average(source, smaLength);
def ema = ExpAverage(source, emaLength);
Plot LineSma = sma;
LineSma.DefineColor("UpTrend", Color.GREEN);
LineSma.DefineColor("DownTrend", Color.RED);
LineSma.SetLineWeight(3);
LineSma.SetPaintingStrategy(PaintingStrategy.LINE);
LineSma.SetStyle(Curve.FIRM);
LineSma.AssignValueColor(if LineSma > LineSma [1] then LineSma.Color("UpTrend") else LineSma.Color("DownTrend"));
plot LineEma = ema;
LineEma.DefineColor("UpTrend", Color.light_GREEN);
LineEma.DefineColor("DownTrend", Color.Light_RED);
LineEma.SetLineWeight(3);
LineEma.SetPaintingStrategy(PaintingStrategy.LINE);
LineEma.SetStyle(Curve.FIRM);
LineEma.AssignValueColor(if LineEma > LineEma [1] then LineEma.Color("UpTrend") else LineEma.Color("DownTrend"));
Addcloud (sma, ema, color.cyan, color.cyan);