Monkey Bars Market Profile for ETH & RTH

Solution
This is awesome work:
https://usethinkscript.com/threads/...lume-profile-for-thinkorswim.9035/#post-89156

Is it possible to make one similar with the Monkey Bars indicator on ToS? That way we could break up TPOs in both ETH and RTH?

This may interest you. It is the TPO version of a Volumeprofile study I previously posted here.
It uses time inputs to create 3 trading zones, which you can change to your liking.
The default will plot the premarket, regular trading and aftermarket hours.
The input profiles controls how many zones will plot.
Screenshot 2024-12-27 113558.jpg
Code:
#TPOProfile_3_TradingZones

input zone1begin  = 0400;
input zone1end    = 0929;
input zone2end    = 1600;

def tradingzones  = if...
This is awesome work:
https://usethinkscript.com/threads/...lume-profile-for-thinkorswim.9035/#post-89156

Is it possible to make one similar with the Monkey Bars indicator on ToS? That way we could break up TPOs in both ETH and RTH?

This may interest you. It is the TPO version of a Volumeprofile study I previously posted here.
It uses time inputs to create 3 trading zones, which you can change to your liking.
The default will plot the premarket, regular trading and aftermarket hours.
The input profiles controls how many zones will plot.
Code:
#TPOProfile_3_TradingZones

input zone1begin  = 0400;
input zone1end    = 0929;
input zone2end    = 1600;

def tradingzones  = if SecondsFromTime(zone1begin) >= 0 and SecondsTillTime(zone1end) > 0
                    then 1
                    else if secondsfromTime(zone1end)>0 and secondstilltime(zone2end)>0
                    then 2
                    else 3;
def cond          = tradingzones[1] != tradingzones;

# TD Ameritrade IP Company, Inc. (c) 2010-2022
#

input pricePerRowHeightMode = {default AUTOMATIC, TICKSIZE, CUSTOM};
input customRowHeight = 1.0;
input timePerProfile = {CHART, MINUTE, HOUR, default DAY, WEEK, MONTH, "OPT EXP", BAR};
input multiplier = 1;
input onExpansion = yes;
input profiles = 6;
input showPointOfControl = yes;
input showValueArea = yes;
input valueAreaPercent = 70;
input opacity = 50;

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);
switch (timePerProfile) {
case CHART:
    period = 0;
case MINUTE:
    period = floor(seconds / 60 + day_number * 24 * 60);
case HOUR:
    period = floor(seconds / 3600 + day_number * 24);
case DAY:
    period = countTradingDays(min(first(yyyymmdd), yyyymmdd), yyyymmdd) - 1;
case WEEK:
    period = floor(day_number / 7);
case MONTH:
    period = floor(month - first(month));
case "OPT EXP":
    period = exp_opt - first(exp_opt);
case BAR:
    period = barNumber() - 1;
}

def count = CompoundValue(1, if period != period[1] then (count[1] + period - period[1]) % multiplier else count[1], 0);

def height;
switch (pricePerRowHeightMode) {
case AUTOMATIC:
    height = PricePerRow.AUTOMATIC;
case TICKSIZE:
    height = PricePerRow.TICKSIZE;
case CUSTOM:
    height = customRowHeight;
}

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

def hProfile = if IsNaN(tpo.getHighest()) and con then hProfile[1] else tpo.getHighest();
def lProfile = if IsNaN(tpo.getLowest()) and con then lProfile[1] else tpo.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));

tpo.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:
Solution
This may interest you. It is the TPO version of a Volumeprofile study I previously posted here.
It uses time inputs to create 3 trading zones, which you can change to your liking.
The default will plot the premarket, regular trading and aftermarket hours.
The input profiles controls how many zones will plot.
This worked out well. Thanks for your help!
 
This may interest you. It is the TPO version of a Volumeprofile study I previously posted here.
It uses time inputs to create 3 trading zones, which you can change to your liking.
The default will plot the premarket, regular trading and aftermarket hours.
The input profiles controls how many zones will plot.
@SleepyZ is it possible to modify the code to only see the premarket volume profile?
 
@SleepyZ is it possible to modify the code to only see the premarket volume profile?

