I've been trying to get a working watchlist scan to paint red when close is below poc and green when close is above. Can someone help me out please?
Ruby:
# Volume Profile Opening Range Strategy
# Mobius
# V01.2021
def TS = TickSize();
def t = getTime() crosses RegularTradingStart(getYYYYMMDD())
or
getTime() crosses above RegularTradingStart(getYYYYMMDD()) +
aggregationPeriod.day;
profile vol = VolumeProfile(getSymbol(), TS, t, 0, 4, 68);
def pc = if IsNaN(vol.GetPointOfControl())
then pc[1]
else vol.GetPointOfControl();
def hVA = if IsNaN(vol.GetHighestValueArea())
then hVA[1]
else vol.GetHighestValueArea();
def lVA = if IsNaN(vol.GetLowestValueArea())
then lVA[1]
else vol.GetLowestValueArea();
def hProfile = if IsNaN(vol.GetHighest())
then hProfile[1]
else vol.GetHighest();
def lProfile = if IsNaN(vol.GetLowest())
then lProfile[1]
else vol.GetLowest();
plot hline = hprofile;
hline.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
hline.SetDefaultColor(Color.Yellow);
plot lline = lprofile;
lline.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
lline.SetDefaultColor(Color.Yellow);
plot POC = Round(pc / TS, 0) * TS;
POC.SetDefaultColor(Color.Red);
POC.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
#plot VAHigh = Round(hVA / TS, 0) * TS;
# VAHigh.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
# VAHigh.SetDefaultColor(Color.Yellow);
#plot VALow = Round(lVA / TS, 0) * TS;
# VALow.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
# VALow.SetDefaultColor(Color.Yellow);
#vol.Show(Color.CYAN, color.gray, Color.Cyan, 15);
def bubble = isNaN(close[1]) and !isNaN(close[2]);
#AddChartBubble(bubble, VAHigh[3], "VAH", color = Color.YELLOW, yes);
#AddChartBubble(bubble, VALow[3], "VAL", Color.YELLOW, no);
#AddChartBubble(bubble, POC[3], "POC", Color.RED, no);
# End Code Volume Profile RTH and GlobeX
Last edited by a moderator: