@MLlalala
Ruby:
input anchorDate = 20200422;
input anchorTime = 0930;
input Units = 25;
input UnitSize = 100000;
def tradeStartEST = 0930;
def tradeEndEST = 1600;
def inPeriod = if SecondsFromTime(tradeStartEST) >= 0 and SecondsTillTime(tradeEndEST) >= 0 then 1 else 0;
#These are doing nothing, not sure what they are supposed to do.
#def revisedDate = if SecondsTillTime(anchorTime) <= 0 and !inPeriod then anchorDate + 1 else if SecondsTillTime(anchorTime) <= 0 and inPeriod then anchorDate else anchorDate;
#def postAnchorDate = if GetYYYYMMDD() >= revisedDate then 1 else 0;
#def postAnchorTime = if SecondsTillTime(anchorTime) <= 0 then 1 else 0;
def Vol = if !SecondsFromTime(tradeStartEST) then volume else Vol[1] + volume;
#Chart bubbles to visualize.
#addchartbubble(yes,high,vol,if vol < Units * UnitSize then color.white else color.gray,yes);
#addchartbubble(yes,high,Units * UnitSize,color.white,yes);
plot Cross = if inPeriod and Crosses(Vol, Units * UnitSize, CrossingDirection.ABOVE) then low else Double.NAN;
cross.setpaintingStrategy(paintingStrategy.ARROW_UP);
Thank you, i have modified a little to make it more flexible based on your work:
input anchorDate = 20200422;
input anchorTime = 0930;
input Units = 25;
input UnitSize = 100000;
input n=5;
def tradeStartEST = 0930;
def tradeEndEST = 1600;
def inPeriod = if SecondsFromTime(tradeStartEST) >= 0 and SecondsTillTime(tradeEndEST) >= 0 then 1 else 0;
#These are doing nothing, not sure what they are supposed to do.
#def revisedDate = if SecondsTillTime(anchorTime) <= 0 and !inPeriod then anchorDate + 1 else if SecondsTillTime(anchorTime) <= 0 and inPeriod then anchorDate else anchorDate;
#def postAnchorDate = if GetYYYYMMDD() >= revisedDate then 1 else 0;
#def postAnchorTime = if SecondsTillTime(anchorTime) <= 0 then 1 else 0;
def Vol = if !SecondsFromTime(tradeStartEST) then volume else Vol[1] + volume;
#Chart bubbles to visualize.
#addchartbubble(yes,high,vol,if vol < Units * UnitSize then color.white else color.gray,yes);
#addchartbubble(yes,high,Units * UnitSize,color.white,yes);
plot Cross = if inPeriod and n>=1 and Crosses(Vol, Units * UnitSize, CrossingDirection.ABOVE) then low else Double.NAN;
cross.setpaintingStrategy(paintingStrategy.ARROW_UP);
plot Cross1 = if inPeriod and n>=2 and Crosses(Vol, 2*Units * UnitSize, CrossingDirection.ABOVE) then low else Double.NAN;
cross.setpaintingStrategy(paintingStrategy.ARROW_UP);
plot Cross2 = if inPeriod and n>=3 and Crosses(Vol, 3*Units * UnitSize, CrossingDirection.ABOVE) then low else Double.NAN;
cross.setpaintingStrategy(paintingStrategy.ARROW_UP);
plot Cross3 = if inPeriod and n>=4 and Crosses(Vol, 4*Units * UnitSize, CrossingDirection.ABOVE) then low else Double.NAN;
cross.setpaintingStrategy(paintingStrategy.ARROW_UP);
plot Cross4 = if inPeriod and n>=5 and Crosses(Vol, 5*Units * UnitSize, CrossingDirection.ABOVE) then low else Double.NAN;
cross.setpaintingStrategy(paintingStrategy.ARROW_UP);
This seems to work on intraday chart, however, when plotted on daily chart, it has problems. Let's say i plot it on QQQ, the anchor day is 11/22/2021, the arrows will show before this date which should NOT be allowed, the script is desgined to show ONLY the equivolume cycles after the anchor date. I have no idea why this happens