stavros

Example using "offset" to get just a horizontal line

MTGOX:BTCUSD   Bitcoin / U.S. Dollar
2915 views
6
2915 8
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
vmirage stavros
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
vmirage stavros
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.
+7 Reply
Mind sharing the code?
Reply
EN English
EN English (UK)
EN English (IN)
DE Deutsch
FR Français
ES Español
IT Italiano
PL Polski
SV Svenska
TR Türkçe
RU Русский
PT Português
ID Bahasa Indonesia
MS Bahasa Melayu
TH ภาษาไทย
VI Tiếng Việt
JA 日本語
KO 한국어
ZH 简体中文
ZH 繁體中文
AR العربية
HE עברית
Home Stock Screener Forex Screener Crypto Screener 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