Here is the Volumeprofile displaying only the premarket (zone1 from 0400-0929)
You can select different zones at the input
Here is a link to a TPOprofile version of this setup: https://tos.mx/!TSO05B3E

The image shows the profile lines only for the zone chosen. These can be extended at the input screen.
Code:
#VolumeProfile break at trading zones_Choices_of_Displaying_Zones

input zones_display        = {all, default zone1_only, zone2_only, zone3_only};
input show_profilehigh_low = yes;
input extend_lines         = yes;

input zone1_begin = 0400;
input zone2_begin = 0929;
input zone3_begin = 1600;

input pricePerRowHeightMode = {AUTOMATIC, default TICKSIZE, CUSTOM};
input customRowHeight = 1.0;
input onExpansion = no;
input profiles = 1000;
input showPointOfControl = yes;
input showValueArea = yes;
input valueAreaPercent = 70;
input opacity = 20;

def na = Double.NaN;
def tz = if SecondsFromTime(zone1_begin) >= 0 and SecondsFromTime(zone2_begin) < 0 then 1
         else if SecondsFromTime(zone2_begin) >= 0 and SecondsFromTime(zone3_begin) < 0 then 2
         else if SecondsFromTime(zone3_begin) >= 0 then 3 else tz[1];

def zone;
switch (zones_display) {
case zone1_only:
    zone = 1;
case zone2_only:
    zone = 2;
case zone3_only:
    zone = 3;
case all:
    zone = Double.NaN;
}

input show_label = yes;
AddLabel(show_label, (if IsNaN(zone) then "VolumeProfile Displaying ALL Zones" else "VolumeProfile Displaying Only Zone == " + zone) + (if zone and extend_lines then ", Extended" else ""), Color.YELLOW);
AddLabel(show_label and show_profilehigh_low, "Profiles High/Low Displayed", Color.WHITE);

def cond = tz != tz[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" = 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;

def POC_         = if if IsNaN(zone) then plotsDomain
                      else plotsDomain and tz == zone then pc
                   else if !extend_lines then na
                   else POC_[1];
def ProfileHigh_ = if if IsNaN(zone) then plotsDomain
                      else plotsDomain and tz == zone then hProfile
                   else if !extend_lines then na
                   else ProfileHigh_[1];
def ProfileLow_  = if if IsNaN(zone) then plotsDomain
                      else plotsDomain and tz == zone then lProfile
                   else if !extend_lines then na
                   else ProfileLow_[1];
def VAHigh_      = if if IsNaN(zone) then plotsDomain
                      else plotsDomain and tz == zone then hVA
                   else if !extend_lines then na
                   else VAHigh_[1];
def VALow_      = if if IsNaN(zone) then plotsDomain
                     else plotsDomain and tz == zone then lVA
                  else if !extend_lines then na 
                  else VALow_[1];

plot POC = POC_;
plot VAHigh = VAHigh_;
plot VALow = VALow_;
plot ProfileHigh = if !show_profilehigh_low then na else ProfileHigh_;
plot ProfileLow = if !show_profilehigh_low then na else ProfileLow_;

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

#vol.Show(#GlobalColor("Profile")
#color.gray, 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));

input bubbles = yes;
input n  = 2;
def   n1 = n + 1;
AddChartBubble(bubbles and !IsNaN(close[n1]) and IsNaN(close[n]), VAHigh[n1], "VAH", color = Color.YELLOW, yes);
AddChartBubble(bubbles and !IsNaN(close[n1]) and IsNaN(close[n]), VALow[n1], "VAL", Color.YELLOW, no);
AddChartBubble(bubbles and !IsNaN(close[n1]) and IsNaN(close[n]), POC[n1], "POC", Color.RED, no);

#
 
Here is the Volumeprofile displaying only the premarket (zone1 from 0400-0929)
You can select different zones at the input
Here is a link to a TPOprofile version of this setup: https://tos.mx/!TSO05B3E

The image shows the profile lines only for the zone chosen. These can be extended at the input screen.
I like this cause sometimes the Monkey bars can get overwhelming
1758402904393.png
 
Last edited:

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
451 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