previous day monkeybar/High/Low/Close/Mid/ (middle of the day) and the bubbles.

woulf1004

Active member
Hi @SleepyZ,

I found this monkey bar indicator in TOS that has agregarion periods scrips that may help for the results that I wanted which is plotting the previous day monkeybar in this case for the tick chart I'm using. I am sorry for keep insisting but.. would you be able to code this so it can plot the results based on the different aggregation periods available? And if it makes it easier.. all I need are plotting for previous day monkeybar/High/Low/Close/Mid/ (middle of the day) and the bubbles.

input pricePerRowHeightMode = {default AUTOMATIC, TICKSIZE, CUSTOM};
input customRowHeight = 1.0;
input aggregationPeriod = {"1 min", "2 min", "3 min", "4 min", "5 min", "10 min", "15 min", "20 min", default "30 min", "1 hour", "2 hours", "4 hours", "Day", "2 Days", "3 Days", "4 Days", "Week", "Month", "Quarter", "Year"};
input timePerProfile = {default CHART, MINUTE, HOUR, DAY, WEEK, MONTH, "OPT EXP", BAR, YEAR};
input multiplier = 1;
input onExpansion = yes;
input profiles = 1000;
input showMonkeyBar = yes;
input showThePlayground = yes;
input thePlaygroundPercent = 70;
input opacity = 100;
input emphasizeFirstDigit = no;
input markOpenPrice = yes;
input markClosePrice = yes;
input volumeShowStyle = MonkeyVolumeShowStyle.NONE;
input showVolumeVA = yes;
input showVolumePoc = yes;
input theVolumePercent = 70;
input showInitialBalance = yes;
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;
plot PGHigh = if plotsDomain then hPG else Double.NaN;
plot PGLow = if plotsDomain then lPG 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", GetColor(8));
DefineGlobalColor("Volume Value Area", GetColor(2));
DefineGlobalColor("Volume Point of Control", GetColor(3));
DefineGlobalColor("Initial Balance", GetColor(7));

monkey.show(color.red, if showMonkeyBar then globalColor("Monkey Bar") else color.current,
if showThePlayground then globalColor("The Playground") else color.current,
opacity, if markOpenPrice then globalColor("Open Price") else color.current,
if markClosePrice then globalColor("Close Price") else color.current,
if showInitialBalance then globalColor("Initial Balance") else color.current,
globalColor("Volume"),
if showVolumeVA then globalColor("Volume Value Area") else color.current,
if showVolumePOC then globalColor("Volume Point of Control") else color.current);
MB.SetDefaultColor(globalColor("Monkey Bar"));
MB.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
PGHigh.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
PGLow.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
PGHigh.SetDefaultColor(globalColor("The Playground"));
PGLow.SetDefaultColor(globalColor("The Playground"));
ProfileHigh.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
ProfileLow.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
ProfileHigh.SetDefaultColor(GetColor(3));
ProfileLow.SetDefaultColor(GetColor(3));
ProfileHigh.hide();
ProfileLow.hide();
 
Last edited by a moderator:
Hi @SleepyZ,

I found this monkey bar indicator in TOS that has agregarion periods scrips that may help for the results that I wanted which is plotting the previous day monkeybar in this case for the tick chart I'm using. I am sorry for keep insisting but.. would you be able to code this so it can plot the results based on the different aggregation periods available? And if it makes it easier.. all I need are plotting for previous day monkeybar/High/Low/Close/Mid/ (middle of the day) and the bubbles.

input pricePerRowHeightMode = {default AUTOMATIC, TICKSIZE, CUSTOM};
input customRowHeight = 1.0;
input aggregationPeriod = {"1 min", "2 min", "3 min", "4 min", "5 min", "10 min", "15 min", "20 min", default "30 min", "1 hour", "2 hours", "4 hours", "Day", "2 Days", "3 Days", "4 Days", "Week", "Month", "Quarter", "Year"};
input timePerProfile = {default CHART, MINUTE, HOUR, DAY, WEEK, MONTH, "OPT EXP", BAR, YEAR};
input multiplier = 1;
input onExpansion = yes;
input profiles = 1000;
input showMonkeyBar = yes;
input showThePlayground = yes;
input thePlaygroundPercent = 70;
input opacity = 100;
input emphasizeFirstDigit = no;
input markOpenPrice = yes;
input markClosePrice = yes;
input volumeShowStyle = MonkeyVolumeShowStyle.NONE;
input showVolumeVA = yes;
input showVolumePoc = yes;
input theVolumePercent = 70;
input showInitialBalance = yes;
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;
plot PGHigh = if plotsDomain then hPG else Double.NaN;
plot PGLow = if plotsDomain then lPG 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", GetColor(8));
DefineGlobalColor("Volume Value Area", GetColor(2));
DefineGlobalColor("Volume Point of Control", GetColor(3));
DefineGlobalColor("Initial Balance", GetColor(7));

monkey.show(color.red, if showMonkeyBar then globalColor("Monkey Bar") else color.current,
if showThePlayground then globalColor("The Playground") else color.current,
opacity, if markOpenPrice then globalColor("Open Price") else color.current,
if markClosePrice then globalColor("Close Price") else color.current,
if showInitialBalance then globalColor("Initial Balance") else color.current,
globalColor("Volume"),
if showVolumeVA then globalColor("Volume Value Area") else color.current,
if showVolumePOC then globalColor("Volume Point of Control") else color.current);
MB.SetDefaultColor(globalColor("Monkey Bar"));
MB.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
PGHigh.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
PGLow.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
PGHigh.SetDefaultColor(globalColor("The Playground"));
PGLow.SetDefaultColor(globalColor("The Playground"));
ProfileHigh.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
ProfileLow.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
ProfileHigh.SetDefaultColor(GetColor(3));
ProfileLow.SetDefaultColor(GetColor(3));
ProfileHigh.hide();
ProfileLow.hide();

Here is the monkeybars from above refrenced, as well as a tpoprofile added to the volumeprofile in the modified code below, each profile's poc with a different color.

Be careful to make sure you are using the same chart settings for extended hours being on/off, as it will create some noticable differences in some cases than if you are using just regular trading hours. Also, the lookback could be affected by the amount of bars in the time axis expansion area, especially with coupled with potential extended hours mismatches This could have caused problems with your original concerns.

The 1st chart image shows the new code below with the monkey bar code included in the upper pane with just regular trading hours activated. The lower pane has all 3 profiles included with just regular trading hours also. The upper and lower pane profiles match the revised code you requested.

The 2nd image shows the upper pane with extended hours off and the lower pane with extended hours on. This created a noticable difference in the monkeybars plot, but not with the other two.

Capture.jpg
Capture.jpg
Ruby:
input daysback = 1;
input daysback_poc = 1;
input showonexpansion = no;

def ymd      = GetYYYYMMDD();
def candles  = !IsNaN(close);
def capture  = candles and ymd != ymd[1];
def dayCount = CompoundValue(1, if capture then dayCount[1] + 1 else dayCount[1], 0);
def thisDay  = (HighestAll(dayCount) - dayCount) ;

def tpoc      = if thisDay == daysback_poc then reference TPOProfile("price per row height mode" = "TICKSIZE", "time per profile" = "DAY", "on expansion" = no) else tpoc[1];
def mbpoc      = if thisDay == daysback_poc then reference MonkeyBars("price per row height mode" = "TICKSIZE", "time per profile" = "DAY", "on expansion" = no) else mbpoc[1];
def vpoc      = if thisDay == daysback_poc then reference VolumeProfile("time per profile" = "DAY", "on expansion" = no, "price per row height mode" = "TICKSIZE") else vpoc[1];
def phigh   = if thisDay == daysback then reference VolumeProfile("price per row height mode" = "TICKSIZE", "time per profile" = "DAY", "on expansion" = no).ProfileHigh else phigh[1];
def plow    = if thisDay == daysback then reference VolumeProfile("price per row height mode" = "TICKSIZE", "time per profile" = "DAY", "on expansion" = no).ProfileLow else plow[1];
def pclose  = if thisDay == daysback then close(period = AggregationPeriod.DAY) else pclose[1];
def dopen  = if thisDay == 0 then open(period = AggregationPeriod.DAY) else dopen[1];

plot tpoc1  = if showonexpansion and !IsNaN(close) or thisDay > daysback_poc then Double.NaN else tpoc;
plot mbpoc1  = if showonexpansion and !IsNaN(close) or thisDay > daysback_poc then Double.NaN else mbpoc;
plot vpoc1  = if showonexpansion and !IsNaN(close) or thisDay > daysback_poc then Double.NaN else vpoc;
plot high1 = if showonexpansion and !IsNaN(close) or  thisDay > daysback then Double.NaN else phigh;
plot low1  = if showonexpansion and !IsNaN(close) or  thisDay > daysback then Double.NaN else plow;
plot close1 = if showonexpansion and !IsNaN(close) or  thisDay > daysback then Double.NaN else pclose;
plot mid1  = if showonexpansion and !IsNaN(close) or  thisDay > daysback then Double.NaN else (phigh + plow) / 2;
plot open0 = if showonexpansion and !IsNaN(close) or  thisDay > 0 then Double.NaN else dopen;

tpoc1.SetDefaultColor(Color.RED);
mbpoc1.SetDefaultColor(Color.DARK_ORANGE);
vpoc1.SetDefaultColor(Color.CYAN);
high1.SetDefaultColor(Color.YELLOW);
low1.SetDefaultColor(Color.YELLOW);
close1.SetDefaultColor(Color.MAGENTA);
mid1.SetDefaultColor(Color.YELLOW);
open0.SetDefaultColor(Color.WHITE);

input bubblemover = 5;
def b  = bubblemover;
def b1 = b + 1;
input showbubbles = yes;
AddChartBubble(showbubbles and IsNaN(close[b]) and !IsNaN(close[b1]), tpoc1[b], "TPOC-" + daysback_poc, tpoc1.TakeValueColor());
AddChartBubble(showbubbles and IsNaN(close[b]) and !IsNaN(close[b1]), mbpoc1[b], "MBPOC-" + daysback_poc, mbpoc1.TakeValueColor());
AddChartBubble(showbubbles and IsNaN(close[b]) and !IsNaN(close[b1]), vpoc1[b], "VPOC-" + daysback_poc, vpoc1.TakeValueColor());
AddChartBubble(showbubbles and IsNaN(close[b]) and !IsNaN(close[b1]), high1[b], "H-" + daysback, high1.TakeValueColor());
AddChartBubble(showbubbles and IsNaN(close[b]) and !IsNaN(close[b1]), low1[b], "L-" + daysback, low1.TakeValueColor());
AddChartBubble(showbubbles and IsNaN(close[b]) and !IsNaN(close[b1]), close1[b], "C-" + daysback, close1.TakeValueColor());
AddChartBubble(showbubbles and IsNaN(close[b]) and !IsNaN(close[b1]), mid1[b], "M-" + daysback, mid1.TakeValueColor());
AddChartBubble(showbubbles and IsNaN(close[b]) and !IsNaN(close[b1]), open0[b], "O-" + 0, open0.TakeValueColor());
#
#
 

Attachments

  • Capture.jpg
    Capture.jpg
    180.5 KB · Views: 324

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

What I need is an indicator that plots the previous day monkeybar based on timeIntervals and If I have to choose one specific interval it will be the 30mns. Can you make this indicator to plot the previous day monkeybar based on 30mns time interval? Can you refer to the original TOS monkeybar time interval scripts and use them so you can modify it as such? Not sure if this can be combined the way I need it, but please let me know if you can use the existing time interval scrips from TOS and modify it as previous days plotting instead.
 
What I need is an indicator that plots the previous day monkeybar based on timeIntervals and If I have to choose one specific interval it will be the 30mns. Can you make this indicator to plot the previous day monkeybar based on 30mns time interval? Can you refer to the original TOS monkeybar time interval scripts and use them so you can modify it as such? Not sure if this can be combined the way I need it, but please let me know if you can use the existing time interval scrips from TOS and modify it as previous days plotting instead.
WhatI provided is the monkey bar indicator reference which has the time interval in it. Click on the reference to see the options in the drop downs on the right side
 
The script you have provided shows only the days back option which is great but I am trying to see if the time interval can be combined with it using what's already existing in TOS.

input aggregationPeriod = {"1 min", "2 min", "3 min", "4 min", "5 min", "10 min", "15 min", "20 min", default "30 min", "1 hour", "2 hours", "4 hours", "Day", "2 Days", "3 Days", "4 Days", "Week", "Month", "Quarter", "Year"};

and

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;
}


Please see the attached for your reference. I have combined the volume profile and monkeybar on the same chart and they're showing similar POC and MB values for the 30mns chart. I would like to know if these specific MB values (3914.26 and 3778.57) based on the 30mns time interval can be plotted on the tick chart. Can these be combined? I understand you said for the first script you've created that these can not be combined. But using the existing parameters built for the monkeybar indicator. Could this be a possibility? I would like to have these orange lines mb values and lines plotted on a 2000 tick chart.
 
Last edited:
The script you have provided shows only the days back option which is great but I am trying to see if the time interval can be combined with it using what's already existing in TOS.

input aggregationPeriod = {"1 min", "2 min", "3 min", "4 min", "5 min", "10 min", "15 min", "20 min", default "30 min", "1 hour", "2 hours", "4 hours", "Day", "2 Days", "3 Days", "4 Days", "Week", "Month", "Quarter", "Year"};

and

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;
}


Please see the attached for your reference. I have combined the volume profile and monkeybar on the same chart and they're showing similar POC and MB values for the 30mns chart. I would like to know if these specific MB values (3914.26 and 3778.57) based on the 30mns time interval can be plotted on the tick chart. Can these be combined? I understand you said for the first script you've created that these can not be combined. But using the existing parameters built for the monkeybar indicator. Could this be a possibility? I would like to have these orange lines mb values and lines plotted on a 2000 tick chart.

The Monkeybars referenced in the script I provided can be adjusted as I mentioned. It has an aggregationperiod component. See the image below where the adjustments can be made. Click on the code 'monkeybars' and the popup to make changes appears.

Your original request was for a POC. Both the Volumeprofile and TPO indicators do not have a aggregationperiod component as does the Monkeybars, which has a plot termed 'MB'. If that is what you wanted, it was put into the code above.

 
The script I received is the one in the below which does not match with the image you've provided. Am I missing a different script?
Please see the below for your reference and advise.


and the script I have for this monkeybar is in the below because I see the options on the image you have provided except that I don't have those options for the script I've received. Please check and advise.

input daysback = 1;
input daysback_poc = 1;
input showonexpansion = no;

def ymd = GetYYYYMMDD();
def candles = !IsNaN(close);
def capture = candles and ymd != ymd[1];
def dayCount = CompoundValue(1, if capture then dayCount[1] + 1 else dayCount[1], 0);
def thisDay = (HighestAll(dayCount) - dayCount) ;

def tpoc = if thisDay == daysback_poc then reference TPOProfile("price per row height mode" = "TICKSIZE", "time per profile" = "DAY", "on expansion" = no) else tpoc[1];
def mbpoc = if thisDay == daysback_poc then reference MonkeyBars("price per row height mode" = "TICKSIZE", "time per profile" = "DAY", "on expansion" = no) else mbpoc[1];
def vpoc = if thisDay == daysback_poc then reference VolumeProfile("time per profile" = "DAY", "on expansion" = no, "price per row height mode" = "TICKSIZE") else vpoc[1];
def phigh = if thisDay == daysback then reference VolumeProfile("price per row height mode" = "TICKSIZE", "time per profile" = "DAY", "on expansion" = no).ProfileHigh else phigh[1];
def plow = if thisDay == daysback then reference VolumeProfile("price per row height mode" = "TICKSIZE", "time per profile" = "DAY", "on expansion" = no).ProfileLow else plow[1];
def pclose = if thisDay == daysback then close(period = AggregationPeriod.DAY) else pclose[1];
def dopen = if thisDay == 0 then open(period = AggregationPeriod.DAY) else dopen[1];

plot tpoc1 = if showonexpansion and !IsNaN(close) or thisDay > daysback_poc then Double.NaN else tpoc;
plot mbpoc1 = if showonexpansion and !IsNaN(close) or thisDay > daysback_poc then Double.NaN else mbpoc;
plot vpoc1 = if showonexpansion and !IsNaN(close) or thisDay > daysback_poc then Double.NaN else vpoc;
plot high1 = if showonexpansion and !IsNaN(close) or thisDay > daysback then Double.NaN else phigh;
plot low1 = if showonexpansion and !IsNaN(close) or thisDay > daysback then Double.NaN else plow;
plot close1 = if showonexpansion and !IsNaN(close) or thisDay > daysback then Double.NaN else pclose;
plot mid1 = if showonexpansion and !IsNaN(close) or thisDay > daysback then Double.NaN else (phigh + plow) / 2;
plot open0 = if showonexpansion and !IsNaN(close) or thisDay > 0 then Double.NaN else dopen;

tpoc1.SetDefaultColor(Color.RED);
mbpoc1.SetDefaultColor(Color.DARK_ORANGE);
vpoc1.SetDefaultColor(Color.CYAN);
high1.SetDefaultColor(Color.YELLOW);
low1.SetDefaultColor(Color.YELLOW);
close1.SetDefaultColor(Color.MAGENTA);
mid1.SetDefaultColor(Color.YELLOW);
open0.SetDefaultColor(Color.WHITE);

