Volatility Box Indicator for ThinkorSwim

New Indicator: Buy the Dip

Check out our Buy the Dip indicator and see how it can help you find profitable swing trading ideas. Scanner, watchlist columns, and add-ons are included.

Download the indicator

If it uses a volume profile, post #41, maybe it doesn't really repaint, it just changes because a volume profile is dynamic.
 
My latest swag on the V-Box script. Not really interested in this anymore though because I was able to complete a code that works much better for my strategy. This has to be adjusted to fit the different timeframes so maybe combining @tradegeek's posted code and this will give you the desired effect.

Code:
##code base from TOS TPO and multiple codes from the OneNote page.

#VM_Drummond_61_Channel
#VM_Drummond_RS_Zones

declare upper;
input showlines             = yes;
input pricePerRowHeightMode = { AUTOMATIC, default TICKSIZE, CUSTOM};
input customRowHeight       = .01;
input timePerProfile        = {CHART, MINUTE, MIN2, MIN3, MIN4, MIN5, MIN10,  default  MIN15, MIN20,  MIN30, HOUR, TWOHOUR, FOURHOUR, DAY , TWODAY, THREEDAY, FOURDAY, WEEK, MONTH, "OPT EXP", BAR};
input timePerProfile2        = {CHART, MINUTE, MIN2, MIN3, MIN4, MIN5, MIN10,  default  MIN15, MIN20,  MIN30, HOUR, TWOHOUR, FOURHOUR, DAY , TWODAY, THREEDAY, FOURDAY, WEEK, MONTH, "OPT EXP", BAR};
input multiplier         = 1.0;
input onExpansion        = no;
input profiles           = 1000;
input showPointOfControl = yes;
input showValueArea      = yes;
input valueAreaPercent   = 100.0;
input valueAreaPercent2  = 87.5;
input opacity            = 99;

def period;
def agg;
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);
switch (timePerProfile) {

case CHART:
    period = 0;
    agg = AggregationPeriod.DAY;

case MINUTE:
    period = Floor(seconds / 60 + day_number * 24 * 60);
    agg = AggregationPeriod.MIN;

case MIN2:
    period = Floor(seconds / 120 + day_number * 24);
    agg = AggregationPeriod.TWO_MIN;

case MIN3:
    period = Floor(seconds / 180 + day_number * 24);
    agg = AggregationPeriod.THREE_MIN;

case MIN4:
    period = Floor(seconds / 240 + day_number * 24);
    agg = AggregationPeriod.FOUR_MIN;

case MIN5:
    period = Floor(seconds / 300 + day_number * 24);
    agg = AggregationPeriod.FIVE_MIN;

case MIN10:
    period = Floor(seconds / 600 + day_number * 24);
    agg = AggregationPeriod.TEN_MIN;

case MIN15:
    period = Floor(seconds / 900 + day_number * 24);
    agg = AggregationPeriod.FIFTEEN_MIN;

case MIN20:
    period = Floor(seconds / 1200 + day_number * 24);
    agg = AggregationPeriod.TWENTY_MIN;

case MIN30:
    period = Floor(seconds / 1800 + day_number * 24);
    agg = AggregationPeriod.THIRTY_MIN;

case HOUR:
    period = Floor(seconds / 3600 + day_number * 24);
    agg = AggregationPeriod.HOUR;

case TWOHOUR:
    period = Floor(seconds / 7200 + day_number * 24);
    agg = AggregationPeriod.TWO_HOURS;

case FOURHOUR:
    period = Floor(seconds / 14400 + day_number * 24);
    agg = AggregationPeriod.FOUR_HOURS;

case DAY:
    period = CountTradingDays(Min(First(yyyymmdd), yyyymmdd), yyyymmdd) - 1;
    agg = AggregationPeriod.DAY;

case TWODAY:
    period = CountTradingDays(Min(First(yyyymmdd), yyyymmdd), yyyymmdd) - 1;
    agg = AggregationPeriod.TWO_DAYS;

case THREEDAY:
    period = CountTradingDays(Min(First(yyyymmdd), yyyymmdd), yyyymmdd) - 1;
    agg = AggregationPeriod.THREE_DAYS;

case FOURDAY:
    period = CountTradingDays(Min(First(yyyymmdd), yyyymmdd), yyyymmdd) - 1;
    agg = AggregationPeriod.FOUR_DAYS;

case WEEK:
    period = Floor(day_number / 7);
    agg = AggregationPeriod.WEEK;
case MONTH:
    period = Floor(month - First(month));
    agg = AggregationPeriod.MONTH;

case "OPT EXP":
    period = exp_opt - First(exp_opt);
    agg = AggregationPeriod.DAY;

case BAR:
    period = BarNumber() - 1;
    agg = AggregationPeriod.DAY;
}



input price = close;
input displace = 0;
input length = 20;
input Num_Dev_Dn = -1.9;
input Num_Dev_Dn1 = -2.9;
input Num_Dev_Dn2 = -3.9;
input Num_Dev_Dn3 = -4.9;
input Num_Dev_Dn4 = -5.9;
input Num_Dev_up = 1.9;
input Num_Dev_up1 = 2.9;
input Num_Dev_up2 = 3.9;
input Num_Dev_up3 = 4.9;
input Num_Dev_up4 = 5.9;
input averageType = AverageType.HULL;

def sDev = StDev(data = price[-displace], length = length);

#DrummondChannel
def o = open(period = agg);
def h = high(period = agg);
def l = low(period = agg);
def c = close(period = agg);
def HMA = MovingAverage(AverageType.HULL, price, length)[displace];
plot Hull = HMA;


#====1-1Channel====
def y = HMA - AbsValue(h[1] - HMA);
def x = HMA + AbsValue(HMA - l[1]);
plot res = x;
plot sup = y;

plot LowerBand = y + Num_Dev_Dn * sDev;
plot UpperBand = x + Num_Dev_up * sDev;
plot LowerBand1 = y + Num_Dev_Dn1 * sDev;
plot UpperBand1 = x + Num_Dev_up1 * sDev;
plot LowerBand2 = y + Num_Dev_Dn2 * sDev;
plot UpperBand2 = x + Num_Dev_up2 * sDev;
plot LowerBand3 = y + Num_Dev_Dn3 * sDev;
plot UpperBand3 = x + Num_Dev_up3 * sDev;
plot LowerBand4 = y + Num_Dev_Dn4 * sDev;
plot UpperBand4 = x + Num_Dev_up4 * sDev;

LowerBand4.SetDefaultColor(Color.GREEN);
LowerBand3.SetDefaultColor(Color.GREEN);
LowerBand2.SetDefaultColor(Color.GREEN);
LowerBand1.SetDefaultColor(Color.GREEN);
LowerBand.SetDefaultColor(Color.GREEN);
UpperBand.SetDefaultColor(Color.RED);
UpperBand1.SetDefaultColor(Color.RED);
UpperBand2.SetDefaultColor(Color.RED);
UpperBand3.SetDefaultColor(Color.RED);
UpperBand4.SetDefaultColor(Color.RED);

Hull.DefineColor("Up", Color.GREEN);
Hull.DefineColor("Down", Color.RED);
Hull.AssignValueColor(if HMA > HMA[1] then Hull.Color("Up") else Hull.Color("Down"));

AddCloud(LowerBand3, LowerBand4, Color.GREEN);
AddCloud(LowerBand1, LowerBand3, Color.DARK_GREEN);
AddCloud(UpperBand4, UpperBand3, Color.RED);
AddCloud(UpperBand3, UpperBand1, Color.DARK_RED);

input AtrMult = 1.0;
input nATR = 4;
input AvgType = AverageType.HULL;
input PaintBars = yes;
def ATR = MovingAverage(AvgType, TrueRange(high, close, low), nATR);
def UP = HL2 + (AtrMult * ATR);
def DN = HL2 + (-AtrMult * ATR);
def ST = if close < ST[1] then UP else DN;
plot SuperTrend = ST;
SuperTrend.AssignValueColor(if close < ST then Color.RED else Color.GREEN);
AssignPriceColor(if PaintBars and close < ST then Color.RED else if PaintBars and close > ST then Color.GREEN else Color.CURRENT);

# End Code SuperTrend
 
@Huffmac90 This indicator looks really cool. Can you confirm that it's not showing the top and bottom line after the fact? Looking at the 20d 15m. I have yet to find a single false signal. This usually mean the indicator will repaint or delay. You said you're currently using it. Can you confirm its not?

gIIG1vC.png
i noticed so many codes in this thread and i got a bit confused on which one is corresponding with this chart. any chance i can get the tos link plzzzz
 
I did a little experimenting with the Volatility Box that tradegeek posted and that one also repaints. I have watched a few of TOSindicators youtube videos and I was impressed with how accurate their recaps seemed. Now I am not so sure this indicator will actually work in real time.


The first picture I tracked the cloud movement from the beginning of the hour to where it ended up at the end of the hour. The second picture shows what would have been an entry if you looked at it at the end of the day but in real time the blue entry line was dragged down to the candle by the price dropping lower throughout the hour.
 
It will be subject to box re-calculations (repaints) at time. the higher the time frame, less volatility. it's using the high and low + a pivot point or gravity point calculated, probably at a weekly timeframe.
 
Last edited by a moderator:
@john3 A snippet was shared on here. It was reported due to the indicator being a premium product. We had to take it down. But based on what @diazlaz was saying, this seems to be a repainting indicator.
 
@diazlaz If you have watched any of the early videos of this indicator, first I don't remember seeing directional arrows, never longer than 1-5 minute chart, and several times price blows through bands,......it will help all if you learn to read price......
 
@john3
@Thomas
@barbaros

As @BenTen stated above in post 61, what was posted earlier was premium code. I subscribed to the Volatility Box for quite a while and can assure you that it's no holy grail. It may provide a clean chart layout but it's not a complete trading system. You need additional confirmation at the pivot points and some basic knowledge of price action. The creator of the indicator is a nice guy. His product just didn't help me win trades.

For what it's worth, I overlaid the Volatility Box with numerous indicators available on this site. @horserider 's SD bands were a very close approximation.

Best wishes.
 
@Trader Raider Would you please link that SD bands code?

Thank you for the clarification. I did not realize that BenTen was talking about the Volatility Box code, I thought Diazlaz has made a replica.
 
Hi Everyone - not sure if I have it anymore, I believe this was VB box shared in this thread and the CSA that been released. I will check to see if i still have that grid saved.
 

Volatility Trading Range

VTR is a momentum indicator that shows if a stock is overbought or oversold based on its Weekly and Monthly average volatility trading range.

Download the indicator

Similar threads

Not the exact question you're looking for?

Start a new thread and receive assistance from our community.

87k+ Posts
380 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