Mr D
New member
Displays previous two bars with trend strength marks.
Ruby:
###########################################################################
# StratBar WL Column Pre Market #
# Displays previous two stratbars with direction and trend strength marks #
###########################################################################
script stratBar1 {
# Generation time: 2021-07-03T01:59:10.800428800Z
def IsUp = close > open;
def IsDown = close < open;
plot PatternPlot =
((Sum(IsUp, 1)[1] >= 0)) and
((Sum(IsUp, 1)[0] >= 0)) and
Highest(high[1], 1) >= Highest(high[0], 1) and
Lowest(low[1], 1) <= Lowest(low[0], 1);
}
script stratbar2d {
# Generation time: 2021-07-03T02:29:53.784750700Z
def IsUp = close > open;
def IsDown = close < open;
plot PatternPlot =
((Sum(IsUp, 1)[1] >= 0)) and
((Sum(IsUp, 1)[0] >= 0)) and
Highest(high[1], 1) >= Highest(high[0], 1) and
Lowest(low[1], 1) > Lowest(low[0], 1);
}
script stratbar2u {
# Generation time: 2021-07-03T02:30:15.393547900Z
def IsUp = close > open;
def IsDown = close < open;
plot PatternPlot =
((Sum(IsUp, 1)[1] >= 0)) and
((Sum(IsUp, 1)[0] >= 0)) and
Lowest(low[1], 1) <= Lowest(low[0], 1) and
Highest(high[1], 1) < Highest(high[0], 1);
}
def top = low + 0.764*(high-low);
def bot = low + 0.234*(high-low);
addlabel(yes,concat(if stratBar1()[0] then "1"
else if stratbar1()[1] then if stratbar2u()[0] then "12u" else if stratbar2d()[0] then "12d" else "13"
else if stratbar2u()[1] then if stratbar2u()[0] then "2u2u" else if stratbar2d()[0] then "2u2d" else "2u3"
else if stratbar2d()[1] then if stratbar2u()[0] then "2d2u" else if stratbar2d()[0] then "2d2d" else "2d3"
else if stratbar2u()[0] then "32u" else if stratbar2d()[0] then "32d" else "33" ,
if close[0]>top[0] then "++" else if close[0]<bot[0] then "--" else if close[0]>open[0] then "+" else if close[0]<open[0] then "-" else " "));
assignBackgroundColor(if close[0]<bot[0] then color.dark_red else if close[0]>top[0] then color.dark_green else color.black);
#######
# END #
#######
Last edited: