Advanced Volume Indicator for ThinkorSwim

Status
Not open for further replies.
@Welkin

I think I figured it out.

I changed "PaintingStrategy.HISTOGRAM" to ".HISTOGRAM" in your code.

Appearance wise, it looks right.

But did I do it correctly? Just want to make sure I didn't mess up your perfect code. Thanks :)

Hc4ms6K.png
 

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

@Welkin

I have a couple of questions:

Question #1: How can I flip the buy (green) and red (sell) colors in each volume bar?

Currently, the buy (green) part is located on the bottom and the red (sell) is on top of the bar.

I want to reverse them (=the buy part goes to the top of the bar & the sell part is on bottom).

Can you guide me where in the code I need to change?

kbz48Ok.png


Question #2: I saw you gave out the code for the cumulative volume between 930 - 1030.

Where can I add the code? I tried to add it (below) at the end of your original code for the indicator, but received the following error message.

nEuAY75.png


The code from #69:

Code:
declare lower;
def T1Start = 0930;
def T1End = 1029;

def NA = Double.NaN;
def conf = SecondsFromTime(T1Start) >= 0 and SecondsFromTime(T1End) <= 0;

def cvolT1 = if conf and !conf[1] then volume else if conf then cvolT1[1] + volume else cvolT1[1];

plot cvol = if conf then cvolT1 else NA;

cvol.SetDefaultColor(Color.YELLOW);
cvol.SetPaintingStrategy(PaintingStrategy.SQUARED_HISTOGRAM);
 
Last edited:
@Welkin

I have a couple of questions:

Question #1: How can I flip the buy (green) and red (sell) colors in each volume bar?

Currently, the buy (green) part is located on the bottom and the red (sell) is on top of the bar.

I want to reverse them (=the buy part goes to the top of the bar & the sell part is on bottom).

Can you guide me where in the code I need to change?

kbz48Ok.png


Question #2: I saw you gave out the code for the cumulative volume between 930 - 1030.

Where can I add the code? I tried to add it (below) at the end of your original code for the indicator, but received the following error message.

nEuAY75.png


The code from #69:

Code:
declare lower;
def T1Start = 0930;
def T1End = 1029;

def NA = Double.NaN;
def conf = SecondsFromTime(T1Start) >= 0 and SecondsFromTime(T1End) <= 0;

def cvolT1 = if conf and !conf[1] then volume else if conf then cvolT1[1] + volume else cvolT1[1];

plot cvol = if conf then cvolT1 else NA;

cvol.SetDefaultColor(Color.YELLOW);
cvol.SetPaintingStrategy(PaintingStrategy.SQUARED_HISTOGRAM);
here you go, this should have the changes you wanted:
http://tos.mx/cas8sK8

also the cumulative vol is best left as a separate script, because when it plots it'll skew the normal volume data too much and make it difficult to read.
 
@Welkin Thank you for all you do! This is really good stuff!

I have a question.....If I just wanted to pull out the Sigma 1, Sigma 2 and Sigma 3 concept from this script, what would that portion of the script look like?

In other words, I would just want to see the 3 lines (average (blue), sigma 2 (orange) and sigma 3 (magenta) on a regular volume graph and a label telling me which line it is on. Would want this to work for any timeframe (1M to D)

Hope this makes sense. Thank you for your time!
 
@Welkin Thank you for all you do! This is really good stuff!

I have a question.....If I just wanted to pull out the Sigma 1, Sigma 2 and Sigma 3 concept from this script, what would that portion of the script look like?

In other words, I would just want to see the 3 lines (average (blue), sigma 2 (orange) and sigma 3 (magenta) on a regular volume graph and a label telling me which line it is on. Would want this to work for any timeframe (1M to D)

Hope this makes sense. Thank you for your time!
this should do it
Code:
declare on_volume;
input AvgVolLength = 20;
input VolAverageType = AverageType.SIMPLE;
input ShowLabel = yes;
DefineGlobalColor("VolAvg", CreateColor(0, 100, 200));
DefineGlobalColor("Sigma2", Color.DARK_ORANGE);
DefineGlobalColor("Sigma3", Color.MAGENTA);
def Vol = volume;
plot VolAvg = MovingAverage(VolAverageType, Vol, AvgVolLength);
#2Sigma and 3Sigma Vol Filter
def Num_Dev1 = 2.0;
def Num_Dev2 = 3.0;
def averageType = AverageType.SIMPLE;
def sDev = StDev(data = Vol, length = AvgVolLength);
plot VolSigma2 = VolAvg + Num_Dev1 * sDev;
plot VolSigma3 = VolAvg + Num_Dev2 * sDev;
def avgtest = Vol > VolAvg;
def sig2test = Vol > VolSigma2;
def sig3test = Vol > VolSigma3;

VolAvg.SetDefaultColor(GlobalColor("VolAvg"));
VolSigma2.SetDefaultColor(GlobalColor("Sigma2"));
VolSigma3.SetDefaultColor(GlobalColor("Sigma3"));
AddLabel(ShowLabel, if sig3test then "     Vol > Sigma3     " else if sig2test then "     Vol > Sigma2     " else if avgtest then "    Vol > Avg     " else "                  ", if sig3test then GlobalColor("Sigma3") else if sig2test then GlobalColor("Sigma2") else if avgtest then GlobalColor("VolAvg") else Color.DARK_GRAY);
 
Status
Not open for further replies.

Similar threads

Not the exact question you're looking for?

Start a new thread and receive assistance from our community.

87k+ Posts
516 Online
Create Post

Similar threads

Similar threads

The Market Trading Game Changer

Join 2,500+ subscribers inside the useThinkScript VIP Membership Club
  • Exclusive indicators
  • Proven strategies & setups
  • Private Discord community
  • ‘Buy The Dip’ signal alerts
  • Exclusive members-only content
  • Add-ons and resources
  • 1 full year of unlimited support

Frequently Asked Questions

What is useThinkScript?

useThinkScript is the #1 community of stock market investors using indicators and other tools to power their trading strategies. Traders of all skill levels use our forums to learn about scripting and indicators, help each other, and discover new ways to gain an edge in the markets.

How do I get started?

We get it. Our forum can be intimidating, if not overwhelming. With thousands of topics, tens of thousands of posts, our community has created an incredibly deep knowledge base for stock traders. No one can ever exhaust every resource provided on our site.

If you are new, or just looking for guidance, here are some helpful links to get you started.

What are the benefits of VIP Membership?
VIP members get exclusive access to these proven and tested premium indicators: Buy the Dip, Advanced Market Moves 2.0, Take Profit, and Volatility Trading Range. In addition, VIP members get access to over 50 VIP-only custom indicators, add-ons, and strategies, private VIP-only forums, private Discord channel to discuss trades and strategies in real-time, customer support, trade alerts, and much more. Learn all about VIP membership here.
How can I access the premium indicators?
To access the premium indicators, which are plug and play ready, sign up for VIP membership here.
Back
Top