stavros

Example using "offset" to get just a horizontal line

MTGOX:BTCUSD   Bitcoin / Dollar
1461 8 6
This shows how to use Pine script to see only a horizontal line on your chart.
This example shows the line at 3% below the last candle's close price.
Can you share the code? seems like the button is no longer there
+1 Reply
stavros vmirage
Sorry, vmirage, but it seems I never stored this in my own charts so I don't have the code myself anymore. :/
I don't remember how I accomplished this now, but I would hope this kind of this is simple in Pine script now; this created when Pine was only a few weeks old.
Reply
Unfortunately it is not easy to do it as there is no way to convert series into a single float value to use in hline. And I can't find any way to do it. It seems like you are the only person who managed convert them. Do you have any other code that does this at all? Isn't the pine script in your library unless you deliberately delete them?
Reply
stavros vmirage
OK, it's no longer 06:00 on a work day so I had time to re-familiarise myself with this site, which I haven't frequented in 2-years.
I found this in one of my saved charts, which will hopefully give you a nudge in the right direction:

study(title = "Stop Loss", shorttitle="Stop")

// show a stop at -3%
stop = close * 0.97

plot(stop, color = red, trackprice=true, offset=-100000)

Hope that helps. :)
Reply
thanks
Reply
So it's because the offset was so high it had no other choice but to plot just that one value as a horizontal line (rather than a series)...
If you want to use this specific value in a calculation however (rather than the whole series of values), you're up a creek at the moment (until they add this functionality)...
Reply
@sn0wcrash The code is available in this chart. Click the "()" button in the "Stop" indicator in the header.
+2 Reply
Mind sharing the code?
Reply
English
English (UK)
English (IN)
Deutsch
Français
Español
Italiano
Polski
Türkçe
Русский
Português
Bahasa Indonesia
Bahasa Melayu
ภาษาไทย
Tiếng Việt
日本語
한국어
简体
台灣
Home Stock Screener Forex Signal Finder Cryptocurrency Signal Finder Economic Calendar How It Works Chart Features House Rules Moderators Website & Broker Solutions Widgets Stock Charting Library Feature Request Blog & News FAQ Help & Wiki Twitter
Profile Profile Settings Account and Billing My Support Tickets Contact Support Ideas Published Followers Following Private Messages Chat Sign Out