#// This source code is subject to the terms of the Mozilla Public License 2.0 at
#// © Crinklebine
#// Candle State Pine Script
#study("Candle State (The Strat)", overlay=true, precision=0)
#// check for candle state up (high greater previous candle high) and plot an identifier
def barResult1 = high > high[1];
plot BarUp = if barResult1 then close else Double.NaN;#, title="Bar State Up Label", style=shape.triangleup, location=location.abovebar, color=color.green)
BarUp.SetPaintingStrategy(PaintingStrategy.BOOLEAN_WEDGE_DOWN);
BarUp.SetDefaultColor(Color.GREEN);
#// check for candle state down (low less than previous candle low) and plot an identifier
def barResult2 = low < low[1];
plot BarDn = if barResult2 then close else Double.NaN;#, title="Bar State Down Label", style=shape.triangledown, location=location.abovebar, color=color.red)
BarDn.SetPaintingStrategy(PaintingStrategy.BOOLEAN_WEDGE_UP);
BarDn.SetDefaultColor(Color.RED);