stavros

Example using "offset" to get just a horizontal line

MTGOX:BTCUSD   Bitcoin / U.S. Dollar
801 8 5
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.
+1 Reply
Mind sharing the code?
Reply
United States
United Kingdom
India
Deutschland
España
France
Italia
Polska
Brasil
Россия
Türkiye
Indonesia
Malaysia
日本
한국
Home Stock Screener Forex Signal Finder Economic Calendar How It Works Chart Features House Rules Moderators For the WEB Widgets Stock Charting Library Priority Support Feature Request Blog & News FAQ Help & Wiki Twitter
Profile Profile Settings Account and Billing Priority Support Ideas Published Followers Following Private Messages Chat Sign Out