TradingView
Daveatt
19 dec 2019 16:22

BEST Multicolor Supertrend InfoPanel 

Bitcoin / U.S. dollarBitstamp

Beskrivning

Hello traders

Today is a Pinescript hack to display multiple colors in one label.
I used that panel to show the Supertrend Long Term values (weekly, monthly, quarterly, yearly)

What is a Supertrend?

Definition: SuperTrend is an indicator that works on all timeframes and all instruments (stocks, futures, forex, ...). It is a great tool to follow market trends and optimizes your profits.
SuperTrend evolves below or above the prices depending on the trend. You can use it as an exit position indicator when its direction changes. You can also use it to place your stops.

So.... the hack is?

The hack is about creating a new label for each line - versus creating just one label containing the whole text

Best regards,
Dave
Kommentarer
Captain_Walker
Wicked piece of coding.

I couldn't get it to show the blue, green, purple and red lines like on your chart. I copied the scrip as is and pasted it into pinescript. The code was validated - so no problems there. I can't figure why I'm not seeing the lines on your chart that it's meant to draw. I'm getting the panel showing ok.

Can you advise.
Daveatt
@Captain_Walker, Hello My Captain
That's normal because this script isn't displaying those supertrends
You can add them using this indicator for example
tradingview.com/script/Q5PIyzOi-Supertrend-collector/
Basav2020
hello captain sir,
great indicator...
i want to show this label to the right side of the panel or top or bottom of the screen. is there a way to show please let me know sir.

many thanks.
Daveatt
@Basav2020, for that you'll need to play with the variable called lapos_x in the script
by default it's lapos_x = timenow + round(change(time)*50)
if you change 50 by 100 it will be more to the right. 150 even more to the right again

2/for vertical alignment, it's the variable called lapos_y
by default, it sets the panel to the latest close level

If you the label to be more to the top you can do lapos_y = close * 1.02
This will put the label 2% more to the top

lapos_y = close * 0,98 will set the label 2% more the the bottom

Now it's up to you to figure out the values you need :)
Daveatt
@Basav2020, lines 72-73 from that code basically
Basav2020
@Daveatt,
sir, thank u so much...one more quick question, how do you add daily, previous day, next day and last week high/low...i am currently thinking to include in my central pivot range(CPR)...that would be a great help..sir..
Daveatt
@Basav2020, ok giving one example using pinescript V4
previous day high = security(syminfo.tickerid, 'D', high[1])

PS:
next day is obviously impossible because unknown. We cannot forsee the futur yet, maybe soon.... who knows.
Basav2020
@Daveatt,
sir, i am new to coding..i see some of the great persons using CPR., its purely based on pricing...and the results are great...next day cpr is calculated by the formula..of todays high and low i guess...i am also trying to find it..if i get it...i will definately share with you...
how to enlarge and include more information in the label? thank you so much once again...
Mohamed3nan
Thank you, but the values is changing if you try to change chart timeframe!
Daveatt
@Mohamed3nan, the chart timeframe should be lower or equal to the lowest timeframe among the 4 Supertrend timeframes. Otherwise, the security (multi timeframes) calls won't work
Mer