How to color Entry/Stop line under candle sticks?

haselec

New member
I have colored candles chart based on TTM-Squeeze but I want the Stop/entry bars under each candle colored instead and the candles have the traditional Green/Red colors. Can someone please help me making this change to my chart?
3TkzIcH.jpg


I have the existing colored candle script here:
input price = CLOSE;
input length = 20;
input nK = 1.5;
input nBB = 2.0;
input alertLine = 1.0;
def squeezeHistogram = TTM_Squeeze(price, length, nK, nBB, alertLine).Histogram;
plot hist = if squeezeHistogram >= 0 then
if squeezeHistogram > squeezeHistogram[1] then 2 else 1
else if squeezeHistogram < squeezeHistogram[1] then -2 else -1;
AssignPriceColor(if squeezeHistogram >= 0 then
if squeezeHistogram > squeezeHistogram[1] then Color.CYAN else Color.BLUE
else if squeezeHistogram < squeezeHistogram[1] then Color.RED else Color.YELLOW);
hist.AssignValueColor(if squeezeHistogram >= 0 then
if squeezeHistogram > squeezeHistogram[1] then Color.CYAN else Color.BLUE
else if squeezeHistogram < squeezeHistogram[1] then Color.RED else Color.YELLOW);

And the Stop/Entry bars script here:
plot x = Lowest(low, 5);
plot y = Lowest(high, 5);

I don't have the skills to stir them together to get what I want :(

Thanks all
 
with the try and error method, I got it to work 🥳🥳🥳
KTTgv07.jpg


here's the code if someone interested:
input price = CLOSE;
input length = 20;
input nK = 1.5;
input nBB = 2.0;
input alertLine = 1.0;
def squeezeHistogram = TTM_Squeeze(price, length, nK, nBB, alertLine).Histogram;
plot hist = Lowest(low, 5);
hist.AssignValueColor(if squeezeHistogram >= 0 then
if squeezeHistogram > squeezeHistogram[1] then Color.CYAN else Color.BLUE
else if squeezeHistogram < squeezeHistogram[1] then Color.RED else Color.YELLOW);
 

Join useThinkScript to post your question to a community of 21,000+ developers and traders.

i had to read your post several times, it doesn't make sense to me.

i think you want the yellow dashed lines to have ttm colors?
here is what i think you want

Ruby:
# stoplinecolor_01

input price = CLOSE;
input length = 20;
input nK = 1.5;
input nBB = 2.0;
input alertLine = 1.0;

def squeezeHistogram = TTM_Squeeze(price, length, nK, nBB, alertLine).Histogram;

#And the Stop/Entry bars script here:
plot x = Lowest(low, 5);
plot y = Lowest(high, 5);

x.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
y.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);

x.AssignValueColor(if squeezeHistogram >= 0 then if squeezeHistogram > squeezeHistogram[1] then Color.CYAN else Color.BLUE else if squeezeHistogram < squeezeHistogram[1] then Color.RED else Color.YELLOW);
y.AssignValueColor(if squeezeHistogram >= 0 then if squeezeHistogram > squeezeHistogram[1] then Color.CYAN else Color.BLUE else if squeezeHistogram < squeezeHistogram[1] then Color.RED else Color.YELLOW);

x.setlineweight(4);
y.setlineweight(4);
#


jToflBk.jpg
 
with the try and error method, I got it to work 🥳🥳🥳
KTTgv07.jpg


here's the code if someone interested:
input price = CLOSE;
input length = 20;
input nK = 1.5;
input nBB = 2.0;
input alertLine = 1.0;
def squeezeHistogram = TTM_Squeeze(price, length, nK, nBB, alertLine).Histogram;
plot hist = Lowest(low, 5);
hist.AssignValueColor(if squeezeHistogram >= 0 then
if squeezeHistogram > squeezeHistogram[1] then Color.CYAN else Color.BLUE
else if squeezeHistogram < squeezeHistogram[1] then Color.RED else Color.YELLOW);

your code draws a line by default. what are you changing to make the line appear as dashes?
 
i had to read your post several times, it doesn't make sense to me.

i think you want the yellow dashed lines to have ttm colors?
here is what i think you want

Ruby:
# stoplinecolor_01

input price = CLOSE;
input length = 20;
input nK = 1.5;
input nBB = 2.0;
input alertLine = 1.0;

def squeezeHistogram = TTM_Squeeze(price, length, nK, nBB, alertLine).Histogram;

#And the Stop/Entry bars script here:
plot x = Lowest(low, 5);
plot y = Lowest(high, 5);

x.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
y.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);

