I have below the code for a custom indicator. This indicator will mark the previous day close so you can easily see the red/green line. Towards the bottom of the code there is lines starting with #. If you delete just the # on each line then you will also have an indicator for yesterdays highs and lows. Hope this helps someone.
If you are wondering how to implement this just right click and press edit studies then click create and copy and paste the code there.
# Previous High, Low, Close
declare hide_on_daily;
declare upper;
def Today = if GetLastDay() ==GetDay() then 1 else 0;
def DrawHighs = if close < high(period="day" ) [1] AND close > low(period="day" ) [1] OR high(period="day" ) > high(period="day" ) [1] then 1 else 0;
def DrawLows = if close < high(period="day" ) [1] AND close > low(period="day" ) [1] OR low(period="day" ) > low(period="day" ) [1] then 1 else 0;
plot yClose = if Today then close(period = "day" ) [1] else Double.NaN;
yClose.SetDefaultColor(Color.LIGHT_GRAY);
yClose.SetLineWeight(1);
yClose.SetStyle(Curve.MEDIUM_DASH);
#plot yhi = if Today then high(period = "day")[1] else Double.NaN;
#yhi.SetDefaultColor(Color.CYAN);
#yhi.SetLineWeight(2);
#plot ylo = if Today then low(period = "day")[1] else #Double.NaN;
#yhi.SetDefaultColor(Color.PINK);
#yhi.SetLineWeight(2);
Thank you!
very helpful!
Join now or log in to leave a comment