How to draw a horizontal line that its distance from the upper bound stay constant in 1min/1day timeframe

nothingness99

New member
Hi,

I am trying to draw a horizontal line on the UPPER chart that will use as the buy/sell signal (the color code of each square dot is coordinated with each bar's price action). How can I code this for my upper study? Thanks

Sorry I did not make it clear. Okie, I want to line up the squares (paintingstrategy.squares) horizontally like the picture below. The squares line will be nearby the labels and stay there throughout the 1min/1day time frame. I can archive this in the lower study as the picture. However, I could not do that in the study for the upper chart. The upper bound is just the top chart area. The logic for the color of each square, I already have in my code. I just want to bring this square line to the upper chart but I don't know how to make that line stay fixed (regardless of the high, close). Thank you

 

halcyonguy

Well-known member
VIP
Lifetime
Hi,

I am trying to draw a horizontal line on the UPPER chart that will use as the buy/sell signal (the color code of each square dot is coordinated with each bar's price action). How can I code this for my upper study? Thanks

sorry, i have no idea what you are asking for.

1. what defines an upper bound?
2. what defines a buy/sell signal?
3. what is a , color code of each square dot?
4. what defines, coordinated with each bar's price action?

try to describe some rules , by telling us what happens to close, high, low,...
 

halcyonguy

Well-known member
VIP
Lifetime
Sorry I did not make it clear. Okie, I want to line up the squares (paintingstrategy.squares) horizontally like the picture below. The squares line will be nearby the labels and stay there throughout the 1min/1day time frame. I can archive this in the lower study as the picture. However, I could not do that in the study for the upper chart. The upper bound is just the top chart area. The logic for the color of each square, I already have in my code. I just want to bring this square line to the upper chart but I don't know how to make that line stay fixed (regardless of the high, close). Thank you

that helps me understand.

you could use this,
def y = highestall(high);
to create the variable y, filled with the highestest price on the chart. if plotted, it would be a horizontal line.

then use y in the plot formula for the squares.
plot z = y * 1.01;
z.paintingstrategy(.. squares..)
z.AssignValueColor(
if cond1 then color yellow
else if cond2 then color.magenta
else color.gray);

or use something like this, to generate the reference level, without being complex.
https://usethinkscript.com/threads/current-price-line-indicator-for-thinkorswim.8793/#post-95027

https://tlc.thinkorswim.com/center/reference/thinkScript/Functions/Look---Feel/AssignValueColor
 

nothingness99

New member
Thank you halcyonguy for the tips. I tried both methods but it seems the line shifting around when I zoom in on the chart. I found this code to plot the line on the bottom of the chart instead (and the line won't shift if I zoom in ). But I have to rewrite the code for the lower study and drag it up to the upper chart. Thanks again for your help. I really appreciate it.
 

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.
Top