input bubblemover = 5;
def b = bubblemover;
def b1 = b + 1;
input showbubbles = yes;
AddChartBubble(showbubbles and IsNaN(close) and !IsNaN(close[b1]), tpoc1, "TPOC-" + daysback_poc, tpoc1.TakeValueColor());
AddChartBubble(showbubbles and IsNaN(close) and !IsNaN(close[b1]), mbpoc1, "MBPOC-" + daysback_poc, mbpoc1.TakeValueColor());
AddChartBubble(showbubbles and IsNaN(close) and !IsNaN(close[b1]), vpoc1, "VPOC-" + daysback_poc, vpoc1.TakeValueColor());
AddChartBubble(showbubbles and IsNaN(close) and !IsNaN(close[b1]), high1, "H-" + daysback, high1.TakeValueColor());
AddChartBubble(showbubbles and IsNaN(close) and !IsNaN(close[b1]), low1, "L-" + daysback, low1.TakeValueColor());
AddChartBubble(showbubbles and IsNaN(close) and !IsNaN(close[b1]), close1, "C-" + daysback, close1.TakeValueColor());
AddChartBubble(showbubbles and IsNaN(close) and !IsNaN(close[b1]), mid1, "M-" + daysback, mid1.TakeValueColor());
AddChartBubble(showbubbles and IsNaN(close) and !IsNaN(close[b1]), open0, "O-" + 0, open0.TakeValueColor());
#
#
 
The script I received is the one in the below which does not match with the image you've provided. Am I missing a different script?
Please see the below for your reference and advise.


and the script I have for this monkeybar is in the below because I see the options on the image you have provided except that I don't have those options for the script I've received. Please check and advise.

input daysback = 1;
input daysback_poc = 1;
input showonexpansion = no;

def ymd = GetYYYYMMDD();
def candles = !IsNaN(close);
def capture = candles and ymd != ymd[1];
def dayCount = CompoundValue(1, if capture then dayCount[1] + 1 else dayCount[1], 0);
def thisDay = (HighestAll(dayCount) - dayCount) ;

def tpoc = if thisDay == daysback_poc then reference TPOProfile("price per row height mode" = "TICKSIZE", "time per profile" = "DAY", "on expansion" = no) else tpoc[1];
def mbpoc = if thisDay == daysback_poc then reference MonkeyBars("price per row height mode" = "TICKSIZE", "time per profile" = "DAY", "on expansion" = no) else mbpoc[1];
def vpoc = if thisDay == daysback_poc then reference VolumeProfile("time per profile" = "DAY", "on expansion" = no, "price per row height mode" = "TICKSIZE") else vpoc[1];
def phigh = if thisDay == daysback then reference VolumeProfile("price per row height mode" = "TICKSIZE", "time per profile" = "DAY", "on expansion" = no).ProfileHigh else phigh[1];
def plow = if thisDay == daysback then reference VolumeProfile("price per row height mode" = "TICKSIZE", "time per profile" = "DAY", "on expansion" = no).ProfileLow else plow[1];
def pclose = if thisDay == daysback then close(period = AggregationPeriod.DAY) else pclose[1];
def dopen = if thisDay == 0 then open(period = AggregationPeriod.DAY) else dopen[1];

plot tpoc1 = if showonexpansion and !IsNaN(close) or thisDay > daysback_poc then Double.NaN else tpoc;
plot mbpoc1 = if showonexpansion and !IsNaN(close) or thisDay > daysback_poc then Double.NaN else mbpoc;
plot vpoc1 = if showonexpansion and !IsNaN(close) or thisDay > daysback_poc then Double.NaN else vpoc;
plot high1 = if showonexpansion and !IsNaN(close) or thisDay > daysback then Double.NaN else phigh;
plot low1 = if showonexpansion and !IsNaN(close) or thisDay > daysback then Double.NaN else plow;
plot close1 = if showonexpansion and !IsNaN(close) or thisDay > daysback then Double.NaN else pclose;
plot mid1 = if showonexpansion and !IsNaN(close) or thisDay > daysback then Double.NaN else (phigh + plow) / 2;
plot open0 = if showonexpansion and !IsNaN(close) or thisDay > 0 then Double.NaN else dopen;

tpoc1.SetDefaultColor(Color.RED);
mbpoc1.SetDefaultColor(Color.DARK_ORANGE);
vpoc1.SetDefaultColor(Color.CYAN);
high1.SetDefaultColor(Color.YELLOW);
low1.SetDefaultColor(Color.YELLOW);
close1.SetDefaultColor(Color.MAGENTA);
mid1.SetDefaultColor(Color.YELLOW);
open0.SetDefaultColor(Color.WHITE);

input bubblemover = 5;
def b = bubblemover;
def b1 = b + 1;
input showbubbles = yes;
AddChartBubble(showbubbles and IsNaN(close) and !IsNaN(close[b1]), tpoc1, "TPOC-" + daysback_poc, tpoc1.TakeValueColor());
AddChartBubble(showbubbles and IsNaN(close) and !IsNaN(close[b1]), mbpoc1, "MBPOC-" + daysback_poc, mbpoc1.TakeValueColor());
AddChartBubble(showbubbles and IsNaN(close) and !IsNaN(close[b1]), vpoc1, "VPOC-" + daysback_poc, vpoc1.TakeValueColor());
AddChartBubble(showbubbles and IsNaN(close) and !IsNaN(close[b1]), high1, "H-" + daysback, high1.TakeValueColor());
AddChartBubble(showbubbles and IsNaN(close) and !IsNaN(close[b1]), low1, "L-" + daysback, low1.TakeValueColor());
AddChartBubble(showbubbles and IsNaN(close) and !IsNaN(close[b1]), close1, "C-" + daysback, close1.TakeValueColor());
AddChartBubble(showbubbles and IsNaN(close) and !IsNaN(close[b1]), mid1, "M-" + daysback, mid1.TakeValueColor());
AddChartBubble(showbubbles and IsNaN(close) and !IsNaN(close[b1]), open0, "O-" + 0, open0.TakeValueColor());
#
#

See if this picture helps

Capture.jpg
 
The study options showing in your image definitely do not show up on the customized indicator I have using the script you have provided. Can you please send me the script once more to make sure I have the correct one?
 
The study options showing in your image definitely do not show up on the customized indicator I have using the script you have provided. Can you please send me the script once more to make sure I have the correct one?

The script in the following post is the script I last provided to you. https://usethinkscript.com/threads/...-of-the-day-and-the-bubbles.11574/post-100334

Here is the TOS MonkeyBars indicator that is the referenced in the above linked code [I did not check line by line, but I believe that this code is what you provided above]. Both have the same input options whether at the input screen in the case of the TOS MonkeyBars indicator or the referenced MonkeyBars input popup when used in the code link. TOS provides a 'reference' to indicators that only they provide.
Ruby:
#
# TD Ameritrade IP Company, Inc. (c) 2010-2022
#

input pricePerRowHeightMode = {default AUTOMATIC, TICKSIZE, CUSTOM};
input customRowHeight = 1.0;
input aggregationPeriod = {"1 min", "2 min", "3 min", "4 min", "5 min", "10 min", "15 min", "20 min", default "30 min", "1 hour", "2 hours", "4 hours", "Day", "2 Days", "3 Days", "4 Days", "Week", "Month", "Quarter", "Year"};
input timePerProfile = {default CHART, MINUTE, HOUR, DAY, WEEK, MONTH, "OPT EXP", BAR, YEAR};
input multiplier = 1;
input onExpansion = yes;
input profiles = 1000;
input showMonkeyBar = yes;
input showThePlayground = yes;
input thePlaygroundPercent = 70;
input opacity = 100;
input emphasizeFirstDigit = no;
input markOpenPrice = yes;
input markClosePrice = yes;
input volumeShowStyle = MonkeyVolumeShowStyle.NONE;
input showVolumeVA = yes;
input showVolumePoc = yes;
input theVolumePercent = 70;
input showInitialBalance = yes;
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;
plot PGHigh = if plotsDomain then hPG else Double.NaN;
plot PGLow = if plotsDomain then lPG 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", GetColor(8));
DefineGlobalColor("Volume Value Area", GetColor(2));
DefineGlobalColor("Volume Point of Control", GetColor(3));
DefineGlobalColor("Initial Balance", GetColor(7));

monkey.show(color.red, if showMonkeyBar then globalColor("Monkey Bar") else color.current,
 if showThePlayground then globalColor("The Playground") else color.current,
 opacity, if markOpenPrice then globalColor("Open Price") else color.current,
 if markClosePrice then globalColor("Close Price") else color.current,
 if showInitialBalance then globalColor("Initial Balance") else color.current,
 globalColor("Volume"),
 if showVolumeVA then globalColor("Volume Value Area") else color.current,
 if showVolumePOC then globalColor("Volume Point of Control") else color.current);
MB.SetDefaultColor(globalColor("Monkey Bar"));
MB.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
PGHigh.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
PGLow.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
PGHigh.SetDefaultColor(globalColor("The Playground"));
PGLow.SetDefaultColor(globalColor("The Playground"));
ProfileHigh.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
ProfileLow.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
ProfileHigh.SetDefaultColor(GetColor(3));
ProfileLow.SetDefaultColor(GetColor(3));
ProfileHigh.hide();
ProfileLow.hide();
 
The referenced script provided via link does not show the aggregation period for the monkeybar 30mns of previous day that I need. The study option in the image you've attached is what I need. The current script provided only shows inputs for dayback, payback poc, showonexpansion, bubble mover and show bubbles. The plots are for tpoc1, mbpoc1, vpoc1, high1, low1, close1, mid1 and open0.

I am attaching both images. One which is the study for the script you have provided via link and the second image that has cyan color marks you've provided stating that I should also see those study options so you can compare them and see that these two do not match.


I need the study options as the attached in the below to plot them as previous days. Is this a possible scenario?

 
The referenced script provided via link does not show the aggregation period for the monkeybar 30mns of previous day that I need. The study option in the image you've attached is what I need. The current script provided only shows inputs for dayback, payback poc, showonexpansion, bubble mover and show bubbles. The plots are for tpoc1, mbpoc1, vpoc1, high1, low1, close1, mid1 and open0.

I am attaching both images. One which is the study for the script you have provided via link and the second image that has cyan color marks you've provided stating that I should also see those study options so you can compare them and see that these two do not match.


I need the study options as the attached in the below to plot them as previous days. Is this a possible scenario?


Please reread above posts. That option to see that option is available in the code in post #2. Just click on the word Monkeybars in the line

def mbpoc = if thisDay == daysback_poc then reference MonkeyBars("price per row height mode" = "TICKSIZE", "time per profile" = "DAY", "on expansion" = no) else mbpoc[1];

I have explained that the reference is referring to the TOS Monkeybars indicator you want. The parts showing in the parentheses are the default ones that I changed. The aggregationperiod is defaulted to 30minutes, so it is not displayed in the parentheses. It will appear in the input choice box though when you click on the word Monkeybars if you want some other time.
 
I apologize for the late reply. I can now understand what you have been trying to explain. My think script editor had the reference option as default so then when I clicked on Inspector, that's when everything started to make sense. I can now see that the monkey bars you have coded are set to 30mns as default! You are amazing! I did not know or understood how the think script editor works just until now. I am so sorry.
 
To finalize this the hard work you've created for me which I think is fantastic! Can you please add 2 more monkeybars that can plot the previous 2 and 3 days based on 30mns as well? I would like this indicator to be able to plot 3 previous days monkey bars total. And again, thanks in advance for the amazing work. You are a genius!!
 
To finalize this the hard work you've created for me which I think is fantastic! Can you please add 2 more monkeybars that can plot the previous 2 and 3 days based on 30mns as well? I would like this indicator to be able to plot 3 previous days monkey bars total. And again, thanks in advance for the amazing work. You are a genius!!

Here is the script updated for the two additional Monkeybars' MB/POC plot 2 and 3 daysback.

Capture.jpg
Ruby:
input daysback = 1;
input showonexpansion = no;

def ymd      = GetYYYYMMDD();
def candles  = !IsNaN(close);
def capture  = candles and ymd != ymd[1];
def dayCount = CompoundValue(1, if capture then dayCount[1] + 1 else dayCount[1], 0);
def thisDay  = (HighestAll(dayCount) - dayCount) ;

def tpoc      = if thisDay == daysback then reference TPOProfile("price per row height mode" = "TICKSIZE", "time per profile" = "DAY", "on expansion" = no) else tpoc[1];
def mbpoc      = if thisDay == daysback then reference MonkeyBars("price per row height mode" = "TICKSIZE", "time per profile" = "DAY", "on expansion" = no) else mbpoc[1];
def mb1poc     = if thisDay == daysback + 1 then reference MonkeyBars("price per row height mode" = "TICKSIZE", "time per profile" = "DAY", "on expansion" = no) else mb1poc[1];
def mb2poc     = if thisDay == daysback + 2 then reference MonkeyBars("price per row height mode" = "TICKSIZE", "time per profile" = "DAY", "on expansion" = no) else mb2poc[1];
def vpoc      = if thisDay == daysback then reference VolumeProfile("time per profile" = "DAY", "on expansion" = no, "price per row height mode" = "TICKSIZE") else vpoc[1];
def phigh   = if thisDay == daysback then reference VolumeProfile("price per row height mode" = "TICKSIZE", "time per profile" = "DAY", "on expansion" = no).ProfileHigh else phigh[1];
def plow    = if thisDay == daysback then reference VolumeProfile("price per row height mode" = "TICKSIZE", "time per profile" = "DAY", "on expansion" = no).ProfileLow else plow[1];
def pclose  = if thisDay == daysback then close(period = AggregationPeriod.DAY) else pclose[1];
def dopen  = if thisDay == 0 then open(period = AggregationPeriod.DAY) else dopen[1];

