How can I plot Bollinger Bands (any length, any standard deviation) on the McClellan Oscillator regardless of what CASE e.g. NYSE, NASDAQ, etc. I'd like to chart in a subgraph? Scratching my head on this one after several hours. Thanks!
Ruby:# # TD Ameritrade IP Company, Inc. (c) 2009-2022 # declare lower; input exchange = {default NYSE, NASDAQ, AMEX}; input fastLength = 19; input slowLength = 39; input over_bought = 100; input over_sold = -100; input ratioAdjusted = No; plot McClellanOsc = reference McClellanSummationIndex(exchange = exchange, "fast length" = fastLength, "slow length" = slowLength, "ratio adjusted" = ratioAdjusted).mcClellanOsc; plot OverBought = over_bought; plot OverSold = over_sold; plot ZeroLine = 0; McClellanOsc.SetDefaultColor(GetColor(1)); OverBought.SetDefaultColor(GetColor(5)); OverSold.SetDefaultColor(GetColor(5)); ZeroLine.SetDefaultColor(GetColor(3)); def price = mcclellanOsc; input displace = 0; input length = 20; input Num_Dev_Dn = -2.0; input Num_Dev_up = 2.0; input averageType = AverageType.Simple; def sDev = stdev(data = price[-displace], length = length); plot MidLine = MovingAverage(averageType, data = price[-displace], length = length); plot LowerBand = MidLine + num_Dev_Dn * sDev; plot UpperBand = MidLine + num_Dev_Up * sDev; LowerBand.SetDefaultColor(GetColor(0)); MidLine.SetDefaultColor(GetColor(1)); UpperBand.SetDefaultColor(GetColor(5));
Can this be done with keltner channel?
Ruby:# # TD Ameritrade IP Company, Inc. (c) 2009-2022 # declare lower; input exchange = {default NYSE, NASDAQ, AMEX}; input fastLength = 19; input slowLength = 39; input over_bought = 100; input over_sold = -100; input ratioAdjusted = No; plot McClellanOsc = reference McClellanSummationIndex(exchange = exchange, "fast length" = fastLength, "slow length" = slowLength, "ratio adjusted" = ratioAdjusted).mcClellanOsc; plot OverBought = over_bought; plot OverSold = over_sold; plot ZeroLine = 0; McClellanOsc.SetDefaultColor(GetColor(1)); OverBought.SetDefaultColor(GetColor(5)); OverSold.SetDefaultColor(GetColor(5)); ZeroLine.SetDefaultColor(GetColor(3)); def price = mcclellanOsc; declare weak_volume_dependency; input displace = 0; input factor = 1.5; input length = 20; input averageType = AverageType.SIMPLE; input trueRangeAverageType = AverageType.SIMPLE; def shift = factor * MovingAverage(trueRangeAverageType, TrueRange(price, price, price), length); def average = MovingAverage(averageType, price, length); plot Avg = average[-displace]; Avg.SetDefaultColor(GetColor(1)); plot Upper_Band = average[-displace] + shift[-displace]; Upper_Band.SetDefaultColor(GetColor(8)); plot Lower_Band = average[-displace] - shift[-displace]; Lower_Band.SetDefaultColor(GetColor(5));
Thanks!See if this helps
Is there a possibility to added a red color when McClellan goes below 0 and turns negative? I am using the standard one from thinkorswim, but when negative it shows the same color as possible. Thanks!This is generally how one adds a bollinger band to another indicator.
#
# TD Ameritrade IP Company, Inc. (c) 2009-2023
#
input exchange = {default NYSE, NASDAQ, AMEX};
input fastLength = 19;
input slowLength = 39;
input over_bought = 100;
input over_sold = -100;
input ratioAdjusted = No;
def McClellanOsc = reference McClellanSummationIndex(exchange = exchange, "fast length" = fastLength, "slow length" = slowLength, "ratio adjusted" = ratioAdjusted).mcClellanOsc;
def OverBought = over_bought;
def OverSold = over_sold;
def ZeroLine = 0;
plot bullish = if McClellanOsc crosses above ZeroLine then low else double.nan;
plot bearish = if McClellanOsc crosses below ZeroLine then high else double.nan;
bullish.setPaintingStrategy(PaintingStrategy.ARROW_UP);
bearish.setPaintingStrategy(PaintingStrategy.ARROW_DOWN);
I modified the standard indicator for the same reason.Is there a possibility to added a red color when McClellan goes below 0 and turns negative? I am using the standard one from thinkorswim, but when negative it shows the same color as possible. Thanks!
input exchange = {default NYSE, NASDAQ, AMEX};
input fastLength = 19;
input slowLength = 39;
input over_bought = 100;
input over_sold = -100;
input ratioAdjusted = No;
def McClellanOsc = reference McClellanSummationIndex(exchange = exchange, "fast length" = fastLength, "slow length" = slowLength, "ratio adjusted" = ratioAdjusted).mcClellanOsc;
def OverBought = over_bought;
def OverSold = over_sold;
def ZeroLine = 0;
AddCloud(McClellanOsc, ZeroLine, Color.GREEN, Color.Red);
AddLabel(1, "McCellan: " + McClellanOsc , IF McClellanOsc > 0 then Color.GREEN else Color.RED);
#plot bullish = if McClellanOsc crosses above ZeroLine then low else double.nan;
#plot bearish = if McClellanOsc crosses below ZeroLine then high else double.nan;
#bullish.setPaintingStrategy(PaintingStrategy.ARROW_UP);
#bearish.setPaintingStrategy(PaintingStrategy.ARROW_DOWN);
How do I make the McCellan Oscillator indicator cloud a solid color:
Is it possible to show the thinkscript for the McClellan Osc with Bollinger Bands?This is generally how one adds a bollinger band to another indicator.
I have looked but can't seem to find a study that marks the price chart when the McClellan Osc. crosses above or below the zero line. Anything like this available? Thanks for any help.
Join useThinkScript to post your question to a community of 21,000+ developers and traders.
Thread starter | Similar threads | Forum | Replies | Date |
---|---|---|---|---|
P | McClellan Oscillator Visualizer For ThinkOrSwim | Custom | 4 | |
F | Hindenburg Omen with McClellan Cancellation For ThinkOrSwim | Custom | 2 | |
![]() |
Jman Donchian Bounded Volume Oscillator For ThinkOrSwim | Custom | 0 | |
S | The Ultimate Oscillator For ThinkOrSwim | Custom | 2 | |
L | Repaints Two-Pole Oscillator [BigBeluga] For ThinkOrSwim | Custom | 5 |
Start a new thread and receive assistance from our community.
useThinkScript is the #1 community of stock market investors using indicators and other tools to power their trading strategies. Traders of all skill levels use our forums to learn about scripting and indicators, help each other, and discover new ways to gain an edge in the markets.
We get it. Our forum can be intimidating, if not overwhelming. With thousands of topics, tens of thousands of posts, our community has created an incredibly deep knowledge base for stock traders. No one can ever exhaust every resource provided on our site.
If you are new, or just looking for guidance, here are some helpful links to get you started.