Thursday, September 8, 2016

Here is a script for having the range as a label for an intraday label.


Code:

input end = 1600;
def active = if secondsFromTime(start) == 0 then 1 else 0;
def h = high;
def hh = if active && h then h else if h > hh[1] then h else hh[1];
def l = low;
def ll = if active && l then l else if l < ll[1] then l else ll[1];
plot RTH_High = hh;
RTH_High.hide();
plot RTH_Low = ll;
RTH_Low.hide();
RTH_High.setpaintingStrategy(paintingStrategy.ARROW_DOWN);
RTH_Low.setPaintingStrategy(paintingStrategy.ARROW_UP);

addlabel(1,"Range = " + (hh - ll)+ "; " + "Range% = " + Round(100*(hh - ll)/open,2) +"%",color.white);

1 comments:

Bear Raid said...

In this line of script (def active = if secondsFromTime(start) == 0 then 1 else 0;) I had to change (start) to 0930 to get it to work. Thanks for the code looks like it's working now.