Page 2 of 2

Re: Sunrise & Sunset

Posted: Sat Jun 09, 2018 6:25 pm
by David
sbank,

I add some inputs for your tool, plot modifiers. additional the tool will plot the longitude both helio/geo on your chart. The text object is pinned to the chart low to use inputs txtupdown which will add/subtract from the chart low price. txtleftright will allow you to offset the txt object to your liking..

let me know if this works for you

David


input:tlclr(red),txtclr(red),tlsty(ps_solid),txtsty(ps_solid),tlthickness(1),textthickness(8),txtupdown(5),textleftright(5),tropical(true); # this will execute on the very first bar the QScript runs
if (barnumber == barsback) {
clearlog();
str="";
rise_time=0;
rise_bar=0;
pinn=close;
txtref1= text(barnum,1," ",background_color,ps_solid,1);

}

# this block will only trigger at first bar of the day
if (day != day[1])
{
rise_time = astro_riseset(year,month,day,time,40.7056,74.008,astro_sun,astro_rise);
rise_bar = Date_to_Bar(year,month,day,rise_time);
planet_pinn_bar = barnum_to_offset(rise_bar);
sunlong1=astro(year[rise_bar],month[rise_bar],day[rise_bar],time[rise_time],astro_sun,true,astro_long,tropical);
sunlong2=astro(year[rise_bar],month[rise_bar],day[rise_bar],time[rise_time],astro_earth,false,astro_long,tropical);
pinn=close;

}
sunlong1=round(sunlong1,3);
sunlong2=round(sunlong2,3);
str=join(" ",sunlong1 + " " + "Helio",sunlong2 + " " + "Geo");
REF_sunrise=trendline(rise_bar,chart_low,rise_bar,chart_high,to_int(tlclr));
set_tl_style(REF_sunrise,to_int(tlsty));
set_tl_size(REF_sunrise,to_int(tlthickness));
text_reset(txtref1,rise_bar+textleftright,pinn+txtupdown,str,txtclr,txtsty,textthickness);




#str = to_string(round(inches_out,3)) + " " + str1[1];