Question about Volume Profile in ThinkorSwim

Shinthus

Shinthus

Member
VIP
Hey all. Someone mentioned that TOS's volume profile study was basically Center of Gravity (COG). I forget who and where this was said - can someone please confirm or refute?

Also, I noticed the way Volume Profile is calculated on TOS is different than how it's calculated on Tradingview but I don't use Tradingview because I would rather not pay for indicators.... I also took a liking to Tradinview's version and find it more accurate and easier to interpret. Does anybody know the calc difference and whether or not we can convert that from pinescript to TOS?
 
markos

markos

Well-known member
VIP
Warehouse
Hey @Shinthus I use Tradingview when I'm at work. I don't pay for indicators with the free account, Just pop up adds that go away after a while.
They have a built in Chop Indicator and a Standard RSI Laguerre along with 2 EMA's. That's all they allow but I don't need anymore. 👍

People sometimes change word meanings and associate them with similar things. Right below this post is Mobius' post on TPO. It's basically the same thing.
ToS's built in Volume Profile is correct according to Professor Jeff Bierman, CTA. He worked as the chief market technician for ToS for 5 years before the buyout by TDA.
Keep in mind, just like the Fractal Energy Indicator is similar to the Chop Indicator even though the math constructs are different.
There is at least 1 if not 2 COG's in the Onenote. One of them seems quite different. Let us know what you find.

Here's One:


IT's THE GRAIL!!! (For trendless Markets) along with ADX

 
markos

markos

Well-known member
VIP
Warehouse
Code:
#VolumeProfile_RTHvOvernight
#JoeBone87 in TSL May 2019 (No Guarantee it will plot but math should be good)

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

input rthbegin  = 0930;
input rthend    = 1600;
def count = secondsfromTime(rthbegin)>0 and secondstillTime(rthend)>0;
def cond = count != count[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;

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

vol.Show(GlobalColor("Profile"), if showPointOfControl then GlobalColor("Point Of Control") else Color.CURRENT, if showValueArea then GlobalColor("Value Area") else Color.CURRENT, opacity);
POC.SetDefaultColor(GlobalColor("Point Of Control"));
POC.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
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();

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

John808

New member
VIP
Hi @Shinthus, here is another cog indicator https://usethinkscript.com/threads/center-of-gravity-cog-indicator-for-thinkorswim.138/ I think this might be the cog indicator you're looking for if you were in bluesgirl's chatroom. (I'm in the same room :) That's similar to what she uses. From what I understand with the cog indicator is you want to play the edges and also look at the curves of the waves. So if the waves are starting to curl up price may have found a bottom and start to move up. Maybe similar to boillinger bands.

As for volume profile here is a picture of the study I use on TOS. It looks at the volume profile for every individual day, so the levels are pretty much the same across all time frames. I can post the settings I have if you're interested :)


I like to mark off the Value area Highs/Lows (the yellow lines) and the point of control (red line). I use these lines as support/resistance and targets for the next day.



Hopefully this helps.
 
Last edited by a moderator:
Shinthus

Shinthus

Member
VIP
Hi @Shinthus, here is another cog indicator https://usethinkscript.com/threads/center-of-gravity-cog-indicator-for-thinkorswim.138/ I think this might be the cog indicator you're looking for if you were in bluesgirl's chatroom. (I'm in the same room :) That's similar to what she uses. From what I understand with the cog indicator is you want to play the edges and also look at the curves of the waves. So if the waves are starting to curl up price may have found a bottom and start to move up. Maybe similar to boillinger bands.

As for volume profile here is a picture of the study I use on TOS. It looks at the volume profile for every individual day, so the levels are pretty much the same across all time frames. I can post the settings I have if you're interested :)


I like to mark off the Value area Highs/Lows (the yellow lines) and the point of control (red line). I use these lines as support/resistance and targets for the next day.



Hopefully this helps.
Haha you guessed it. I was in Bluesgirl's chatroom until I didn't pay the monthly sub fee. I'm not sure I can make use of the daily volume profile but thanks for showing it to me. What are those fancy-named lines on the bottom chart? And thanks for the COG indicator! Checking it out now.
 
Last edited by a moderator:
Shinthus

Shinthus

Member
VIP
Hey @Shinthus I use Tradingview when I'm at work. I don't pay for indicators with the free account, Just pop up adds that go away after a while.
They have a built in Chop Indicator and a Standard RSI Laguerre along with 2 EMA's. That's all they allow but I don't need anymore. 👍

People sometimes change word meanings and associate them with similar things. Right below this post is Mobius' post on TPO. It's basically the same thing.
ToS's built in Volume Profile is correct according to Professor Jeff Bierman, CTA. He worked as the chief market technician for ToS for 5 years before the buyout by TDA.
Keep in mind, just like the Fractal Energy Indicator is similar to the Chop Indicator even though the math constructs are different.
There is at least 1 if not 2 COG's in the Onenote. One of them seems quite different. Let us know what you find.

Here's One:


IT's THE GRAIL!!! (For trendless Markets) along with ADX

I've been rummaging thru the Onenote and can't find it. Do you have the link? Thanks for sharing this, btw.
 
markos

markos

Well-known member
VIP
Warehouse
I've been rummaging thru the Onenote and can't find it. Do you have the link? Thanks for sharing this, btw.
Which one? the TPO is already posted in this forum.
Ehler's is under 03 Technicals>Trend and another under Momentum.
* Onenote has a stand alone 2016 app where the search really works. No more rummaging!

If your onenote isn't behaving, let me know, tell me the one you want, i'll get the link.
 
J

John808

New member
VIP
oh, all of those lines are hand-drawn lol. With Volume profile, there's a concept called VPOC or virgin point of control, which means if a point of control(the red line) hasn't been tested the next day after it's been made, the price will naturally trend towards it. The "put" target level was the value area high from 8/9/19, the same day the VPOC level is from. I'm still practicing with volume profile, but I like it so far.
 
ImKidKid

ImKidKid

New member
VIP
Hey @John808 can you share these settings i like this setup!
 
L

lindosskier

New member
Hi guys,

New here to the forum, but had a few questions regarding thinkscript for VolumeProfile in TOS.
I know there is a study there already, but I need to change it a bit to fit my needs.

1)How can I be showing ALL the Weekly VOLUMEPROFILES On the chart (For all the Weeks on the chart)? When I click "No" in the Expansion input, it shows me all the VolumeProfiles, but it plots them on their respective Weeks' charts, when I need them to show next week's one (for each one of them - One period forward, so it can serve as support or resistance for next week). - You can take a look at Market Webs and/or Christian Fromhertz from Tribeca Trade Group (active on twitter)
2)How can I be having the Monthly Volume Profile shown when I have the Weekly Chart Up, the Weekly Volume profile shown when I have the Daily Chart up and the Daily Volume profile shown when I have the 60min. Chart up? and
3)On each of the respective charts above, I would need to see the POC plotted, UNTIL the price hits it again in the future (Virgin Point of Control).
So, for the Weekly chart the Monthly POC, for the Daily Chart the Weekly POC and for the 60min. chart the Daily POC to be carrying forward, until price hits them in the future.
How can I do that?


Thanks in advance for your help.
 
X

XeoNoX

New member
i hand typed the COG Center of Gravity code for TOS ( thinkorswim ) thinkscript indicator study that was posted above, since i cant copy and paste the picture. Here it is in easier copy and paste format. Please keep entire code intact.

Code:
# Ehlers_COG (Center Of Gravity)
# by growex
# Posted by: Mobius
# 12.18.2017
# Mobius: Someone was asking for a COG study with bands. Cog is an
# unbounded oscillartor as designed by Ehlers. It would need to be
# normalized to the price chart to have bands. Otherwise a 1 bar
# lag on the oscillator gives very good signals. COG is 1 weighted
# average shifted backwards to their center of lag or balance thus
# the name. I was picturing the lagged second line or signal line
# as the second of two but that's actually the same WAVG just
# lagged one bar
#
# Mobius: This study is an accurate translation of Ehlers Center
# Of Gravity.

declare lower;

input price = hl2;
input length = 10;

