# TheoTrade_Comparative_QuanTicks
# Mobius Dev
# Copyright TheoTrade LLC
# V03.25.2017
declare lower;
input closeTime = 1555;
input labelOffset = 5;
input showFloatingLabels = yes;
def openTime = 0930;
def rawTickData1 = hlc3("$TICK");
def rawTickData2 = hlc3("$TIKRL");
def rawTickData3 = hlc3("$TIKSP");
def rawTickData4 = hlc3("$TICK/Q");
def maxTick1 = close("$ADVN") + close("$DECN") + close("$UNCN");
def maxTick2 = close("$ADVRL") + close("$DECLRL") + close("$UNCHRL");
def maxTick3 = close("$ADVSP") + close("$DECLSP") + close("$UNCHSP");
def maxTick4 = close("$ADVN/Q") + close("$DECN/Q") + close("$UNCN/Q");
def TickData1 = rawTickData1 / maxTick1;
def TickData2 = rawTickData2 / maxTick2;
def TickData3 = rawTickData3 / maxTick3;
def TickData4 = rawTickData4 / maxTick4;
def CT1 = if GetDay() != GetDay()[1]
then 0
else if SecondsTillTime(openTime) <= 0 and
SecondsTillTime(closeTime) >= 0
then CT1[1] + TickData1
else 0;
plot cumulativeTick1 = if !IsNaN(TickData1) and
CT1 <> 0
then CT1
else Double.NaN;
def CT2 = if GetDay() != GetDay()[1]
then 0
else if SecondsTillTime(openTime) <= 0 and
SecondsTillTime(closeTime) >= 0
then CT2[1] + TickData2
else 0;
plot cumulativeTick2 = if !IsNaN(TickData2) and
CT2 <> 0
then CT2
else Double.NaN;
def CT3 = if GetDay() != GetDay()[1]
then 0
else if SecondsTillTime(openTime) <= 0 and
SecondsTillTime(closeTime) >= 0
then CT3[1] + TickData3
else 0;
plot cumulativeTick3 = if !IsNaN(TickData3) and
CT3 <> 0
then CT3
else Double.NaN;
def CT4 = if GetDay() != GetDay()[1]
then 0
else if SecondsTillTime(openTime) <= 0 and
SecondsTillTime(closeTime) >= 0
then CT4[1] + TickData4
else 0;
plot cumulativeTick4 = if !IsNaN(TickData4) and
CT4 <> 0
then CT4
else Double.NaN;
plot CT1DownTick = if cumulativeTick1 < cumulativeTick1[1]
then cumulativeTick1
else Double.NaN;
CT1DownTick.SetPaintingStrategy(PaintingStrategy.Points);
CT1DownTick.SetDefaultColor( color.white);
CT1DownTick.SetLineWeight(1);
CT1DownTick.HideBubble();
plot CT2DownTick = if cumulativeTick2 < cumulativeTick2[1]
then cumulativeTick2
else Double.NaN;
CT2DownTick.SetPaintingStrategy(PaintingStrategy.Points);
CT2DownTick.SetDefaultColor( color.white);
CT2DownTick.SetLineWeight(1);
CT2DownTick.HideBubble();
plot CT3DownTick = if cumulativeTick3 < cumulativeTick3[1]
then cumulativeTick3
else Double.NaN;
CT3DownTick.SetPaintingStrategy(PaintingStrategy.Points);
CT3DownTick.SetDefaultColor( color.white);
CT3DownTick.SetLineWeight(1);
CT3DownTick.HideBubble();
plot CT4DownTick = if cumulativeTick4 < cumulativeTick4[1]
then cumulativeTick4
else Double.NaN;
CT4DownTick.SetPaintingStrategy(PaintingStrategy.Points);
CT4DownTick.SetDefaultColor( color.white);
CT4DownTick.SetLineWeight(1);
CT4DownTick.HideBubble();
cumulativeTick1.SetDefaultColor(Color.MAGENTA);
cumulativeTick1.SetLineWeight(5);
cumulativeTick2.SetDefaultColor(Color.Dark_green);
cumulativeTick2.SetLineWeight(5);
cumulativeTick3.SetDefaultColor(Color.DARK_RED);
cumulativeTick3.SetLineWeight(5);
cumulativeTick4.SetDefaultColor(Color.BLUE);
cumulativeTick4.SetLineWeight(5);
cumulativeTick1.HideBubble();
cumulativeTick2.HideBubble();
cumulativeTick3.HideBubble();
cumulativeTick4.HideBubble();
plot allUp = if cumulativeTick1 > cumulativeTick1[1] and
cumulativeTick2 > cumulativeTick2[1] and
cumulativeTick3 > cumulativeTick3[1] and
cumulativeTick4 > cumulativeTick4[1]
then 0
else Double.NaN;
allUp.SetPaintingStrategy(PaintingStrategy.LINE_VS_TRIANGLES);
allUp.SetDefaultColor(Color.green);
allUp.setLineWeight(5);
allup.HideBubble();
plot allDown = if cumulativeTick1 < cumulativeTick1[1] and
cumulativeTick2 < cumulativeTick2[1] and
cumulativeTick3 < cumulativeTick3[1] and
cumulativeTick4 < cumulativeTick4[1]
then 0
else Double.NaN;
allDown.SetPaintingStrategy(PaintingStrategy.LINE_VS_SQUARES);
allDown.SetDefaultColor(Color.red);
allDown.SetLineWeight(5);
allDown.HideBubble();
plot zero = if isNaN(close) then double.nan else 0;
zero.SetDefaultColor(Color.WHITE);
zero.HideBubble();
zero.HideTitle();
AddVerticalLine(SecondsTillTime(openTime) == 0 or (GetDay() != GetDay()[1] and (SecondsTillTime(0000) > 0)), "", Color.GRAY, 1);
AddLabel(!showFloatingLabels, "NYSE", Color.MAGENTA);
AddLabel(!showFloatingLabels, "NASDAQ", Color.BLUE);
AddLabel(!showFloatingLabels, "SP500", Color.DARK_RED);
AddLabel(!showFloatingLabels, "R2000", Color.Dark_green);
AddChartBubble(IsNaN(close[labelOffset - 1]) and !IsNaN(close[labelOffset]) and showFloatingLabels, cumulativeTick1[labelOffset], "NYSE", Color.MAGENTA, yes);
AddChartBubble(IsNaN(close[labelOffset - 1]) and !IsNaN(close[labelOffset]) and showFloatingLabels, cumulativeTick4[labelOffset], "NASDAQ", Color.BLUE, yes);
AddChartBubble(IsNaN(close[labelOffset - 1]) and !IsNaN(close[labelOffset]) and showFloatingLabels, cumulativeTick3[labelOffset], "SP500", Color.DARK_RED, yes);
AddChartBubble(IsNaN(close[labelOffset - 1]) and !IsNaN(close[labelOffset]) and showFloatingLabels, cumulativeTick2[labelOffset], "R2000", Color.DARK_GREEN, yes);
# End Code TheoTrade QuanTicks
I had seen this on some social media, and wanted to find out if it's possible for someone here to code or share. @DeusMecanicus was able to help me out with one of the indicators "quant" he has the code listed in his post. Besides that, no success w/ labels, indicators.Hi mansor, very nice system, please can you share the system with that? thanks
# A version of the Squeeze Pro
declare lower;
input length = 20;
#Keltner Channels
def hb = 1.0;
def mb = 1.5;
def lb = 2.0;
def avg = Average(close, length);
def k1 = avg + (hb * Average(TrueRange(high, close, low), length));
def k2 = avg + (mb * Average(TrueRange(high, close, low), length));
def k3 = avg + (lb * Average(TrueRange(high, close, low), length));
#Bollinger Bands
def BB_offset = 2.0;
def sDev = stdev(close, length);
def mid = Average(close, length);
def bb = mid + BB_offset * sDev;
#Squeeze
def s0 = bb > k3;
def s1 = bb < k1;
def s2 = bb < k2;
def s3 = bb < k3;
plot squeeze = if s0 or s1 or s2 or s3 then 0 else double.nan;
squeeze.SetLineWeight(3);
squeeze.SetStyle(curve.POINTS);
squeeze.AssignValueColor(if s1 then color.orange
else if s2 then color.red
else if s3 then color.black
else color.green);
# Code taken from Momentum Squeeze by Mobius
# code is slightly modified to remove the squeeze portion
def c = close;
def h = high;
def l = low;
def K = (Highest(h, length) + Lowest(l, length)) /
2 + ExpAverage(c, length);
plot Momo = if isNaN(close)
then double.nan
else Inertia(c - K / 2, length);
Momo.setPaintingStrategy(PaintingStrategy.HISTOGRAM);
Momo.setLineWeight(5);
Momo.assignValueColor(if Momo > Momo[1] and Momo > 0
then Color.Cyan
else if Momo > 0 and Momo < Momo[1]
then Color.Blue
else if Momo < 0 and Momo < Momo[1]
then Color.Red
else Color.Yellow);
# End Code - Mobius' Momentum Squeeze
# end code
# Moving Averages with Cloud
input avg_1 = 5;
input avg_2 = 13;
input avg_type = AverageType.SIMPLE;
plot ma1 = MovingAverage(avg_type,close,avg_1);
ma1.SetDefaultColor(Color.cyan);
plot ma2 = MovingAverage(avg_type,close,avg_2);
ma2.SetDefaultColor(Color.magenta);
AddCloud(ma1,ma2,color.green,color.red);
Your Sq Pro is magic@mansor Some indicators pictured in post #1 of this thread seemed familiar, so I did comparisons. These are the studies I think I can identify:
1) The coloring of the price bars is the "Early Entry" or "Early_In_Out" indicator sold by JC of Simpler Trading. I would read this before deciding to purchase any paid indicator. https://usethinkscript.com/threads/thoughts-on-the-ttm-squeeze-pro-from-john-carter.1907/
2) The lower study called "Anya_sqz_pro0" is the TTM_SqueezePRO, also sold by JC. I actually put together my own version some time ago based on multiple comments I read online and after studying/comparing it to many screenshots and videos. It copies the Squeeze Pro appearance.
Code:# A version of the Squeeze Pro declare lower; input length = 20; #Keltner Channels def hb = 1.0; def mb = 1.5; def lb = 2.0; def avg = Average(close, length); def k1 = avg + (hb * Average(TrueRange(high, close, low), length)); def k2 = avg + (mb * Average(TrueRange(high, close, low), length)); def k3 = avg + (lb * Average(TrueRange(high, close, low), length)); #Bollinger Bands def BB_offset = 2.0; def sDev = stdev(close, length); def mid = Average(close, length); def bb = mid + BB_offset * sDev; #Squeeze def s1 = bb < k1; def s2 = bb < k2; def s3 = bb < k3; plot squeeze = 0; squeeze.SetLineWeight(3); squeeze.SetStyle(curve.POINTS); squeeze.AssignValueColor(if s1 then color.orange else if s2 then color.red else if s3 then color.black else color.green); # Code taken from Momentum Squeeze by Mobius # code is slightly modified to remove the squeeze portion def c = close; def h = high; def l = low; def K = (Highest(h, length) + Lowest(l, length)) / 2 + ExpAverage(c, length); plot Momo = if isNaN(close) then double.nan else Inertia(c - K / 2, length); Momo.setPaintingStrategy(PaintingStrategy.HISTOGRAM); Momo.setLineWeight(5); Momo.assignValueColor(if Momo > Momo[1] and Momo > 0 then Color.Cyan else if Momo > 0 and Momo < Momo[1] then Color.Blue else if Momo < 0 and Momo < Momo[1] then Color.Red else Color.Yellow); # End Code - Mobius' Momentum Squeeze # end code
3) The named vertical lines and the horizontal red, yellow, green, white, and plum colored lines with cloud are all part of Mobius' excellent Opening Range Breakout indicator. It can be found here - https://usethinkscript.com/threads/opening-range-breakout-indicator-for-thinkorswim.16/
4) The red/green cloud with lines that follows the price appears identical to the 5 and 13 simple moving averages. Here is code to compare.
Code:# Moving Averages with Cloud input avg_1 = 5; input avg_2 = 13; input avg_type = AverageType.SIMPLE; plot ma1 = MovingAverage(avg_type,close,avg_1); ma1.SetDefaultColor(Color.cyan); plot ma2 = MovingAverage(avg_type,close,avg_2); ma2.SetDefaultColor(Color.magenta); AddCloud(ma1,ma2,color.green,color.red);
5) The cyan and magenta horizontal lines with the values listed at the right appear to be a fibonacci drawing using the fibonacci retracement tool in thinkorswim, so these are not actually a written indicator.
The indicators I dont know are the "MTF" lower indicator, the white line that appears at the left of the pic by the price, the arrows, and the dots on the price. I also didnt look much for the labels at the top of the chart; look around this forum, @Sonny has done an amazing job coding labels with such information in other threads. Hope this gives you some assistance!
plot Y_Close = close(period = "DAY")[1];
plot T_Open = IF SecondsTillTime(0930) < 0 then open(period = "DAY") ELSE open(period = "MIN");
def gap = (((T_Open - Y_Close) / (Y_Close)) * 100);
AddLabel(yes, "Gap%: " + "gap");