# TMO & RSILG candle colors

#### Mbaker333

##### New member
VIP
My candles are colored to match the TMO lower study that shares space with the RSILG. Is there a way to keep the TMO candle color scheme but add a condition that colors the candles yellow/blue when the RSILG and TMO overlap at there critical limits?
im new so maybe the question is confusing so maybe the picture helps illustrate...

Any help is very much appreciated!

Last edited:
Solution
Sorry can't help with your request. Could you share the code for the TMO color changing candles? Thanks
Code:
``````input length = 14;
input calcLength = 5;
input smoothLength = 3;

def o = open;
def c = close;
def data = fold i = 0 to length
with s
do s + (if c > getValue(o, i)
then 1
else if c < getValue(o, i)
then - 1
else 0);
def EMA5 = ExpAverage(data, calcLength);
plot Main = ExpAverage(EMA5, smoothLength);
plot Signal = ExpAverage(Main, smoothLength);
Main.AssignValueColor(if Main > Signal
then color.CYAN
else color.red);
Signal.AssignValueColor(if Main > Signal...``````
My candles are colored to match the TMO lower study that shares space with the RSILG. Is there a way to keep the TMO candle color scheme but add a condition that colors the candles yellow/blue when the RSILG and TMO overlap at there critical limits?
im new so maybe the question is confusing so maybe the picture helps illustrate...

Any help is very much appreciated!
Sorry can't help with your request. Could you share the code for the TMO color changing candles? Thanks

Sorry can't help with your request. Could you share the code for the TMO color changing candles? Thanks
Code:
``````input length = 14;
input calcLength = 5;
input smoothLength = 3;

def o = open;
def c = close;
def data = fold i = 0 to length
with s
do s + (if c > getValue(o, i)
then 1
else if c < getValue(o, i)
then - 1
else 0);
def EMA5 = ExpAverage(data, calcLength);
plot Main = ExpAverage(EMA5, smoothLength);
plot Signal = ExpAverage(Main, smoothLength);
Main.AssignValueColor(if Main > Signal
then color.CYAN
else color.red);
Signal.AssignValueColor(if Main > Signal
then color.CYAN
else color.red);
Signal.HideBubble();
Signal.HideTitle();
plot zero = if isNaN(c) then double.nan else 0;
zero.SetDefaultColor(Color.gray);
zero.hideBubble();
zero.hideTitle();
plot ob = if isNaN(c) then double.nan else round(length * .7);
ob.SetDefaultColor(Color.gray);
ob.HideBubble();
ob.HideTitle();
plot os = if isNaN(c) then double.nan else -round(length * .7);
os.SetDefaultColor(Color.gray);
os.HideBubble();
os.HideTitle();
assignpriceColor(if MAIN > SIGNAL then color.CYAN else color.current);
assignpriceColor(if MAIN < SIGNAL then color.RED else color.current);

# End Code TMO``````

I am trying to change the candlesticks color when the TMO changes from red to green or other way around. Is it possible to do this? I have seen it with other indicators and it helps by making the chart cleaner with less indicators. Here's the code:

# TMO ((T)rue (M)omentum (O)scilator)
# Mobius
# V01.05.2018
# hint: TMO calculates momentum using the delta of price. Giving a much better picture of trend, tend reversals and divergence than momentum oscillators using price.

declare Lower;

input length = 14;
input calcLength = 5;
input smoothLength = 3;

def o = open;
def c = close;
def data = fold i = 0 to length
with s
do s + (if c > getValue(o, i)
then 1
else if c < getValue(o, i)
then - 1
else 0);
def EMA5 = ExpAverage(data, calcLength);
plot Main = ExpAverage(EMA5, smoothLength);
plot Signal = ExpAverage(Main, smoothLength);
Main.AssignValueColor(if Main > Signal
then color.green
else color.red);
Signal.AssignValueColor(if Main > Signal
then color.green
else color.red);
Signal.HideBubble();
Signal.HideTitle();
plot zero = if isNaN(c) then double.nan else 0;
zero.SetDefaultColor(Color.gray);
zero.hideBubble();
zero.hideTitle();
plot ob = if isNaN(c) then double.nan else round(length * .7);
ob.SetDefaultColor(Color.gray);
ob.HideBubble();
ob.HideTitle();
plot os = if isNaN(c) then double.nan else -round(length * .7);
os.SetDefaultColor(Color.gray);
os.HideBubble();
os.HideTitle();
# End Code TMO

87k+ Posts
358 Online

## The Market Trading Game Changer

Join 2,500+ subscribers inside the useThinkScript VIP Membership Club
• Exclusive indicators
• Proven strategies & setups
• Private Discord community
• Exclusive members-only content
• 1 full year of unlimited support

What is useThinkScript?

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.

How do I get started?

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.

What are the benefits of VIP Membership?