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.
@john3 I believe so
##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
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@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?
![]()
An alternative,.......https://tos.mx/N2f9cAA@Huffmac90 You can find the Vwap Z-Score here https://usethinkscript.com/threads/vwap-deviation-z-score-with-chart-and-lower-indicators.602/
Get access to Ben's watchlist, swing trading strategy, ThinkorSwim setup, and trade examples.
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.