Hey folks, Need help with a simple code to only show the horizontal lines for inside and outside bars when they are present, not any other scenario. Below is the code I've put together which does show them, but it also plots the regular highs and lows from the 30min time frame
Thanks for the help
###
input aggregationPeriod = AggregationPeriod.thirty_MIN;
input length = 1;
plot DH= Highest(high(period = aggregationPeriod), length) ;
plot DL= Lowest(low(period = aggregationPeriod), length);
plot DH1= Highest(high(period = aggregationPeriod), length) ;
plot DL1= Lowest(low(period = aggregationPeriod), length);
def insidebar = DH<DH[1] and DL>DL[1] ;
def outsidebar = DH>DH[1] and DL<DL[1] ;
addlabel(yes, if insidebar[1] then " inside 30 " else if outsidebar[1] then " outside 30 " else " " , if insidebar[1] then color.dark_orange else if outsidebar[1] then color.dark_orange else color.light_gray);
DH.assignValueColor(if insidebar then color.magenta else color.white);
DL.assignValueColor(if insidebar then color.magenta else color.white);
DH1.assignValueColor(if outsidebar then color.blue else color.white);
DL1.assignValueColor(if outsidebar then color.blue else color.white);
Thanks for the help
###
input aggregationPeriod = AggregationPeriod.thirty_MIN;
input length = 1;
plot DH= Highest(high(period = aggregationPeriod), length) ;
plot DL= Lowest(low(period = aggregationPeriod), length);
plot DH1= Highest(high(period = aggregationPeriod), length) ;
plot DL1= Lowest(low(period = aggregationPeriod), length);
def insidebar = DH<DH[1] and DL>DL[1] ;
def outsidebar = DH>DH[1] and DL<DL[1] ;
addlabel(yes, if insidebar[1] then " inside 30 " else if outsidebar[1] then " outside 30 " else " " , if insidebar[1] then color.dark_orange else if outsidebar[1] then color.dark_orange else color.light_gray);
DH.assignValueColor(if insidebar then color.magenta else color.white);
DL.assignValueColor(if insidebar then color.magenta else color.white);
DH1.assignValueColor(if outsidebar then color.blue else color.white);
DL1.assignValueColor(if outsidebar then color.blue else color.white);