def Num = fold i = 0 to length -1
with n
do n + (1 + i) * getvalue(price, i , length - 1);
def denom = fold j = 0 to length -1
with k
do k + getvalue(price, j, length -1);
def CG = if denom <> 0 then -Num/Denom else double.NaN;

plot cgline = cg;
cgline.SetDefaultColor(color.green);
plot trigger = cgline[1];
trigger.setdefaultcolor(color.red);
addcloud(cgline, trigger, color.green, color.red);

#End Code Ehlers Center Of Gravity
 
T

tomsk

Well-known member
VIP
Warehouse
Here is what I thought was a cool COG (Center of Gravity) study that someone posted in the lounge several years ago. I happened to find it in my files, thought I'd share it with the community

Code:
# Adaptive COG
# califj
# 8.5.2017

input price = close;
input CenterLine = 30;
def bar = CenterLine;

input CenterLine2 = 60;
input CenterLine3 = 100;
def length = -bar;

def displacement = (length / 2) + 1;
def dPrice = price[displacement];

def CMA = if !IsNaN(dPrice) then Average(dPrice, AbsValue(length)) else CMA[1] + (CMA[1] - CMA[2]);
def CenteredMA = if !IsNaN(price) then ExpAverage(CMA, bar) else Double.NaN;

plot Center =  CenteredMA;
Center.SetDefaultColor(Color.CYAN);
Center.SetStyle(Curve.SHORT_DASH);
plot Center2 =  if !IsNaN(price) then ExpAverage(CMA, CenterLine2) else Double.NaN;
Center2.SetDefaultColor(Color.LIME);
Center2.SetStyle(Curve.SHORT_DASH);
plot Center3 =  if !IsNaN(price) then ExpAverage(CMA, CenterLine3) else Double.NaN;
Center3.SetDefaultColor(Color.MAGENTA);
Center3.SetStyle(Curve.SHORT_DASH);

def pct = 100;
input width = 75;
def d = width / pct;
def d1 = 0.809 * d;
def d2 = 1.0 * d;
def d3 = 1.618 * d;
def stdDeviation = HighestAll("data" = AbsValue(CenteredMA - price));

plot UpperLine = CenteredMA + stdDeviation * d1;
plot LowerLine = CenteredMA - stdDeviation * d1;
plot UpperLine1 = CenteredMA + stdDeviation * d2;
plot LowerLine1 = CenteredMA - stdDeviation * d2;
plot UpperLine2 = CenteredMA + stdDeviation * d3;
plot LowerLine2 = CenteredMA - stdDeviation * d3;

UpperLine.SetDefaultColor(Color.GRAY);
UpperLine1.SetDefaultColor(Color.LIGHT_RED);
UpperLine2.SetDefaultColor(Color.RED);
LowerLine.SetDefaultColor(Color.GRAY);
LowerLine1.SetDefaultColor(Color.LIGHT_GREEN);
LowerLine2.SetDefaultColor(Color.GREEN);

def crossup = close > center and center2;
def crossdn = close < center and center2;
AddLabel(crossup, " crosses above", Color.GREEN);
AddLabel(crossdn, " crosses below", Color.RED);

Alert(Crosses(high, UpperLine2, CrossingDirection.ABOVE), " price crosses over upper line2!");
Alert(Crosses(low, LowerLine2, CrossingDirection.BELOW), " price crosses over lower line2!");

AddCloud(close, Center, Color.GREEN, Color.RED);
AddCloud(UpperLine, UpperLine1, Color.PINK, Color.PINK);
AddCloud(LowerLine, LowerLine1, Color.LIGHT_GREEN, Color.LIGHT_GREEN);

AddCloud(UpperLine2, UpperLine1, Color.RED, Color.RED);
AddCloud(LowerLine2, LowerLine1, Color.GREEN, Color.GREEN);
def bound1 = HighestAll(high) * 2;
def bound2 = LowestAll(low) / 2;
def cond1 = (close crosses below UpperLine1);
def cond2 = (close crosses above LowerLine1);

AssignPriceColor(if close > center and center2 and center3 then Color.BLUE else if close < center and center2 and center3 then Color.DARK_ORANGE else Color.GRAY);
 

Top