plot tpoc1  = if showonexpansion and !IsNaN(close) or thisDay > daysback then Double.NaN else tpoc;
plot mbpoc1  = if showonexpansion and !IsNaN(close) or thisDay > daysback then Double.NaN else mbpoc;
plot mb1poc1  = if showonexpansion and !IsNaN(close) or thisDay > daysback + 1 then Double.NaN else mb1poc;
plot mb2poc1  = if showonexpansion and !IsNaN(close) or thisDay > daysback + 2 then Double.NaN else mb2poc;
plot vpoc1  = if showonexpansion and !IsNaN(close) or thisDay > daysback then Double.NaN else vpoc;
plot high1 = if showonexpansion and !IsNaN(close) or  thisDay > daysback then Double.NaN else phigh;
plot low1  = if showonexpansion and !IsNaN(close) or  thisDay > daysback then Double.NaN else plow;
plot close1 = if showonexpansion and !IsNaN(close) or  thisDay > daysback then Double.NaN else pclose;
plot mid1  = if showonexpansion and !IsNaN(close) or  thisDay > daysback then Double.NaN else (phigh + plow) / 2;
plot open0 = if showonexpansion and !IsNaN(close) or  thisDay > 0 then Double.NaN else dopen;

tpoc1.SetDefaultColor(Color.RED);
mbpoc1.SetDefaultColor(Color.DARK_ORANGE);
mb1poc1.SetDefaultColor(Color.DARK_ORANGE);
mb2poc1.SetDefaultColor(Color.DARK_ORANGE);
vpoc1.SetDefaultColor(Color.CYAN);
high1.SetDefaultColor(Color.YELLOW);
low1.SetDefaultColor(Color.YELLOW);
close1.SetDefaultColor(Color.MAGENTA);
mid1.SetDefaultColor(Color.YELLOW);
open0.SetDefaultColor(Color.WHITE);

input bubblemover = 5;
def b  = bubblemover;
def b1 = b + 1;
input showbubbles = yes;
AddChartBubble(showbubbles and IsNaN(close[b]) and !IsNaN(close[b1]), tpoc1[b], "TPOC-" + daysback, tpoc1.TakeValueColor());
AddChartBubble(showbubbles and IsNaN(close[b]) and !IsNaN(close[b1]), mbpoc1[b], "MBPOC-" + daysback, mbpoc1.TakeValueColor());
AddChartBubble(showbubbles and IsNaN(close[b]) and !IsNaN(close[b1]), mb1poc1[b], "MBPOC-" + (daysback + 1), mb1poc1.TakeValueColor());
AddChartBubble(showbubbles and IsNaN(close[b]) and !IsNaN(close[b1]), mb2poc1[b], "MBPOC-" + (daysback + 2), mb2poc1.TakeValueColor());
AddChartBubble(showbubbles and IsNaN(close[b]) and !IsNaN(close[b1]), vpoc1[b], "VPOC-" + daysback, vpoc1.TakeValueColor());
AddChartBubble(showbubbles and IsNaN(close[b]) and !IsNaN(close[b1]), high1[b], "H-" + daysback, high1.TakeValueColor());
AddChartBubble(showbubbles and IsNaN(close[b]) and !IsNaN(close[b1]), low1[b], "L-" + daysback, low1.TakeValueColor());
AddChartBubble(showbubbles and IsNaN(close[b]) and !IsNaN(close[b1]), close1[b], "C-" + daysback, close1.TakeValueColor());
AddChartBubble(showbubbles and IsNaN(close[b]) and !IsNaN(close[b1]), mid1[b], "M-" + daysback, mid1.TakeValueColor());
AddChartBubble(showbubbles and IsNaN(close[b]) and !IsNaN(close[b1]), open0[b], "O-" + 0, open0.TakeValueCol
 
I found this code from another post and am trying to insert it so the high and low calculations are from open to close. Currently it includes pre and after market. Can someone help?
#

def rth = SecondsFromTime(0930) >= 0 and SecondsFromTime(1559) <= 0;
plot PrevDayClose;
 

Not the exact question you're looking for?

Start a new thread and receive assistance from our community.

87k+ Posts
272 Online
Create Post

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