Right Justified Volume @ Price

Rags

New member
VIP
I am not sure if this is the proper Forum for my query. If not, can someone please help me direct to the proper forum for the following query:

I am looking for a Volume @ Price indicator for ToS which is right justified so I can identify the Volume Ledges facing the chart in order for me to identify price levels where institutional trade size occurred in the past. Also, it would be great if the indicator is dynamic so irrespective of the aggregation period, if we were to change the duration of the chart we are viewing the Volume @ Price (right justified) will automatically reflect the Volume @ Price action for that specific duration of time.

Please advise.

Regards,

Rags
 
Solution
@BenTen, That is correct Volume Profile on ToS but right justified and Volume Profile to be dynamic so it identifies the POC / VAH / VAL levels based on the duration of the chart on the screen

This may help.

1) It is the volumeprofile portion of the MonkeyBars indicator that plots right justified. We do not have a way provided by TOS to right justify the native VolumeProfile study.
2) It is defaulted to Year and a multiple of 5 that should cover most chart durations. Add more multiples if needed.
3) The image shows both the below code and native TOS Volumeprofile version for comparison.

Screenshot 2023-06-18 090059.png
Code:
# VolumeProfile_Right_Justified_using_MonkeyBars
#
# TD Ameritrade IP Company, Inc. (c) 2010-2022
#
# TOS Monkey...

Join useThinkScript to post your question to a community of 21,000+ developers and traders.

@BenTen, That is correct Volume Profile on ToS but right justified and Volume Profile to be dynamic so it identifies the POC / VAH / VAL levels based on the duration of the chart on the screen
 
@BenTen, That is correct Volume Profile on ToS but right justified and Volume Profile to be dynamic so it identifies the POC / VAH / VAL levels based on the duration of the chart on the screen

This may help.

1) It is the volumeprofile portion of the MonkeyBars indicator that plots right justified. We do not have a way provided by TOS to right justify the native VolumeProfile study.
2) It is defaulted to Year and a multiple of 5 that should cover most chart durations. Add more multiples if needed.
3) The image shows both the below code and native TOS Volumeprofile version for comparison.

Screenshot 2023-06-18 090059.png
Code:
# VolumeProfile_Right_Justified_using_MonkeyBars
#
# TD Ameritrade IP Company, Inc. (c) 2010-2022
#
# TOS Monkey Bars modified to show it's volumeprofile in the expansion to pointing to the left. A volumeprofile snippet was added to display the valuearea, poc, vah and val in the chart area as the monkeybars needs to remain set to onexpansion.

input pricePerRowHeightMode = {AUTOMATIC, default TICKSIZE, CUSTOM};
input customRowHeight = 1.0;
input aggregationPeriod = {"1 min", "2 min", "3 min", "4 min", "5 min", "10 min", "15 min", "20 min", "30 min", "1 hour", "2 hours", "4 hours",  "Day", "2 Days", "3 Days", "4 Days", "Week", "Month", "Quarter", default "Year"};
input timePerProfile = {CHART, MINUTE, HOUR,  DAY, WEEK, MONTH, "OPT EXP", BAR, default YEAR};
input multiplier = 5;
input onExpansion = yes;
input profiles = 1000;
input showMonkeyBar = no;
input showThePlayground = no;
input thePlaygroundPercent = 70;
input opacity = 40;
input emphasizeFirstDigit = no;
input markOpenPrice = no;
input markClosePrice = no;
input volumeShowStyle = MonkeyVolumeShowStyle.ALL;
input showVolumeVA = no;
input showVolumePoc = no;
input theVolumePercent = 70;
input showInitialBalance = no;
input initialBalanceRange = 3;

def period;
def yyyymmdd = GetYYYYMMDD();
def seconds = SecondsFromTime(0);
def year = GetYear();
def month = year * 12 + GetMonth();
def day_number = DaysFromDate(First(yyyymmdd)) + GetDayOfWeek(First(yyyymmdd));
def dom = GetDayOfMonth(yyyymmdd);
def dow = GetDayOfWeek(yyyymmdd - dom + 1);
def expthismonth = (if dow > 5 then 27 else 20) - dow;
def exp_opt = month + (dom > expthismonth);
def periodMin = Floor(seconds / 60 + day_number * 24 * 60);
def periodHour = Floor(seconds / 3600 + day_number * 24);
def periodDay = CountTradingDays(Min(First(yyyymmdd), yyyymmdd), yyyymmdd) - 1;
def periodWeek = Floor(day_number / 7);
def periodMonth = month - First(month);
def periodQuarter = Ceil(month / 3) - First(Ceil(month / 3));
def periodYear = year - First(year);

