Join useThinkScript to post your question to a community of 21,000+ developers and traders.
I found this one on Freestockcharts platform, its from TC2000 I believe.That particular volume profile is not a TOS indicator to my knowledge. It is supposed to show buy/sell volume at each price point. I have never seen that for TOS. The TOS built-in Volume Profile is in studies. Just type profile and profile and several profiles will pop up.
yes its from another platform and have Vol Profile, but would like to get something like this either coded or modify the VolProfile to get something similarThat particular volume profile is not a TOS indicator to my knowledge. It is supposed to show buy/sell volume at each price point. I have never seen that for TOS. The TOS built-in Volume Profile is in studies. Just type profile and profile and several profiles will pop up.
not sure what are showing me here, i asked is they were able to figure out the volume profile,
Ruby:# # TD Ameritrade IP Company, Inc. (c) 2010-2022 # 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 = 100; input emphasizeFirstDigit = no; input markOpenPrice = no; input markClosePrice = no; input volumeShowStyle = MonkeyVolumeShowStyle.all; input showVolumeVA = yes; input showVolumePoc = yes; 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; #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();
ah thank you soo much, hopefully one day TOS has it flipped and to the right just like tradingview, not crazy about the aesthetics of this style plotted on a chart....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.
ah thank you soo much, hopefully one day TOS has it flipped and to the right just like tradingview, not crazy about the aesthetics of this style plotted on a chart....
can help with a small code, im getting confused somehwere,,,See if using the normal volumeprofile showing it with input onExpansion = yes; is what you want
can help with a small code, im getting confused somehwere,,,
AddLabel(Show30DayAvg, "D:"+ Round(volLast30DayAvg, 0), Color.WHITE);
id like to code it to stay red under 1million, dark green when greater than 1million, bright green when over 2million,,
would really help seeing volume on a label when i have a bunch of stocks up on a flex grid watching for breakout
Ruby:input Show30DayAvg = yes; def volLast30DayAvg = 2000100; AddLabel(Show30DayAvg, "D:" + Round(volLast30DayAvg, 0), if volLast30DayAvg < 1000000 then Color.RED else if Between(volLast30DayAvg, 1000000, 2000000) then Color.DARK_GREEN else Color.GREEN);
thank you i will mess with it,,, for some reason its just showing fixed green at D:2,000,100 Even when i switch from ticker to tickerTry this
That is because you did not give me the whole code, so I hard coded amounts in that input to test the addchartbubble code. Just try adding the addchartbubble portion of my code snippet to your code.thank you i will mess with it,,, for some reason its just showing fixed green at D:2,000,100 Even when i switch from ticker to ticker
makes sense, this would be the code,Try this
The modified addlabel (not addchartbubble as mentioned} is now in your code belowmakes sense, this would be the code,
declare lower;
#Inputs
input Show30DayAvg = yes;
input ShowTodayVolume = yes;
input ShowPercentOf30DayAvg = yes;
input UnusualVolumePercent = 200;
input Show30BarAvg = yes;
input ShowCurrentBar = yes;
#Volume Data
def volLast30DayAvg = (volume(period = "DAY")[1] + volume(period = "DAY")[2] + volume(period = "DAY")[3] + volume(period = "DAY")[4] + volume(period = "DAY")[5] + volume(period = "DAY")[6] + volume(period = "DAY")[7] + volume(period = "DAY")[8] + volume(period = "DAY")[9] + volume(period = "DAY")[10] + volume(period = "DAY")[11] + volume(period = "DAY")[12] + volume(period = "DAY")[13] + volume(period = "DAY")[14] + volume(period = "DAY")[15] + volume(period = "DAY")[16] + volume(period = "DAY")[17] + volume(period = "DAY")[18] + volume(period = "DAY")[19] + volume(period = "DAY")[20] + volume(period = "DAY")[21] + volume(period = "DAY")[22] + volume(period = "DAY")[23] + volume(period = "DAY")[24] + volume(period = "DAY")[25] + volume(period = "DAY")[26] + volume(period = "DAY")[27] + volume(period = "DAY")[28] + volume(period = "DAY")[29] + volume(period = "DAY")[30]) / 30;
def today = volume(period = "DAY");
def percentOf30Day = Round((today / volLast30DayAvg) * 100, 0);
#def avg30Bars = VolumeAvg(30).VolAvg;
def avg30Bars = (volume[1] + volume[2] + volume[3] + volume[4] + volume[5] + volume[6] + volume[7] + volume[8] + volume[9] + volume[10] + volume[11] + volume[12] + volume[13] + volume[14] + volume[15] + volume[16] + volume[17] + volume[18] + volume[19] + volume[20] + volume[21] + volume[22] + volume[23] + volume[24] + volume[25] + volume[26] + volume[27] + volume[28] + volume[29] + volume[30]) / 30;
def curVolume = volume;
# Labels
AddLabel(Show30DayAvg, "D:"+ Round(volLast30DayAvg, 0), Color.WHITE);
AddLabel(ShowTodayVolume, "T:"+ today, (if percentOf30Day >= UnusualVolumePercent then Color.GREEN else if percentOf30Day >= 100 then Color.ORANGE else Color.LIGHT_GRAY));
AddLabel(ShowPercentOf30DayAvg, percentOf30Day + "%", (if percentOf30Day >= UnusualVolumePercent then Color.GREEN else if percentOf30Day >= 100 then Color.ORANGE else Color.WHITE) );
AddLabel(Show30BarAvg, "Avg 30 Bars: " + Round(avg30Bars, 0), Color.LIGHT_GRAY);
AddLabel(ShowCurrentBar, "Cur Bar: " + curVolume, (if curVolume >= avg30Bars then Color.GREEN else Color.ORANGE));
Ruby:declare lower; #Inputs input Show30DayAvg = yes; input ShowTodayVolume = yes; input ShowPercentOf30DayAvg = yes; input UnusualVolumePercent = 200; input Show30BarAvg = yes; input ShowCurrentBar = yes; #Volume Data def volLast30DayAvg = (volume(period = "DAY")[1] + volume(period = "DAY")[2] + volume(period = "DAY")[3] + volume(period = "DAY")[4] + volume(period = "DAY")[5] + volume(period = "DAY")[6] + volume(period = "DAY")[7] + volume(period = "DAY")[8] + volume(period = "DAY")[9] + volume(period = "DAY")[10] + volume(period = "DAY")[11] + volume(period = "DAY")[12] + volume(period = "DAY")[13] + volume(period = "DAY")[14] + volume(period = "DAY")[15] + volume(period = "DAY")[16] + volume(period = "DAY")[17] + volume(period = "DAY")[18] + volume(period = "DAY")[19] + volume(period = "DAY")[20] + volume(period = "DAY")[21] + volume(period = "DAY")[22] + volume(period = "DAY")[23] + volume(period = "DAY")[24] + volume(period = "DAY")[25] + volume(period = "DAY")[26] + volume(period = "DAY")[27] + volume(period = "DAY")[28] + volume(period = "DAY")[29] + volume(period = "DAY")[30]) / 30; def today = volume(period = "DAY"); def percentOf30Day = Round((today / volLast30DayAvg) * 100, 0); #def avg30Bars = VolumeAvg(30).VolAvg; def avg30Bars = (volume[1] + volume[2] + volume[3] + volume[4] + volume[5] + volume[6] + volume[7] + volume[8] + volume[9] + volume[10] + volume[11] + volume[12] + volume[13] + volume[14] + volume[15] + volume[16] + volume[17] + volume[18] + volume[19] + volume[20] + volume[21] + volume[22] + volume[23] + volume[24] + volume[25] + volume[26] + volume[27] + volume[28] + volume[29] + volume[30]) / 30; def curVolume = volume; # Labels #AddLabel(Show30DayAvg, "D:"+ Round(volLast30DayAvg, 0), Color.WHITE); AddLabel(Show30DayAvg, "D:" + Round(volLast30DayAvg, 0), if volLast30DayAvg < 1000000 then Color.RED else if Between(volLast30DayAvg, 1000000, 2000000) then Color.DARK_GREEN else Color.GREEN); AddLabel(ShowTodayVolume, "T:"+ today, (if percentOf30Day >= UnusualVolumePercent then Color.GREEN else if percentOf30Day >= 100 then Color.ORANGE else Color.LIGHT_GRAY)); AddLabel(ShowPercentOf30DayAvg, percentOf30Day + "%", (if percentOf30Day >= UnusualVolumePercent then Color.GREEN else if percentOf30Day >= 100 then Color.ORANGE else Color.WHITE) ); AddLabel(Show30BarAvg, "Avg 30 Bars: " + Round(avg30Bars, 0), Color.LIGHT_GRAY); AddLabel(ShowCurrentBar, "Cur Bar: " + curVolume, (if curVolume >= avg30Bars then Color.GREEN else Color.ORANGE));
Thread starter | Similar threads | Forum | Replies | Date |
---|---|---|---|---|
O | compare cumulative volume in a measured move | Questions | 1 | |
D | SPX max move up and down before certain time of day | Questions | 0 | |
N | Move a chart to a cell in flex grid | Questions | 3 | |
S | Move lines to the previous day. | Questions | 1 | |
Calculating Expected Move using ATM Call/Put (Straddle price) | Questions | 1 |
Start a new thread and receive assistance from our community.
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.
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.