Labels For Squeeze & Time Frame

B

brendab180

New member
2019 Donor
VIP
Wanting to have a label (labels) on the bottom secion of my chart that shows me the squeeze information along with what time frame. Can someone help with that. I saw this on someones chart and liked it but can't find how they did it. I use 5 different charts but with just the lower indicators desplayed to the left side of my area and each are with a different time frame. So I can just see the TTm Squeeze for each in each of those timeframes. I have these stacked Then I have an upper chart to the right of that that just shows me the current time frame with my upper part displayed. Trying to figure out how to upload an image. Hope I am doing this right by asking. Thanks for any help.
 
markos

markos

Well-known member
VIP
Hi @brendab180 Attach a chart for free by going to Imgur.com.
Here's a start.
Code:
# Squeeze Count Watchlist
# Mobius
# 11.09.2015
 
def Squeeze = BollingerBands().UpperBand < KeltnerChannels().Upper_Band;

def count = if !Squeeze
            then 0
            else if Squeeze
                 then count[1] + 1
                 else count[1];

AddLabel(1, if Squeeze then count else 0,
            if Squeeze 
            then Color.Black
            else Color.WHITE);
AssignBackgroundColor(if Squeeze then color.green else color.white);
 
markos

markos

Well-known member
VIP
Here's another from the Think Script Lounge via the Universe of Thinkscript in the Tutorial Section.

11:08 Mobius: Here is the TTM Squeeze study that I wrote
Code:
# Momentum Squeeze
# Mobius
# Added Squeeze Label with directional color
# Label is green when momentum is ascending, red when descending

declare lower;

input length = 20; #hint length: Length for average calculation
input SDmult = 2.0;
input ATRmult = 1.5;

   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(3);
       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);

def SD = StDev(c, length);
def Avg = Average(c, length);
def ATR = Average(TrueRange(h, c, l), length);
def SDup = Avg + (SdMult * Sd);
def ATRup = Avg + (AtrMult * ATR);

plot Squeeze = if isNaN(c)
               then double.nan
               else if SDup < ATRup
               then 0
               else Double.NaN;

     Squeeze.SetPaintingStrategy(PaintingStrategy.Points);

     Squeeze.SetLineWeight(3);

     Squeeze.SetDefaultColor(Color.Red);

plot zero = if IsNaN(c) or !IsNaN(Squeeze) then Double.NaN else 0;
     zero.SetPaintingStrategy(PaintingStrategy.Points);
     zero.SetLineWeight(3);
     zero.SetDefaultColor(Color.Green);

AddLabel(!isNaN(Squeeze), "Squeeze", if isAscending(Momo)
                                     then Color.Green
                                     else Color.Red);

 
# End Code - Momentum Squeeze
 
B

brendab180

New member
2019 Donor
VIP
here is a pic of what I am looking for. I have the chart layout just as it looks but wanting the labels for the time frames where the ttm squeeze bottom charts are. And then like a count. If say time frame 30 min has two red dots at the moment would be in squeeze 2 and then when first green dot would be a time cycle so say time cycle 1 or fired. Something like that. I will try the part you posted to see what it looks like. Thanks for the feed back and helping with sharing a pic. :)
 

Similar threads

Top