switch (timePerProfile) {
case CHART:
    period = 0;
case MINUTE:
    period = periodMin;
case HOUR:
    period = periodHour;
case DAY:
    period = periodDay;
case WEEK:
    period = periodWeek;
case MONTH:
    period = periodMonth;
case "OPT EXP":
    period = exp_opt - First(exp_opt);
case BAR:
    period = BarNumber() - 1;
case YEAR:
    period = periodYear;
}

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

def timeInterval;
def aggMultiplier;
switch (aggregationPeriod) {
case "1 min":
    timeInterval = periodMin;
    aggMultiplier = 1;
case "2 min":
    timeInterval = periodMin;
    aggMultiplier = 2;
case "3 min":
    timeInterval = periodMin;
    aggMultiplier = 3;
case "4 min":
    timeInterval = periodMin;
    aggMultiplier = 4;
case "5 min":
    timeInterval = periodMin;
    aggMultiplier = 5;
case "10 min":
    timeInterval = periodMin;
    aggMultiplier = 10;
case "15 min":
    timeInterval = periodMin;
    aggMultiplier = 15;
case "20 min":
    timeInterval = periodMin;
    aggMultiplier = 20;
case "30 min":
    timeInterval = periodMin;
    aggMultiplier = 30;
case "1 hour":
    timeInterval = periodHour;
    aggMultiplier = 1;
case "2 hours":
    timeInterval = periodHour;
    aggMultiplier = 2;
case "4 hours":
    timeInterval = periodHour;
    aggMultiplier = 4;
case "Day":
    timeInterval = periodDay;
    aggMultiplier = 1;
case "2 Days":
    timeInterval = periodDay;
    aggMultiplier = 2;
case "3 Days":
    timeInterval = periodDay;
    aggMultiplier = 3;
case "4 Days":
    timeInterval = periodDay;
    aggMultiplier = 4;
case "Week":
    timeInterval = periodWeek;
    aggMultiplier = 1;
case "Month":
    timeInterval = periodMonth;
    aggMultiplier = 1;
case "Quarter":
    timeInterval = periodQuarter;
    aggMultiplier = 1;
case "Year":
    timeInterval = periodYear;
    aggMultiplier = 1;
}

def agg_count = CompoundValue(1, if timeInterval != timeInterval[1] then (GetValue(agg_count, 1) + timeInterval - timeInterval[1]) % aggMultiplier else GetValue(agg_count, 1), 0);
def agg_cond = CompoundValue(1,  agg_count < agg_count[1] + timeInterval - timeInterval[1], yes);

def digit = CompoundValue(1, if cond then 1 else agg_cond + GetValue(digit, 1), 1);

profile monkey = MonkeyBars(digit, "startNewProfile" = cond, "onExpansion" = onExpansion,
"numberOfProfiles" = profiles, "pricePerRow" = height, "the playground percent" = thePlaygroundPercent,
"emphasize first digit" = emphasizeFirstDigit, "volumeProfileShowStyle" = volumeShowStyle, "volumePercentVA" = theVolumePercent,
 "show initial balance" = showInitialBalance, "initial balance range" = initialBalanceRange);
def con = CompoundValue(1, onExpansion, no);
def mbar = CompoundValue(1, if IsNaN(monkey.GetPointOfControl()) and con then GetValue(mbar, 1) else monkey.GetPointOfControl(), monkey.GetPointOfControl());
def hPG = CompoundValue(1, if IsNaN(monkey.GetHighestValueArea()) and con then GetValue(hPG, 1) else monkey.GetHighestValueArea(), monkey.GetHighestValueArea());
def lPG = CompoundValue(1, if IsNaN(monkey.GetLowestValueArea()) and con then GetValue(lPG, 1) else monkey.GetLowestValueArea(), monkey.GetLowestValueArea());

