I'm trying to code the hl or lh of the quarterly high and quarterly low candle. Unfortunately, I have no success. Any assistance would be greatly appreciated. Thanks.
Code:
def month = getMonth();
def QtrStart = month[1] % 3 == 0 and month % 3 != 0;
def lstBar = if QtrStart
then barNumber()
else lstBar[1];
def fstBar = if QtrStart
then lstBar[1]
else fstBar[1];
def hh = if barNumber() == HighestAll(fstBar)
then high
else if between(barNumber(), highestAll(fstBar), highestAll(lstBar))
then Max(high, hh[1])
else hh[1];
plot hh_ = if barNumber() >= highestAll(fstBar)
then highestAll(if isNaN(close[-1])
then hh
else double.nan)
else double.nan;
def ll = if barNumber() == HighestAll(fstBar)
then low
else if between(barNumber(), highestAll(fstBar), highestAll(lstBar))
then Min(low, ll[1])
else ll[1];
plot ll_ = if barNumber() >= highestAll(fstBar)
then highestAll(if isNaN(close[-1])
then ll
else double.nan)
else double.nan;
ll_.SetStyle(Curve.firm);
ll_.SetLineWeight(1);
ll_.SetDefaultColor(color.dark_ORANGE);
hh_.SetStyle(Curve.firm);
hh_.SetLineWeight(1);
hh_.SetDefaultColor(color.dark_ORANGE);
# End Code