x.AssignValueColor(if squeezeHistogram >= 0 then if squeezeHistogram > squeezeHistogram[1] then Color.CYAN else Color.BLUE else if squeezeHistogram < squeezeHistogram[1] then Color.RED else Color.YELLOW);
y.AssignValueColor(if squeezeHistogram >= 0 then if squeezeHistogram > squeezeHistogram[1] then Color.CYAN else Color.BLUE else if squeezeHistogram < squeezeHistogram[1] then Color.RED else Color.YELLOW);

x.setlineweight(4);
y.setlineweight(4);
#


jToflBk.jpg

your code draws a line by default. what are you changing to make the line appear as dashes?
Thanks for taking the time to do this, I got to the cogwheel and change the line to dashes from the drop-down menu.
 
Thanks for taking the time to do this, I got to the cogwheel and change the line to dashes from the drop-down menu.
thanks and grats on making the code/settings do what you want.

it took me a few tries to find the setting you were talking about, as i never alter the look of a plot this way, i change the code.
i was changing the style from solid to dashed, but that didn't match your chart.
then i tried 'draw as' from poly line to a set of small dashes.

i will alter my code, and add a line to draw as dashes, and repost
 
@halcyonguy The issue with changing the code is that if you were to use multiple implementations on different charts, or multiple iterations of the same study on the same chart, they would all be forced to use the same settings... How would that work with displaying multiple MA's...??? The Study Settings are there so you can customize for each implementation while still retaining the defaults, or to experiment with settings without the need to dive into the script code itself...
 
@halcyonguy The issue with changing the code is that if you were to use multiple implementations on different charts, or multiple iterations of the same study on the same chart, they would all be forced to use the same settings... How would that work with displaying multiple MA's...??? The Study Settings are there so you can customize for each implementation while still retaining the defaults, or to experiment with settings without the need to dive into the script code itself...
that makes sense, to load multiples with different settings. i never do that , so i am probably the anomaly. i'm too old and set in my ways , heh.
 
Thanks for taking the time to do this, I got to the cogwheel and change the line to dashes from the drop-down menu.
thanks for mentioning your settings method, i learned something.

if anyone is interested, here is a study that produces his desired lines, and some notes at the end.

Code:
# stoplinecolor_02

# pic showed yellow dashed horz line under candles. not a wavering line

input price = CLOSE;
input length = 20;
input nK = 1.5;
input nBB = 2.0;
input alertLine = 1.0;

def squeezeHistogram = TTM_Squeeze(price, length, nK, nBB, alertLine).Histogram;

#And the Stop/Entry bars script here:
plot x = Lowest(low, 5);
x.AssignValueColor(if squeezeHistogram >= 0 then if squeezeHistogram > squeezeHistogram[1] then Color.CYAN else Color.BLUE else if squeezeHistogram < squeezeHistogram[1] then Color.RED else Color.YELLOW);
#x.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
x.SetPaintingStrategy(PaintingStrategy.dashes);
x.setlineweight(4);

plot y = Lowest(high, 5);
y.AssignValueColor(if squeezeHistogram >= 0 then if squeezeHistogram > squeezeHistogram[1] then Color.CYAN else Color.BLUE else if squeezeHistogram < squeezeHistogram[1] then Color.RED else Color.YELLOW);
#y.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
y.SetPaintingStrategy(PaintingStrategy.dashes);
y.setlineweight(4);
#

# these 2 are similar,
#x.SetPaintingStrategy(PaintingStrategy.dashes);
#  edit studies > settings > plots > draw as > short dashes

# these 2 are similar,
#  curve-MEDIUM_DASH -
#  edit studies > settings > plots > style

#
 

Similar threads

Not the exact question you're looking for?

Start a new thread and receive assistance from our community.

87k+ Posts
479 Online
Create Post

Similar threads

Similar threads

The Market Trading Game Changer

Join 2,500+ subscribers inside the useThinkScript VIP Membership Club
  • Exclusive indicators
  • Proven strategies & setups
  • Private Discord community
  • ‘Buy The Dip’ signal alerts
  • Exclusive members-only content
  • Add-ons and resources
  • 1 full year of unlimited support

Frequently Asked Questions

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?
VIP members get exclusive access to these proven and tested premium indicators: Buy the Dip, Advanced Market Moves 2.0, Take Profit, and Volatility Trading Range. In addition, VIP members get access to over 50 VIP-only custom indicators, add-ons, and strategies, private VIP-only forums, private Discord channel to discuss trades and strategies in real-time, customer support, trade alerts, and much more. Learn all about VIP membership here.
How can I access the premium indicators?
To access the premium indicators, which are plug and play ready, sign up for VIP membership here.
Back
Top