NexusFi: Find Your Edge


Home Menu

 





Is it possible to group the MonkeyBars chart to display a week?


Discussion in ThinkOrSwim

Updated
      Top Posters
    1. looks_one Massive l with 7 posts (12 thanks)
    2. looks_two Yakito with 4 posts (0 thanks)
    3. looks_3 Lady with 3 posts (0 thanks)
    4. looks_4 MNSTrading with 1 posts (0 thanks)
    1. trending_up 5,824 views
    2. thumb_up 12 thanks given
    3. group 6 followers
    1. forum 14 posts
    2. attach_file 0 attachments




 
Search this Thread

Is it possible to group the MonkeyBars chart to display a week?

  #1 (permalink)
Yakito
Buenos Aires, Argentina
 
Posts: 47 since Jun 2013
Thanks Given: 39
Thanks Received: 4

Hello,

I been trying unsuccessfully to make a money bar chart grouped into weeks where each letter (or number in TOS) represents 1 hour.

I can't seem to be able to group the chart in anything else besides days, months and years.

Any tip? Thanks!

Reply With Quote

Can you help answer these questions
from other members on NexusFi?
Exit Strategy
NinjaTrader
REcommedations for programming help
Sierra Chart
Pivot Indicator like the old SwingTemp by Big Mike
NinjaTrader
PowerLanguage & EasyLanguage. How to get the platfor …
EasyLanguage Programming
MC PL editor upgrade
MultiCharts
 
Best Threads (Most Thanked)
in the last 7 days on NexusFi
Spoo-nalysis ES e-mini futures S&P 500
29 thanks
Just another trading journal: PA, Wyckoff & Trends
25 thanks
Tao te Trade: way of the WLD
24 thanks
Bigger Wins or Fewer Losses?
21 thanks
GFIs1 1 DAX trade per day journal
16 thanks
  #2 (permalink)
 
Massive l's Avatar
 Massive l 
OR/USA
Legendary /NQ Trader
 
Experience: None
Posts: 2,129 since Mar 2011
Thanks Given: 1,859
Thanks Received: 5,106

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

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

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 = getYear() - first(getYear());
}

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

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();
You can change "Show Volume Style" in the input panel to "ALL" from "NONE" if you want the volume profile shown with the TPO.
Also, the aggregation period looks better on 5 minute rather than 1hr.

Visit my NexusFi Trade Journal Reply With Quote
Thanked by:
  #3 (permalink)
 
Massive l's Avatar
 Massive l 
OR/USA
Legendary /NQ Trader
 
Experience: None
Posts: 2,129 since Mar 2011
Thanks Given: 1,859
Thanks Received: 5,106


15min charts - weekly profile 5 min aggregation
[img]https://nexusfi.com/v/5ffvhv.png[/img]
[img]https://nexusfi.com/v/eeppnc.png[/img]
1hr chart - weekly profile 5 min aggregation with volume profile added
[img]https://nexusfi.com/v/9ndnsa.png[/img]

Visit my NexusFi Trade Journal Reply With Quote
Thanked by:
  #4 (permalink)
Yakito
Buenos Aires, Argentina
 
Posts: 47 since Jun 2013
Thanks Given: 39
Thanks Received: 4

Thats exactly what I was looking for. Thanks a lot for your help! I don't know why I was not able to find it!

Reply With Quote
  #5 (permalink)
Yakito
Buenos Aires, Argentina
 
Posts: 47 since Jun 2013
Thanks Given: 39
Thanks Received: 4

by the way, you developed that code or it is publicly available somewhere I am missing? Thanks again for your help

Reply With Quote
  #6 (permalink)
 
Massive l's Avatar
 Massive l 
OR/USA
Legendary /NQ Trader
 
Experience: None
Posts: 2,129 since Mar 2011
Thanks Given: 1,859
Thanks Received: 5,106

It's part of the monkey bar code tos already has. I just changed the parameters inside the code so you didn't have to change much.
By the way, the va high and va low (playground) is at the 2nd standard deviation which is a preference of mine. The 1st one doesn't mean
much to me but it's the default on almost every profile you'll see. You can change it back by changing the setting to 70 from 95.

Visit my NexusFi Trade Journal Reply With Quote
Thanked by:
  #7 (permalink)
Yakito
Buenos Aires, Argentina
 
Posts: 47 since Jun 2013
Thanks Given: 39
Thanks Received: 4

Thanks again. I saw the difference in the standard deviation, I will leave it at 95 and make some tests, maybe it helps my trading.

I never used the profile in anything besides intraday so I am not sure if the logic still works with different timeframes. I imagine it would be more difficult to understand who is who on a weekly or monthly chart.

Reply With Quote
  #8 (permalink)
 
Massive l's Avatar
 Massive l 
OR/USA
Legendary /NQ Trader
 
Experience: None
Posts: 2,129 since Mar 2011
Thanks Given: 1,859
Thanks Received: 5,106

I predominately use a 6hr chart with 1 and 3 month profiles and hold anywhere
from 2 days to 2 months.

Visit my NexusFi Trade Journal Reply With Quote
Thanked by:
  #9 (permalink)
 Lady 
Medellín, CO
 
Experience: Intermediate
Platform: NinjaTrader
Trading: Playing with eMinis, coming from Options
Posts: 83 since Jun 2015
Thanks Given: 14
Thanks Received: 43


Massive l View Post
15min charts - weekly profile 5 min aggregation
[img]https://nexusfi.com/v/5ffvhv.png[/img]
[img]https://nexusfi.com/v/eeppnc.png[/img]
1hr chart - weekly profile 5 min aggregation with volume profile added
[img]https://nexusfi.com/v/9ndnsa.png[/img]



Let me ask you a stupid question. My 4k resolution screen is not really showing the vertical lines. Would you know how to change the weight/width of those to be more visible?

Reply With Quote
  #10 (permalink)
 
Massive l's Avatar
 Massive l 
OR/USA
Legendary /NQ Trader
 
Experience: None
Posts: 2,129 since Mar 2011
Thanks Given: 1,859
Thanks Received: 5,106



Lady View Post
Let me ask you a stupid question. My 4k resolution screen is not really showing the vertical lines. Would you know how to change the weight/width of those to be more visible?

Which vertical lines are you referring to?

Visit my NexusFi Trade Journal Reply With Quote




Last Updated on May 25, 2021


© 2024 NexusFi™, s.a., All Rights Reserved.
Av Ricardo J. Alfaro, Century Tower, Panama City, Panama, Ph: +507 833-9432 (Panama and Intl), +1 888-312-3001 (USA and Canada)
All information is for educational use only and is not investment advice. There is a substantial risk of loss in trading commodity futures, stocks, options and foreign exchange products. Past performance is not indicative of future results.
About Us - Contact Us - Site Rules, Acceptable Use, and Terms and Conditions - Privacy Policy - Downloads - Top
no new posts