def hProfile = CompoundValue(1, if IsNaN(monkey.GetHighest()) and con then GetValue(hProfile, 1) else monkey.GetHighest(), monkey.GetHighest());
def lProfile = CompoundValue(1, if IsNaN(monkey.GetLowest()) and con then GetValue(lProfile, 1) else monkey.GetLowest(), monkey.GetLowest());
def plotsDomain = IsNaN(close) == onExpansion;

#plot MB = if plotsDomain then mbar else Double.NaN;
plot ProfileHigh = if plotsDomain then hProfile else Double.NaN;
plot ProfileLow = if plotsDomain then lProfile else Double.NaN;


DefineGlobalColor("Monkey Bar", GetColor(4));
DefineGlobalColor("The Playground", GetColor(3));
DefineGlobalColor("Open Price", GetColor(1));
DefineGlobalColor("Close Price", GetColor(1));
DefineGlobalColor("Volume", Color.CYAN);
DefineGlobalColor("Volume Value Area", GetColor(8));
DefineGlobalColor("Volume Point of Control", Color.RED);
DefineGlobalColor("Initial Balance", GetColor(7));

monkey.Show(color = Color.CYAN, "poc color" = Color.CURRENT, "va color" = Color.CURRENT, opacity = opacity, "open color" = Color.CURRENT, "close color" = Color.CURRENT, "ib color" =Color.CURRENT, "volume color" = color.cyan, "volume poc color" =  Color.CURRENT);

ProfileHigh.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
ProfileLow.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
ProfileHigh.SetDefaultColor(GetColor(3));
ProfileLow.SetDefaultColor(GetColor(3));
ProfileHigh.Hide();
ProfileLow.Hide();

#VolumeProfile snippet to display profile on last Timeperprofile on chart

input show_valuearea_color = yes;
profile vol = VolumeProfile(startnewprofile = cond, onExpansion = no, pricePerRow = PricePerRow.TICKSIZE, numberofprofiles = 1, "value area percent" = 70);
vol.Show(opacity = opacity, "volume va color" = Color.CURRENT, color = Color.CURRENT, "volume color" = Color.CURRENT, "volume poc color" = Color.DARK_RED, "va color" = if show_valuearea_color == yes then GetColor(8) else Color.CURRENT);
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();
plot poc = pc;
plot vah = hVA;
plot val = lVA;
vah.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
val.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
poc.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
vah.SetDefaultColor(Color.YELLOW);
val.SetDefaultColor(Color.YELLOW);
poc.SetDefaultColor(Color.RED);

#
 
Last edited:
Solution

Similar threads

Not the exact question you're looking for?

Start a new thread and receive assistance from our community.

87k+ Posts
391 Online
Create Post

Similar threads

Similar threads

The Market Trading Game Changer

Join 2,500+ subscribers inside the useThinkScript VIP Membership Club
  • Exclusive indicators
  • Proven strategies & setups
  • Private Discord community
  • ‘Buy The Dip’ signal alerts
  • Exclusive members-only content
  • Add-ons and resources
  • 1 full year of unlimited support

Frequently Asked Questions

What is useThinkScript?

useThinkScript is the #1 community of stock market investors using indicators and other tools to power their trading strategies. Traders of all skill levels use our forums to learn about scripting and indicators, help each other, and discover new ways to gain an edge in the markets.

How do I get started?

We get it. Our forum can be intimidating, if not overwhelming. With thousands of topics, tens of thousands of posts, our community has created an incredibly deep knowledge base for stock traders. No one can ever exhaust every resource provided on our site.

If you are new, or just looking for guidance, here are some helpful links to get you started.

What are the benefits of VIP Membership?
VIP members get exclusive access to these proven and tested premium indicators: Buy the Dip, Advanced Market Moves 2.0, Take Profit, and Volatility Trading Range. In addition, VIP members get access to over 50 VIP-only custom indicators, add-ons, and strategies, private VIP-only forums, private Discord channel to discuss trades and strategies in real-time, customer support, trade alerts, and much more. Learn all about VIP membership here.
How can I access the premium indicators?
To access the premium indicators, which are plug and play ready, sign up for VIP membership here.
Back
Top