TTM Wave Indicator for ThinkorSwim

thenosr12

New member
I was wondering if anyone knows where I could find the source code for the TTM wave indicator. The secondary wave's values are really small compared to the larger one and its almost impossible to see so I wanted to put a multiplier on it.

Also, if somebody can help make john carter squeeze indicator on the short term TTM Wave A just the dots signaling if in squeeze on zero line. The histogram colors when ttm squeeze indicator is decreasing positive momentum dark blue and short term A wave turns red I would like that bar to be paint a different color to signal both those indicators decreasing positive momentum. Same with when histogram goes decreasing positive momentum on both indicators. Thank you for any help..

The code has not been published for public use by John Carter so this is an approximation of those study's as found in ThinkOrSwim.

Please take a look at the code below.

Code:
# Mobius Wave Squeeze Alert
# [email protected]
# Revision V01.02.22.12
# Addition of the Bollinger Band Percent B chart label
# Hint: The %B during the squeeze give directional indication,
#       above 50% resolution of the squeeze is likely upward,
#       below 50% resolution of the squeeze is likely downward.
# Addition of LRR Volume Shift
# Addition of ParabolicSAR
# Hint: White squares at the index line are volume shifts.
#       Yellow dots at the index line are Bollinger Band / Keltner Channel squeeze indicators.
#       Green and Red arrows at the index line are Parabolic Stop and Reverse indicators.
#       Optimal Long sequence; (1) Histogram shift from light red to dark red with values increasing
#             toward the index line confirming a shift from distribution to accumulation.
#         (2) White square or multiple white squares at the index line confirming a volume increase.
#         (3) The presence of yellow dots on the index line indicating compression of the Bollinger Bands
#             and a volatility increase.
#         (4) A green up arrow indicating the Parabolic Stop and Reverse as gone positive.
#        Optimal Short sequence; The reverse of the above.

declare lower;

input price1 = CLOSE;
input ShortLength1 = 5;
input ShortLength2 = 14;
input ShortLength3 = 5;
input LongLength1 = 12;
input LongLength2 = 55;
input LongLength3 = 7;
input nK = 1.5;

input nBB = 2.0;
input alertLine = 1.0;

  def MS = Average(Average(price1, ShortLength1) - Average(price1, ShortLength2), ShortLength3);
  def MS2 = Average(Average(price1, LongLength1) - Average(price1, LongLength2), LongLength3);
  def MSGreens = if (MS >= 0, MS, 0);

  plot MS_Pos = MSGreens;
     MS_Pos.SetPaintingStrategy(PaintingStrategy.HISTOGRAM);
     MS_Pos.AssignValueColor(if MSGreens < MSGreens[1] then Color.Green else Color.Dark_Green);
     MS_Pos.SetLineWeight(4);

  def MSReds = if (MS < 0, MS, 0);

  plot MS_Neg = MSReds;
     MS_Neg.SetPaintingStrategy(PaintingStrategy.HISTOGRAM);
     MS_Neg.AssignValueColor(if MSReds < MSReds[1] then Color.Red else Color.Dark_Red);
     MS_Neg.SetLineWeight(4);

  def MS2Blues = if (MS2 >= 0, MS2, 0);

  plot MS2_Pos = MS2Blues;
     MS2_Pos.SetPaintingStrategy(PaintingStrategy.HISTOGRAM);
     MS2_Pos.AssignValueColor(if MS2Blues < MS2Blues[1] then Color.Blue else Color.CYAN);
     MS2_Pos.SetLineWeight(4);

  def MS2Yellow = if (MS2 < 0, MS2, 0);

  plot MS2_Neg = MS2Yellow;
     MS2_Neg.SetPaintingStrategy(PaintingStrategy.HISTOGRAM);
     MS2_Neg.AssignValueColor(if MS2Yellow < MS2Yellow[1] then Color.Yellow else Color.light_Red);
     MS2_Neg.SetLineWeight(4);


Input LengthATR = 20;
Input PriceATR = Close;
Input minPriceMove = 1;
Input priceIncrement = 0.01;
Input SqueezeOnColor = 2;
Input SqueezeOffColor = 6;

  def LHMult = if (priceIncrement <> 0, (minPriceMove / priceIncrement), 0);
  def ATR = AvgTrueRange(high, close, low, LengthATR);
  def SDev = stdev(PriceATR, LengthATR);
  def Denom = (nK * ATR);
  def BBS_Ind = if (Denom <> 0, ((nBB * SDev) / Denom), 0);

  plot BBS_Ind1 = if IsNaN(close) or !MS then Double.NaN else 0;
       BBS_Ind1.AssignValueColor(if BBS_Ind < Alertline then Color.Yellow else CreateColor(55,20,220));
       BBS_Ind1.SetStyle(4);
       BBS_Ind1.SetLineWeight(4);
   def BBSMA = Average(PriceAtr, LengthATR);
   def BBSMAL = BBSMA + (-2 * SDev);
   def BBSMAU = BBSMA + (2 * SDev);
   def PerB = Roundup((priceATR - BBSMAL) / (BBSMAU - BBSMAL) * 100, 0);
AddChartlabel(yes, concat("%B: ",Roundup((priceATR - BBSMAL) / (BBSMAU - BBSMAL) * 100, 0)),
if PerB < 0 then color.Yellow else if PerB > 0 and PerB[1] < 0 then color.Green else color.white) ;

input LRRLengthV = 100;

  rec inertV = Inertia(volume, LRRLengthV);
  rec LRRV = if inertV >= inertV[1] then 1 else -1;
  rec AlertLineV = 0;
  rec LRR_VolumeAlert = if (LRRV > LRRV[1] and (LRRV > AlertLineV) and (LRRV[1] < AlertLineV), .001, 0);

  plot LRR_VolSwitchAlert = if LRR_VolumeAlert > 0 then LRR_VolumeAlert else Double.NaN;
       LRR_VolSwitchAlert.SetPaintingStrategy(PaintingStrategy.Line_Vs_Squares);
       LRR_VolSwitchAlert.SetLineWeight(5);
       LRR_VolSwitchAlert.AssignValueColor(Color.White);

# Parabolic SAR Signal

input accelerationFactor = 0.0275;
input accelerationLimit = 0.2;
input crossingType = {default Bearish, Bullish};

  def sar = ParabolicSAR(accelerationFactor=accelerationFactor, accelerationLimit=accelerationLimit);
  def signald = IF (crosses(sar, price1, CrossingType == CrossingType.Bearish) and
                  sar >= price1[1]) then 1 else Double.NaN ;
  plot signaldown = signald == 1 and 0;
       signaldown.SetPaintingStrategy(PaintingStrategy.Arrow_Down);
       signaldown.SetLineWeight(4);
       signaldown.AssignValueColor(Color.RED);

  def signalu = IF (crosses(sar, price1, CrossingType == CrossingType.Bullish) and
                  sar <= price1[1]) then 1 else Double.NaN ;
  plot signalup = signalu == 1 and 0;
       signalup.SetPaintingStrategy(PaintingStrategy.Arrow_Up);
       signalup.SetLineWeight(4);
       signalup.AssignValueColor(Color.Green);

#End Code................
 

Dix

New member
VIP
In my watchlists I would like to add a column where I can see the values of the TTM Wave for each stock. Can someone assist with the code part? I know how to add columns to my watchlists, etc. Essentially I want to run a pre-market scan to see for example TTM Waves that are greater than +2 or less than -2 for example. I know how to build the scan but also want to add the TTM Wave values to my watchlist for easier sorting. Thanks!
 

BenTen

Administrative
Staff member
Staff
VIP
It's already available as one of the built-in watchlist columns in ThinkorSwim. You just have to add it.

zWbQDmQ.png
 

Dix

New member
VIP
Thanks Ben. I literally checked before writing this post and it wasn't there which was weird. Anyway I restarted my TOS and viola! it was there. Thanks.

I thought I had it figured out but still need help. The values I would like to extract are the high wave values and low wave values. In the screen show below, when I add the TTM Wave column it gives me the 0.2188 value however I would like to obtain the 8.38275 value. On the flip side, when that value is negative I would like to extract that negative value when it drops below zero. Hopefully this makes sense. Thanks!

Jr33Y43.png
 

trinimore

New member
VIP
Code:
plot value = TTM_Wave()."Wave1" is greater than TTM_Wave()."Wave1" from 1 bars ago;
AssignBackgroundColor(if value == 1 then color.yellow else color.Dark_Red);
value. Assignvaluecolor(if value == 1then color. Black else color.Current);
 

Similar threads

Top