Should look like this and I believe it should look like this take the trades with both columns turn green/red.
.
#WILL NEED TO HAVE TWO COLUMNS. SAME CODE FOR EACH BUT SET AGGREGATION TO 'D'
input period = 10;
input smoothingPeriod = 3;
input priceChangeWeighted = YES;
DEF delta = absValue(close-close[1]);
DEF multiplier = if(priceChangeWeighted, delta,1);
DEF maxLine = 80.0;
DEF minLine = 20.0;
DEF up = if(close > close[1], volume*multiplier, 0);
DEF down = if(close < close[1], volume*multiplier, 0);
DEF upvol = sum(up, period);
DEF downvol = sum(down, period);
DEF ratio = (100.0*(upvol/(downvol+upvol)));
def UPDVR = HullMovingAvg(ratio,smoothingPeriod);
DEF lineColor = if(UPDVR >= 80.0, 6, if(UPDVR < 20.0,5,1));
DEF plotData = UPDVR;
DEF VolumeRatio = UPDVR;
DEF VolumeRatioLine = UPDVR;
PLOT UPSIG = if UPDVR crosses above 80 THEN 1 ELSE 0;
DEF DNSIG = if UPDVR crosses below 20 THEN 1 ELSE 0;
UPsig.AssignvalueColor(IF UPsig THEN COLOR.LIGHT_green ELSE if DNsig then color.PINK else Color.WHITE);
AssignbackgroundColor(IF UPsig THEN COLOR.LIGHT_green ELSE if DNsig then color.PINK else Color.WHITE);[/CODE]
.
#WILL NEED TO HAVE TWO COLUMNS. SAME CODE FOR EACH BUT SET AGGREGATION TO 'D'
input period = 10;
input smoothingPeriod = 3;
input priceChangeWeighted = YES;
DEF delta = absValue(close-close[1]);
DEF multiplier = if(priceChangeWeighted, delta,1);
DEF maxLine = 80.0;
DEF minLine = 20.0;
DEF up = if(close > close[1], volume*multiplier, 0);
DEF down = if(close < close[1], volume*multiplier, 0);
DEF upvol = sum(up, period);
DEF downvol = sum(down, period);
DEF ratio = (100.0*(upvol/(downvol+upvol)));
def UPDVR = HullMovingAvg(ratio,smoothingPeriod);
DEF lineColor = if(UPDVR >= 80.0, 6, if(UPDVR < 20.0,5,1));
DEF plotData = UPDVR;
DEF VolumeRatio = UPDVR;
DEF VolumeRatioLine = UPDVR;
PLOT UPSIG = if UPDVR crosses above 80 THEN 1 ELSE 0;
DEF DNSIG = if UPDVR crosses below 20 THEN 1 ELSE 0;
UPsig.AssignvalueColor(IF UPsig THEN COLOR.LIGHT_green ELSE if DNsig then color.PINK else Color.WHITE);
AssignbackgroundColor(IF UPsig THEN COLOR.LIGHT_green ELSE if DNsig then color.PINK else Color.WHITE);[/CODE]
Last edited: