Volume Profile Since Event

Robby Luca

New member
I would like to script Volume Profile that begins on earnings date and ends on the start of the next earnings. I would like it to automatically show the volume profile within those periods and not have to manually enter each date. Maybe the image is more clear than my explanation. Does anyone have any idea on how to do this? Thanks.
 

Robby Luca

New member
I randomly got it to work. Not sure if I'll get any problems in the future, but it's working at the moment.
Code:
input pricePerRowHeightMode = {AUTOMATIC, default TICKSIZE, CUSTOM};
input customRowHeight = 1.0;
input multiplier = 1;
input onExpansion = no;
input earnings = 4;
input showPointOfControl = no;
input showValueArea = no;
input valueAreaPercent = 70;
input opacity = 50;

def HasEarnings = HasEarnings();
def period = If(BarNumber() > 1, period[1] + HasEarnings, HasEarnings);

def count = CompoundValue(1, if period != period[1] then (count[1] + period - period[1]) % multiplier else count[1], 0);
def cond = count < count[1] + period - period[1];
def height;
switch (pricePerRowHeightMode) {
case AUTOMATIC:
    height = PricePerRow.AUTOMATIC;
case TICKSIZE:
    height = PricePerRow.TICKSIZE;
case CUSTOM:
    height = customRowHeight;
}

profile vol = volumeProfile("startNewProfile" = cond, "onExpansion" = onExpansion, "numberOfProfiles" = earnings, "pricePerRow" = height, "value area percent" = valueAreaPercent);
def con = compoundValue(1, onExpansion, no)[-1];
def pc = if IsNaN(vol.getPointOfControl()) and con then pc[1] else vol.getPointOfControl();
def hVA = if IsNaN(vol.getHighestValueArea()) and con then hVA[1] else vol.getHighestValueArea();
def lVA = if IsNaN(vol.getLowestValueArea()) and con then lVA[1] else vol.getLowestValueArea();

def hProfile = if IsNaN(vol.getHighest()) and con then hProfile[1] else vol.getHighest();
def lProfile = if IsNaN(vol.getLowest()) and con then lProfile[1] else vol.getLowest();
def plotsDomain = IsNaN(close) == onExpansion;

plot POC = if plotsDomain then pc else Double.NaN;
plot ProfileHigh = if plotsDomain then hProfile else Double.NaN;
plot ProfileLow = if plotsDomain then lProfile else Double.NaN;
plot VAHigh = if plotsDomain then hVA else Double.NaN;
plot VALow = if plotsDomain then lVA else Double.NaN;

DefineGlobalColor("Profile", GetColor(1));
DefineGlobalColor("Point Of Control", GetColor(5));
DefineGlobalColor("Value Area", GetColor(8));

vol.show(globalColor("Profile"), if showPointOfControl then globalColor("Point Of Control") else color.current, if showValueArea then globalColor("Value Area") else color.current, opacity);
POC.SetDefaultColor(globalColor("Point Of Control"));
POC.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
VAHigh.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
VALow.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
VAHigh.SetDefaultColor(globalColor("Value Area"));
VALow.SetDefaultColor(globalColor("Value Area"));
ProfileHigh.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
ProfileLow.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
ProfileHigh.SetDefaultColor(GetColor(3));
ProfileLow.SetDefaultColor(GetColor(3));
ProfileHigh.hide();
ProfileLow.hide();
 
Last edited:

Adeodatus

Member
I would like to script Volume Profile that begins on earnings date and ends on the start of the next earnings. I would like it to automatically show the volume profile within those periods and not have to manually enter each date. Maybe the image is more clear than my explanation. Does anyone have any idea on how to do this? Thanks.


Not sure how to use this, but i'd try to see where a prediction slices through any major support/resistance levels.

Okay, I've loaded, and seen this in action, love the shading option!


Let me ask if this indicator alone could project a maybe possible potential run when PPS rises above the Earnings Day Resistance Level (EDRL), or is that coincidence along with some luck?
 
Last edited:

Similar threads

Top