Move Volume Profile to the left of chart?

yman

Member
is there any way to flip Volume profile coming from right to left like some of the other platforms?
Thanks
 
Last edited by a moderator:
Hi, Is there any custom study/code available in TOS to mimic the Volume Profile indicator in Trading view? I know there is VolumeProfile Indicator in TOS but it is plotting from left to right. I am looking for one which is plotting right to left on right axis. Thanks in advance.
Here is the MonkeyBars indicator in the image;s chart at the top and the Standard Volumeprofile in the chart bekiw,

Capture.jpg
 
Last edited by a moderator:
Here is the MonkeyBars indicator in the image;s chart at the top and the Standard Volumeprofile in the chart bekiw,
see code below, it is not prompting any syntax error however it seems to not be reading the oversold 30/overbought70 area, so its only changing candles red and green,,, any ssiatnce would eb greatly appreciated, i had retracted previous message thinking i had figured it out




declare upper;

input length = 14;
input over_Bought = 70;
input over_Sold = 30;
input price = close;
input averageType = AverageType.WILDERS;
input showBreakoutSignals = no;


def NetChgAvg = MovingAverage(averageType, price - price[1], length);
def TotChgAvg = MovingAverage(averageType, AbsValue(price - price[1]), length);
def ChgRatio = if TotChgAvg != 0 then NetChgAvg / TotChgAvg else 0;

def RSI = 50 * (ChgRatio + 1);
def OverSold = 70;
def OverBought = 30;

def UP = RSI > 50;
def DN = RSI < 50;
def UpCalc = UP - DN;

AssignPriceColor (if UP then Color.GREEN else if DN then Color.RED else if OverBought then Color.CYAN else if OverSold then Color.YELLOW
else Color.CURRENT
);
 
Here are the modifications to the MonkeyBar Indicator that were suggested above by @JT_479. The image shows the normal volumeprofile script on the left and the modified MonkeyBars on the right expansion.
Hi @SleepyZ

Nice study! Have two questions,

1. Is there anyway to hide the purple number bars to the right of the profile or at least make them less noticeable?
2. I would like to plot a horizontal line for the VAH and VAL like shown in the picture below and i want them to show only on the current day starting from 4AM going forward when used on expansion. Can this be done either on this monkeybar style VP or the regular TOS VP?

 
Last edited:
2. I would like to plot a horizontal line for the VAH and VAL like shown in the picture below and i want them to show only on the current day starting from 4AM going forward when used on expansion. Can this be done either on this monkeybar style VP or the regular TOS VP?


Anyone can help me adding the horizontal lines for the VAH & VAL? Thanks in advance
 
Anyone can help me adding the horizontal lines for the VAH & VAL? Thanks in advance

Modified the above monkeybars script that displayed the volumeprofile in the expansion pointing to the left, to include a volumeprofile profile image on the chart for valuearea, poc, vah and val.

Capture.jpg
Ruby:
#
# 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", default "Day", "2 Days", "3 Days", "4 Days", "Week", "Month", "Quarter", "Year"};
input timePerProfile = {CHART, MINUTE, HOUR, default DAY, WEEK, MONTH, "OPT EXP", BAR, YEAR};
input multiplier = 1;
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);
 
Since we are talking Volume Profile i found this ....

https://www.quanttradingapp.com/pub/tos_studies
Ruby:
#
# Quant Trading App Volume Profile
# Created: September 15, 2021
#
# Credit: Bryant Littrean, Thinkorswim
# Contact: [email protected]
# Trading Litt Youtube: https://bit.ly/trading-litt-yt
# Quant Trading App Discord: https://quanttradingdiscord.com
#

def multiplier = 1;
def onExpansion = no;
def profiles = 1000;

input showPointOfControl = yes;
input showValueArea = yes;
input valueAreaPercent = 68;
input opacity = 60; def period;

def yyyymmdd = getYyyyMmDd();
def seconds = secondsFromTime(0);
def month = getYear() * 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);

period = countTradingDays(min(first(yyyymmdd), yyyymmdd), yyyymmdd) - 1;

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 = PricePerRow.TICKSIZE;

profile vol = volumeProfile(
"startNewProfile" = cond, "onExpansion" = onExpansion, "numberOfProfiles" = profiles, "pricePerRow" = height, "value area percent" = valueAreaPercent); def con = compoundValue(1, onExpansion, no);

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", CreateColor(70, 70, 70));
DefineGlobalColor("Point Of Control", CreateColor(255, 215, 0));
DefineGlobalColor("Value Area", CreateColor(95, 140, 230));

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);
POC.SetLineWeight(2);

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();

qta_volume_profile.png
 
Last edited by a moderator:

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

Similar threads

Not the exact question you're looking for?

Start a new thread and receive assistance from our community.

87k+ Posts
274 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