• LIMITED TIME ONLY: Take $40 off VIP with code: BTD40.

MTF Relative Volume Labels


New member
What would the code look like to AddLabel for a 3 color Relative Volume Label. I want to be able to also add Aggregation Periods for a MTF Relative Volume?
Last edited:


New member
Thanks Merry. So my post is in the correct thread.
There is scripting here that is an MTF Squeeze. I have that loaded and it is nice and very useful, thank you to those whom put that one together. I tried all manner of ways to get my 3 color relative volume into a similar format with zero luck. Could we have a more generic MTF "template" and some explanation how to apply differing indicators within it? Heck If I could just a get a 3 color Relative Volume (StdDev) inot a lable I might could hack out the additional agg periods to make it MTF. Also I think this would be useful to many folks here. Relative Volume is important and charting in one timeframe while being able to glance at the RV on MTF format would be most useful. So not just for me I think lots us could benefit.
Here is my 3 Color Relative Volume Study of which I have no idea how to get into a MTF AddLabel Format.

#reference RelativeVolumeStDev

declare lower;
declare zerobase;

input length = 60;
input numDev = 2.0;
input numDev2 = 0.0;
input numDev3 = 5.0;
input allowNegativeValues = yes;

def rawRelVol = (volume - Average(volume, length)) / StDev(volume, length);
plot RelVol = if allowNegativeValues then rawRelVol else Max(0, rawRelVol);
plot StDevLevel = numDev;
plot StDevLevel2 = numDev2;
plot StDevLevel3 = numDev3;

RelVol.DefineColor("Above", (Color.MAGENTA));
RelVol.DefineColor("Below", (Color.LIGHT_ORANGE));
RelVol.DefineColor("Above2", (Color.GREEN));

RelVol.AssignValueColor (if (RelVol >= numDev2) && (RelVol < numDev3) then RelVol.Color("Above") else if (RelVol > numDev3) then RelVol.Color("Above2") else RelVol.Color("Below"));
StDevLevel.SetLineWeight (1);
StDevLevel2.SetLineWeight (1);
StDevLevel3.SetLineWeight (1);

# Here is my Relative Volume used in Watchlists:

plot c = Volume(period = AggregationPeriod.DAY) / Average(volume(period = AggregationPeriod.DAY), 30);
AssignBackgroundColor(if c > 12 then Color.CYAN
                      else if c > 7 then Color.Green
                      else if c > 5 then Color.Dark_Green
                      else if c > 3 then Color.Orange
                      else if c > 2 then Color.Pink
                      else Color.red);
#AddLabel(yes, AsText(c, NumberFormat.TWO_DECIMAL_PLACES) +"X", Color.black);

Similar threads