WL column first two 5min bars VWAP reject


Hi Pete,

I’m trying to build a custom WL column that will show me a 1 shaded in green (for the whole trading day) when a couple of conditions are met during the first two 5 minute bars.

1) First 5min bar closes red and below vwap
2) Second 5min bar closes green and above vwap. As a result of the second bar being green the close would therefore be greater than the close of bar 1.

I tried working with a script you had posted with respect to determining an uptrend bias within the WL column forum but not been successful so far. Have attached what I came up with in a *.txt file.

Thanks so much for your help and this excellent forum.

Marked as spam
Posted by (Questions: 1, Answers: 1)
Asked on September 30, 2021 6:49 am
Private answer

I see your attempted solution includes the opposite direction as well as the direction you included in your example. Rather than try to repair the code you provided I built my own from scratch. You should be able to work out the other direction by examining how my solution works:

def newDay = GetDay() <> GetDay()[1];
def vwapValue = reference VWAP().VWAP;
rec firstBarRed = if newDay and close < open and close < vwapValue then 1 else firstBarRed[1]; rec secondBarGreen = if newDay then 0 else if newDay[1] and firstBarRed[1] and close > vwapValue and close > open and close > close[1] then 1 else secondBarGreen[1];
plot data = secondBarGreen;
AssignBackgroundColor(if data > 0 then Color.GREEN else Color.CURRENT);

That's all I can provide in this forum. I have clients who have paid for similar solutions as you requested and out of respect for them I cannot give this away free of charge.

Marked as spam
Posted by (Questions: 39, Answers: 3752)
Answered on September 30, 2021 8:29 am