Hi Team,
My attempt to automatically plot a VWAP everyday which is only during regular trading hours failed multiple times and can not figure out what's missing here.
Could someone be kind enough to take a look and adjust it?
My attempt to automatically plot a VWAP everyday which is only during regular trading hours failed multiple times and can not figure out what's missing here.
Could someone be kind enough to take a look and adjust it?
Code:
input aggregation = AggregationPeriod.DAY;
input anchorTime = 930;
def tradeStartEST = 0930;
def tradeEndEST = 1630;
def inPeriod = if SecondsTillTime(tradeStartEST) <= 0 and SecondsTillTime(tradeEndEST) > 0 then 1 else 0;
plot anchoredVWAP = TotalSum(if aggregation then ((high+low+close)/3)*(volume) else 0)/TotalSum(if aggregation then volume else 0);
anchoredVWAP.setStyle(Curve.Firm);
anchoredVWAP.SetLineWeight(3);
anchoredVWAP.SetDefaultColor(Color.Cyan);
Last edited by a moderator: