• Get $40 off VIP by signing up for a free account! Sign Up

Madrid Trend Squeeze For ThinkOrSwim

Ken_Adams

New member
Hey Guys, found this indicator on TradingView and ported it over today. First time I have done it. No idea if this squeeze is different than any other one out there. Here is the authors notes. Be aware, my colors are different than his.

https://www.tradingview.com/script/9bUUSzM3-Madrid-Trend-Squeeze/
This study spots the points that are most profitable in the trend with a code color and shape. This also shows trend divergences and possible reversal or reentry points

Keeping the parameters simple, this study only needs one parameter, the length of the base moving average, which by default is set to 34.

There are seven colors used for the study

Green : Uptrend in general
Lime : Spots the current uptrend leg
Aqua : The maximum profitability of the leg in a long trade
The Squeeze happens when Green+Lime+Aqua are aligned (the larger the values the better)

Maroon : Downtrend in general
Red : Spots the current downtrend leg
Fuchsia: The maximum profitability of the leg in a short trade
The Squeeze happens when Maroon+Red+Fuchsia are aligned (the larger the values the better)

Yellow : The trend has come to a pause and it is either a reversal warning or a continuation. These are the entry, re-entry or closing position points.

When either the fuchsia or the aqua colors disappear or shrinks meaningfully it could mean a possible leg exhaustion that will have to be confirmed with the subsequent bars.
When the squeeze color appears without the intermediate color (fuchsia+yellow, fuchsia+maroon, aqua+yellow, aqua+green) it could mean this is just a shake off move, a pump/dump move, a buy the dip or a sell the peak move or a gap.

In the example there are three divergences spotted, the first one between march 2009 and september 2010 when the peaks in the indicator made a lower low, meanwhile the price made a higher high, this is a negative divergence and a trend reversal. On the second example, between april 2013 and July 2013 the indicator made a higher high meanwhile the price made a double bottom , this is a positive divergence and a reversal to the upside.


Code:
#study("Madrid Trend Squeeze", shorttitle=" MTrendSqueeze")
# Madrid : Squeeze Trend : 02/Aug/2015 : 11:41 : 2.0
#This Study determines the range where the trend is more profitable.
#http://madridjourneyonws.blogspot.com/

#Ported from Tradingview
#by Ken_Adams on 4/22/20



#start of code

declare lower;
declare zerobase;

input len = 21;
input src = close;
input ref = 13
;
input sqzLen = 5
;
input hline = 0;


def ma = MovAvgExponential(src, len)
;


def closema = close - ma;
plot closema1 = closema;
closema1.SetPaintingStrategy(PaintingStrategy.HISTOGRAM);
closema1.SetLineWeight(3);
closema1.AssignValueColor(if closema >= 0 then Color.PINK else Color.MAGENTA);



def sqzma = MovAvgExponential(src, sqzLen) - ma;
plot sqzma1 = sqzma;
sqzma1.SetPaintingStrategy(PaintingStrategy.HISTOGRAM);
sqzma1.SetLineWeight(3);
sqzma1.AssignValueColor(if sqzma >= 0 then Color.cyan else Color.RED);




def refma = MovAvgExponential(src, ref) - ma;
plot refma1 = refma;
refma1.SetPaintingStrategy(PaintingStrategy.HISTOGRAM);
refma1.SetLineWeight(3);
refma1.AssignValueColor(if refma >= 0 and closema < refma or refma < 0 and closema > refma then Color.YELLOW else color.black);

plot refma2 = refma;
refma2.SetPaintingStrategy(PaintingStrategy.HISTOGRAM);
refma2.SetLineWeight(3);
refma2.AssignValueColor(if refma >= 0 then Color.GREEN else Color.dark_orange);

#end of code
 
Last edited:
Hi @Ken_Adams,

Nice work on your port ;)

Trading View:
OSetO8S.png


ToS:
FNas1kb.png


thanks again and welcome!
 
Nice work.

but I feel like the candle bars doesn't depict the 3 colors stated in original content.

I agree the colors are different but 3 colors appear either above or below zero lines. Some how it's not showing up in TOS.

Something you can look.
 
I think your original port had the plots in the wrong order, it caused some plots to block others. I made a quick adjustment and reverted to the original colors for anyone interested.


Code:
#study("Madrid Trend Squeeze", shorttitle=" MTrendSqueeze")
# Madrid : Squeeze Trend : 02/Aug/2015 : 11:41 : 2.0
#This Study determines the range where the trend is more profitable.
#http://madridjourneyonws.blogspot.com/

#Ported from Tradingview
#by Ken_Adams on 4/22/20
#DeusMecanicus edit on 4/29/20 - Original colors and plot rearrangement


#start of code

declare lower;
declare zerobase;

input len = 34;
input src = close;
input ref = 13
;
input sqzLen = 5
;
input hline = 0;


def ma = MovAvgExponential(src, len)
;


def closema = close - ma;
def refma = MovAvgExponential(src, ref) - ma;
def sqzma = MovAvgExponential(src, sqzLen) - ma;

plot refma1 = refma;
refma1.SetPaintingStrategy(PaintingStrategy.HISTOGRAM);
refma1.SetLineWeight(3);
refma1.AssignValueColor(if refma >= 0 and closema < refma or refma < 0 and closema > refma then Color.yellow else if refma >= 0 then Color.dark_green else color.dark_red);

plot sqzma1 = sqzma;
sqzma1.SetPaintingStrategy(PaintingStrategy.HISTOGRAM);
sqzma1.SetLineWeight(3);
sqzma1.AssignValueColor(if sqzma >= 0 then Color.green else Color.red);

plot closema1 = closema;
closema1.SetPaintingStrategy(PaintingStrategy.HISTOGRAM);
closema1.SetLineWeight(3);
closema1.AssignValueColor(if closema >= 0 then Color.cyan else Color.magenta);



#end of code
 
Nice. If you prefer a white screen vs dark (like me), I change every Color.yellow to Color.light_orange for visibility. The RBG of light orange is 250, 181, 127 or similar if you need to change a dot or another shape in the code.
 
Code:
#study("Stop Light Madrid Trend Squeeze", shorttitle=" SLMTrendSqueeze")
# Madrid : Squeeze Trend : 02/Aug/2015 : 11:41 : 2.0
#This Study determines the range where the trend is more profitable.
#http://madridjourneyonws.blogspot.com/

#Ported from Tradingview
#by Ken_Adams on 4/22/20
#DeusMecanicus edit on 4/29/20 - Original colors and plot rearrangement
# PrisonMike converted to MTF StopLight Squeeze

declare lower;
input AP1 = AggregationPeriod.four_hours;
input AP2 = AggregationPeriod.day;
input AP3 = AggregationPeriod.two_days;
input AP4 = AggregationPeriod.four_days;
input AP5 = AggregationPeriod.WEEK;
input AP6 = AggregationPeriod.MONTH;
input vote = 3;

def price1 = CLOSE(period = AP1);
def price2 = CLOSE(period = AP2);
def price3 = CLOSE(period = AP3);
def price4 = CLOSE(period = AP4);
def price5 = CLOSE(period = AP5);
def price6 = CLOSE(period = AP6);

def len = 34;
def ref = 13;
def sqzLen = 5;
def hline = 0;
def ma1 = MovAvgExponential(price1, len);
def ma2 = MovAvgExponential(price2, len);
def ma3 = MovAvgExponential(price3, len);
def ma4 = MovAvgExponential(price4, len);
def ma5 = MovAvgExponential(price5, len);
def ma6 = MovAvgExponential(price6, len);


#1 Day
def closema = price1 - ma1;
def refma = MovAvgExponential(price1, ref) - ma1;
def sqzma = MovAvgExponential(price1, sqzLen) - ma1;

def squeeze1 =  refma >= 0 and closema < refma or refma < 0 and closema > refma ;

#2 Two Day
def closema2 = price2 - ma2;
def refma2 = MovAvgExponential(price2, ref) - ma2;
def sqzma2 = MovAvgExponential(price2, sqzLen) - ma2;

def squeeze2 =  refma2 >= 0 and closema2 < refma2 or refma2 < 0 and closema2 > refma2 ;

#3 Three Day
def closema3 = price3 - ma3;
def refma3 = MovAvgExponential(price3, ref) - ma3;
def sqzma3 = MovAvgExponential(price3, sqzLen) - ma3;

def squeeze3=  refma3 >= 0 and closema3 < refma3 or refma3 < 0 and closema3 > refma3 ;


#4 Four Day
def closema4 = price4 - ma4;
def refma4 = MovAvgExponential(price4, ref) - ma4;
def sqzma4 = MovAvgExponential(price4, sqzLen) - ma4;

def squeeze4 =  refma4 >= 0 and closema4 < refma4 or refma4 < 0 and closema4 > refma4 ;

#5 Week
def closema5 = price5 - ma5;
def refma5 = MovAvgExponential(price5, ref) - ma5;
def sqzma5 = MovAvgExponential(price5, sqzLen) - ma5;

def squeeze5 =  refma5 >= 0 and closema5 < refma5 or refma5 < 0 and closema5 > refma5 ;

#6 Month
def closema6 = price6 - ma6;
def refma6 = MovAvgExponential(price6, ref) - ma6;
def sqzma6 = MovAvgExponential(price6, sqzLen) - ma6;

def squeeze6=  refma6 >= 0 and closema6 < refma6 or refma6 < 0 and closema6 > refma6;


def Top_Plot = (squeeze1 + squeeze2 + squeeze3+squeeze4 + squeeze5 + squeeze5) >= Vote;


plot MTF_Sqz = 7;
MTF_Sqz.SetPaintingStrategy(PaintingStrategy.POINTS);
MTF_Sqz.AssignValueColor(if Top_Plot == 1 then Color.BLACK else Color.DARK_RED);
MTF_Sqz.SetLineWeight(5);

plot Sqeezy1 = if squeeze1 == 1 then squeeze1 + 5 else 6;
plot Sqeezy2 = if squeeze2 == 1 then squeeze2 + 4 else 5;
plot Sqeezy3 = if squeeze3 == 1 then squeeze3 + 3 else 4;
plot Sqeezy4 = if squeeze4== 1 then squeeze4 + 2 else 3;
plot Sqeezy5 = if squeeze5 == 1 then squeeze5 + 1 else 2;
plot Sqeezy6 = if squeeze6 == 1 then squeeze6 + 0 else 1;


Sqeezy1.SetPaintingStrategy(PaintingStrategy.POINTS);
Sqeezy1.AssignValueColor(if squeeze1 == 1 then Color.red else Color.green);
Sqeezy1.SetLineWeight(3);
Sqeezy2.SetPaintingStrategy(PaintingStrategy.POINTS);
Sqeezy2.AssignValueColor(if squeeze2 == 1 then Color.red else Color.green);
Sqeezy2.SetLineWeight(3);
Sqeezy3.SetPaintingStrategy(PaintingStrategy.POINTS);
Sqeezy3.AssignValueColor(if squeeze3 == 1 then Color.red else Color.green);
Sqeezy3.SetLineWeight(3);
Sqeezy4.SetPaintingStrategy(PaintingStrategy.POINTS);
Sqeezy4.AssignValueColor(if squeeze4 == 1 then Color.red else Color.green);
Sqeezy4.SetLineWeight(3);
Sqeezy5.SetPaintingStrategy(PaintingStrategy.POINTS);
Sqeezy5.AssignValueColor(if squeeze5 == 1 then Color.red else Color.green);
Sqeezy5.SetLineWeight(3);
Sqeezy6.SetPaintingStrategy(PaintingStrategy.POINTS);
Sqeezy6.AssignValueColor(if squeeze6 == 1 then Color.red else Color.green);
Sqeezy3.SetLineWeight(3);
 
Gents, I need your help. So I'm working on the column and decided to hack the TTMSqueeze column to make it. So I got it to display magenta, cyan, red and light green. But I need a logic for yellow. Anyone can suggest how i would add that?

Code:
#Watch list Column for Madrid Trend Squeeze, current period, current trend

#study("Madrid Trend Squeeze", shorttitle=" MTrendSqueeze")
# Madrid : Squeeze Trend : 02/Aug/2015 : 11:41 : 2.0
#This Study determines the range where the trend is more profitable.
#http://madridjourneyonws.blogspot.com/

#Ported from Tradingview
#by Ken_Adams on 4/22/20
#DeusMecanicus edit on 4/29/20 - Original colors and plot rearrangement


#start of code

declare lower;
declare zerobase;

input len = 34;
input src = close;
input ref = 13;
input sqzLen = 5;
input hline = 0;


def ma = MovAvgExponential(src, len);
def ZeroLine = 0;
def oversold = -.4;
def overbought = .4 ;


def closema = close - ma;
def refma = MovAvgExponential(src, ref) - ma;
def sqzma = MovAvgExponential(src, sqzLen) - ma;

def refma1 = refma;


def sqzma1 = sqzma;


def closema1 = closema;

plot hist = if refma>= 0 then
if refma1> refma1[1] then 2 else 1
else if refma1 < refma1[1] then -2 else -1;

assignBackgroundColor(if sqzma1 >= 0 then
if closema1 > sqzma1 then color.CYAN else color.light_green
else if closema1 < sqzma1 then color.magenta else color.red);


#hist.assignvaluecolor(if closema1 >= 0 then
#if closema1 > sqzma1 then color.CYAN else color.light_green
#else if closema1 < sqzma1 then color.magenta else color.red);
 
@Prison Mike I cleaned up the coding errors and replotted the squeeze's and changed the colors to pop out better.

Code:
#study("Stop Light Madrid Trend Squeeze", shorttitle=" SLMTrendSqueeze")
# Madrid : Squeeze Trend : 02/Aug/2015 : 11:41 : 2.0
#This Study determines the range where the trend is more profitable.
#http://madridjourneyonws.blogspot.com/

#Ported from Tradingview
#by Ken_Adams on 4/22/20
#DeusMecanicus edit on 4/29/20 - Original colors and plot rearrangement
# PrisonMike converted to MTF StopLight Squeeze
#H Kaczmarczyk cleaned up errors in code and corrected Plots to show lower time frames on the bottom and higher time frames on top, also change colors so that they pop out better
declare lower;
input AP1 = AggregationPeriod.four_hours;
input AP2 = AggregationPeriod.day;
input AP3 = AggregationPeriod.two_days;
input AP4 = AggregationPeriod.four_days;
input AP5 = AggregationPeriod.WEEK;
input AP6 = AggregationPeriod.MONTH;
input vote = 3;

def price1 = CLOSE(period = AP1);
def price2 = CLOSE(period = AP2);
def price3 = CLOSE(period = AP3);
def price4 = CLOSE(period = AP4);
def price5 = CLOSE(period = AP5);
def price6 = CLOSE(period = AP6);

def len = 34;
def ref = 13;
def sqzLen = 5;
def hline = 0;
def ma1 = MovAvgExponential(price1, len);
def ma2 = MovAvgExponential(price2, len);
def ma3 = MovAvgExponential(price3, len);
def ma4 = MovAvgExponential(price4, len);
def ma5 = MovAvgExponential(price5, len);
def ma6 = MovAvgExponential(price6, len);


#1 Day
def closema = price1 - ma1;
def refma = MovAvgExponential(price1, ref) - ma1;
def sqzma = MovAvgExponential(price1, sqzLen) - ma1;

def squeeze1 =  refma >= 0 and closema < refma or refma < 0 and closema > refma ;

#2 Two Day
def closema2 = price2 - ma2;
def refma2 = MovAvgExponential(price2, ref) - ma2;
def sqzma2 = MovAvgExponential(price2, sqzLen) - ma2;

def squeeze2 =  refma2 >= 0 and closema2 < refma2 or refma2 < 0 and closema2 > refma2 ;

#3 Three Day
def closema3 = price3 - ma3;
def refma3 = MovAvgExponential(price3, ref) - ma3;
def sqzma3 = MovAvgExponential(price3, sqzLen) - ma3;

def squeeze3=  refma3 >= 0 and closema3 < refma3 or refma3 < 0 and closema3 > refma3 ;


#4 Four Day
def closema4 = price4 - ma4;
def refma4 = MovAvgExponential(price4, ref) - ma4;
def sqzma4 = MovAvgExponential(price4, sqzLen) - ma4;

def squeeze4 =  refma4 >= 0 and closema4 < refma4 or refma4 < 0 and closema4 > refma4 ;

#5 Week
def closema5 = price5 - ma5;
def refma5 = MovAvgExponential(price5, ref) - ma5;
def sqzma5 = MovAvgExponential(price5, sqzLen) - ma5;

def squeeze5 =  refma5 >= 0 and closema5 < refma5 or refma5 < 0 and closema5 > refma5 ;

#6 Month
def closema6 = price6 - ma6;
def refma6 = MovAvgExponential(price6, ref) - ma6;
def sqzma6 = MovAvgExponential(price6, sqzLen) - ma6;

def squeeze6=  refma6 >= 0 and closema6 < refma6 or refma6 < 0 and closema6 > refma6;


def Top_Plot = (squeeze1 + squeeze2 + squeeze3+squeeze4 + squeeze5 + squeeze6) >= Vote;


plot MTF_Sqz = 7;
MTF_Sqz.SetPaintingStrategy(PaintingStrategy.Squares);
MTF_Sqz.AssignValueColor(if Top_Plot == 1 then Color.Red else Color.Green);
MTF_Sqz.SetLineWeight(5);

plot Sqeezy1 = if squeeze1 == 1 then squeeze1 + 0 else 1;
plot Sqeezy2 = if squeeze2 == 1 then squeeze2 + 1 else 2;
plot Sqeezy3 = if squeeze3 == 1 then squeeze3 + 2 else 3;
plot Sqeezy4 = if squeeze4== 1 then squeeze4 + 3 else 4;
plot Sqeezy5 = if squeeze5 == 1 then squeeze5 +4 else 5;
plot Sqeezy6 = if squeeze6 == 1 then squeeze6 + 5 else 6;


Sqeezy1.SetPaintingStrategy(PaintingStrategy.POINTS);
Sqeezy1.AssignValueColor(if squeeze1 == 1 then Color.Magenta else Color.Cyan);
Sqeezy1.SetLineWeight(3);
Sqeezy2.SetPaintingStrategy(PaintingStrategy.POINTS);
Sqeezy2.AssignValueColor(if squeeze2 == 1 then Color.Magenta else Color.Cyan);
Sqeezy2.SetLineWeight(3);
Sqeezy3.SetPaintingStrategy(PaintingStrategy.POINTS);
Sqeezy3.AssignValueColor(if squeeze3 == 1 then Color.Magenta else Color.Cyan);
Sqeezy3.SetLineWeight(3);
Sqeezy4.SetPaintingStrategy(PaintingStrategy.POINTS);
Sqeezy4.AssignValueColor(if squeeze4 == 1 then Color.Magenta else Color.Cyan);
Sqeezy4.SetLineWeight(3);
Sqeezy5.SetPaintingStrategy(PaintingStrategy.POINTS);
Sqeezy5.AssignValueColor(if squeeze5 == 1 then Color.Magenta else Color.Cyan);
Sqeezy5.SetLineWeight(3);
Sqeezy6.SetPaintingStrategy(PaintingStrategy.POINTS);
Sqeezy6.AssignValueColor(if squeeze6 == 1 then Color.Magenta else Color.Cyan);
Sqeezy6.SetLineWeight(3);
 
just added L2 reversal code to show on the indicator.

CSS:
#// This source code is subject to the terms of the Mozilla Public License 2.0 at
#https://www.tradingview.com/script/FH1VyeNT/
#// © blackcat1402
#study('[blackcat] L2 Reversal Labels','LLA'
#Converted and mod by Sam4COK@Samer800 11/2022
declare lower;
input MaType = {default "EMA", "TRAMA", "eVWMA", "SMMA", "TEMA", "WMA", "SMA"};
input len = 34;
input src = close;
input ref = 13;
input sqzLen = 5;
input fastLength = 12;
input slowLength = 26;
input MACDLength = 9;

def na = Double.NaN;

script nz {
    input data  = close;
    input repl  = 0;
    def ret_val = if isNaN(data) then repl else data;
    plot return = ret_val;
}
#ma(type, src, len) =>
script ma {
    input type = "EMA";
    input src = close;
    input len = 14;
    def volumeSum = Sum(volume, len);
    def evwma = ((volumeSum - volume) * nz(evwma[1]) + volume * src) / volumeSum;
    def e = ExpAverage(src, len);
    def ama;
    def H = Highest(high, len);
    def L = Lowest(low, len);
    def HH = Max(Sign(H - H[1]), 0);
    def LL = Max(Sign(L - L[1]) * -1, 0);
    def TC = Power(Average(if HH or LL then 1 else 0, len), 2);
    ama = ama[1] + TC * (src - ama[1]);
    def ma;
    ma = if type == "SMA"   then SimpleMovingAvg(src, len) else
     if type == "EMA"   then ExpAverage(src, len) else
     if type == "TEMA"  then 3 * (e - ExpAverage(e, len)) + ExpAverage(ExpAverage(e, len), len) else
     if type == "WMA"   then WMA(src, len) else
     if type == "SMMA"  then WildersSmoothing(src, len) else
     if type == "eVWMA" then evwma else
     if type == "TRAMA" then ama else Double.NaN;
    plot result = ma;
}

def Value = ma(MaType, src, fastLength) - ma(MaType, src, slowLength);
def Avg = ma(MaType, Value, MACDLength);

def diff = Value;
def dea  = Avg;

def CrossUp = diff>dea and diff[1]<=dea[1];
def UpCount = if CrossUp then 1 else UpCount[1] + 1;

def CrossDn = diff<dea and diff[1]>=dea[1];
def DnCount = if CrossDn then 1 else DnCount[1] + 1;

def a1 = UpCount[1];
def a2 = DnCount[1];
def CloseUp = getvalue(close, a1+1);
def CloseDn = getvalue(close, a2+1);
def DiffUp  = getvalue(diff, a1+1);
def DiffDn  = getvalue(diff, a2+1);

def bottom_zone = (CloseUp>close) and (diff>DiffUp) and CrossUp;
def top_zone    = (CloseDn<close) and (DiffDn>diff) and CrossDn;

def long = bottom_zone;#          // RELPLACE THIS WITH YOUR LONG CONDITION
def short = top_zone;#           // REPLACE THIS WITH YOUR SHORT CONDITION

#/--Customized Indicator Area End ------//
#// Signal plot and output
def longCond; def shortCond; def initCond; def Signal;
    longCond = long;
    shortCond = short;
    initCond = if longCond then 1 else if shortCond then -1 else initCond[1];
    Signal = if longCond then 5 else if shortCond then -5 else 0;
def SignalUp = if longCond then 1 else 0;
def SignalDn = if shortCond then 1 else 0;

def sigColUp = (longCond and Signal[1] == 0) or (Signal == 0 and Signal[1] == 1) or (Signal[1] == -1 and Signal == 1);
def sigColDn = (shortCond and Signal[1] == 0) or (Signal == 0 and Signal[1] == -1) or (Signal == 1 and Signal[1] == -1);# ? color.fuchsia : sigCol

#---------
#// Madrid : Squeeze Trend : 02/Aug/2015 : 11:41 : 2.0
#// This Study determines the range where the trend is more profitable.
#// http://madridjourneyonws.blogspot.com/
#//
#study("Madrid Trend Squeeze", shorttitle="MTrendSqueeze")

def ma = ma(MaType,src, len);
def closema = close - ma;
def refma = Ma(MaType,src, ref)-ma;
def sqzma = Ma(MaType,src, sqzLen)-ma;

def cloColor = closema>=0;
def sqzColor = sqzma>=0;
def refColor = if (refma>=0 and closema<refma) or (refma<0 and closema>refma) then -1 else
               if refma>=0 then 1 else 0;
plot ZeroLine = if isNaN(close) then na else 0;#hline(0)
ZeroLine.SetStyle(Curve.SHORT_DASH);
ZeroLine.SetDefaultColor(Color.GRAY);

plot refLine  = refma;
refLine.SetPaintingStrategy(PaintingStrategy.HISTOGRAM);
refLine.AssignValueColor(if refColor<0 then Color.YELLOW else
                         if refColor>0 then Color.LIGHT_GREEN else Color.DARK_ORANGE);

plot sqzLine  = sqzma;
sqzLine.SetPaintingStrategy(PaintingStrategy.HISTOGRAM);
sqzLine.AssignValueColor(if sqzColor then Color.DARK_GREEN else Color.DARK_RED);
#sqzLine.SetLineWeight(3);

plot closLine = closema;
closLine.SetPaintingStrategy(PaintingStrategy.HISTOGRAM);
closLine.AssignValueColor(if cloColor then Color.GREEN else Color.RED);


AddChart(high = if SignalUp then Double.NEGATIVE_INFINITY else na,
         low = if SignalUp then Double.POSITIVE_INFINITY else na,
         open = if SignalUp then Double.POSITIVE_INFINITY else na,
         close = if SignalUp then Double.NEGATIVE_INFINITY else na,
         type = ChartType.CANDLE, growcolor = Color.DARK_GREEN);
AddChart(high = if SignalDn then Double.NEGATIVE_INFINITY else na,
         low = if SignalDn then Double.POSITIVE_INFINITY else na,
         open = if SignalDn then Double.POSITIVE_INFINITY else na,
         close = if SignalDn then Double.NEGATIVE_INFINITY else na,
         type = ChartType.CANDLE, growcolor = Color.DARK_RED);

#---END Code
 
Quick question: from read the code, seems it does not repaint, am I right?
thanks
William

Repainter Threads usually have a prefix of Repaints.

This is a moving average indicator which do not repaint.
But you will see tick-by-tick updates on the current candle until it closes; as you will with most indicators.
 
Last edited:

Join useThinkScript to post your question to a community of 21,000+ developers and traders.

Similar threads

Not the exact question you're looking for?

Start a new thread and receive assistance from our community.

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