Label Indicator question

Solution
Is it possible to have a label indicator true/false indicating 2 studies meets criteria?

Lets say if FollowTheLine (https://usethinkscript.com/threads/follow-line-indicator-for-thinkorswim.9789) and 21EMA candle closes above, this will say TRUE to the label. else, if one or both fail to meet above the line, label will say FALSE.

Thank you

See if adding this to the linked indicator is what you wanted

Ruby:
plot ema21 = expaverage(close,21);
input showlabel = yes;
addlabel(showlabel, if ema21 > trendline and close > trendline then "True" else "False", color.yellow);

Here is the full code with it added
Ruby:
# Follow Line Indicator
# Coverted to ToS from TV by bigboss. Original © Dreadblitz

input BbPeriod...
Is it possible to have a label indicator true/false indicating 2 studies meets criteria?

Lets say if FollowTheLine (https://usethinkscript.com/threads/follow-line-indicator-for-thinkorswim.9789) and 21EMA candle closes above, this will say TRUE to the label. else, if one or both fail to meet above the line, label will say FALSE.

Thank you

See if adding this to the linked indicator is what you wanted

Ruby:
plot ema21 = expaverage(close,21);
input showlabel = yes;
addlabel(showlabel, if ema21 > trendline and close > trendline then "True" else "False", color.yellow);

Here is the full code with it added
Ruby:
# Follow Line Indicator
# Coverted to ToS from TV by bigboss. Original © Dreadblitz

input BbPeriod      = 21;
input BbDeviations  = 1;
input UseAtrFilter  = yes;
input AtrPeriod     = 5;
input HideArrows    = no;

def BBUpper=SimpleMovingAvg(close,BBperiod)+stdev(close, BBperiod)*BBdeviations;
def BBLower=SimpleMovingAvg(close,BBperiod)-stdev(close, BBperiod)*BBdeviations;

def BBSignal = if close>BBUpper then 1 else if close<BBLower then -1 else 0;

def TrendLine =
    if BBSignal == 1 and UseATRfilter == 1 then
        max(low-atr(ATRperiod),TrendLine[1])
    else if BBSignal == -1 and UseATRfilter == 1 then
        min(high+atr(ATRperiod),TrendLine[1])
    else if BBSignal == 0 and UseATRfilter == 1 then
        TrendLine[1]
    else if BBSignal == 1 and UseATRfilter == 0 then
        max(low,TrendLine[1])
    else if BBSignal == -1 and UseATRfilter == 0 then
        min(high,TrendLine[1])
    else if BBSignal == 0 and UseATRfilter == 0 then
        TrendLine[1]
    else TrendLine[1];

def iTrend = if TrendLine>TrendLine[1] then 1 else if TrendLine < TrendLine[1] then -1 else iTrend[1];
 
plot buy = if iTrend[1]==-1 and iTrend==1 and !HideArrows then TrendLine else Double.NaN;
buy.SetPaintingStrategy(PaintingStrategy.ARROW_UP);
buy.SetDefaultColor(Color.GREEN);
buy.SetLineWeight(3);

plot sell = if iTrend[1]==1 and iTrend==-1 and !HideArrows then  TrendLine else Double.NaN;
sell.SetPaintingStrategy(PaintingStrategy.ARROW_DOWN);
sell.SetDefaultColor(Color.RED);
sell.SetLineWeight(3);

plot tline = TrendLine;
tline.AssignValueColor(if iTrend > 0 then CreateColor(33,150,243) else CreateColor(255,82,82));
tline.SetLineWeight(2);

plot ema21 = expaverage(close,21);
input showlabel = yes;
addlabel(showlabel, if ema21 > trendline and close > trendline then "True" else "False", color.yellow);
 
Solution

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

Wow thank you for this @SleepyZ

So if I wanted to do a different indicator like both https://usethinkscript.com/threads/label-indicator-question.11696/ and @Christopher84 Ehler's indicator, I would have to put both studies into 1 study?

Code:
#Ehler's Distant Coefficient Filter Study Created by Christopher84 05/20/2022
input length = 34;
input coloredCandlesOn = no;
input displace = 13;
def price = (high + low) / 2;

def coeff = length * price * price - 2 * price * sum(price, length)[1] + sum(price * price, length)[1];

plot Ehlers = sum(coeff * price, length) / sum(coeff, length);
#Ehlers.SetDefaultColor(GetColor(1));

def EhlersD = Ehlers [+displace];

def UP1 = (Price > Ehlers);
def DN1 = (Price < Ehlers);

#Condition Calculation
def UPBias = UP1;
def DNBias = DN1;
def Direction = UPBias - DNBias;

#AddCloud(Ehlers, EhlersD, Color.GREEN, Color.CURRENT);
#AddCloud(EhlersD, Ehlers, Color.RED, Color.CURRENT);

AssignPriceColor(if coloredCandlesOn and ((Direction > 0)) then Color.GREEN else if coloredCandlesOn and ((Direction < 0)) then Color.RED else Color.CURRENT);

plot Long_Entry = (Direction crosses above 0);
Long_Entry.SetPaintingStrategy(PaintingStrategy.BOOLEAN_ARROW_UP);
Long_Entry.SetLineWeight(3);
Long_Entry.AssignValueColor(Color.UPTICK);

plot Long_Exit =  (Direction crosses below 0);
Long_Exit.SetPaintingStrategy(PaintingStrategy.BOOLEAN_ARROW_DOWN);
Long_Exit.SetLineWeight(3);
Long_Exit.AssignValueColor(Color.DOWNTICK);

I wanted to do both of these studies, if both close above line, set label to true. if one or both are not above line, set label to false.
 
Wow thank you for this @SleepyZ

So if I wanted to do a different indicator like both https://usethinkscript.com/threads/label-indicator-question.11696/ and @Christopher84 Ehler's indicator, I would have to put both studies into 1 study?

Code:
#Ehler's Distant Coefficient Filter Study Created by Christopher84 05/20/2022
input length = 34;
input coloredCandlesOn = no;
input displace = 13;
def price = (high + low) / 2;

def coeff = length * price * price - 2 * price * sum(price, length)[1] + sum(price * price, length)[1];

plot Ehlers = sum(coeff * price, length) / sum(coeff, length);
#Ehlers.SetDefaultColor(GetColor(1));

def EhlersD = Ehlers [+displace];

def UP1 = (Price > Ehlers);
def DN1 = (Price < Ehlers);

#Condition Calculation
def UPBias = UP1;
def DNBias = DN1;
def Direction = UPBias - DNBias;

#AddCloud(Ehlers, EhlersD, Color.GREEN, Color.CURRENT);
#AddCloud(EhlersD, Ehlers, Color.RED, Color.CURRENT);

AssignPriceColor(if coloredCandlesOn and ((Direction > 0)) then Color.GREEN else if coloredCandlesOn and ((Direction < 0)) then Color.RED else Color.CURRENT);

plot Long_Entry = (Direction crosses above 0);
Long_Entry.SetPaintingStrategy(PaintingStrategy.BOOLEAN_ARROW_UP);
Long_Entry.SetLineWeight(3);
Long_Entry.AssignValueColor(Color.UPTICK);

plot Long_Exit =  (Direction crosses below 0);
Long_Exit.SetPaintingStrategy(PaintingStrategy.BOOLEAN_ARROW_DOWN);
Long_Exit.SetLineWeight(3);
Long_Exit.AssignValueColor(Color.DOWNTICK);

I wanted to do both of these studies, if both close above line, set label to true. if one or both are not above line, set label to false.

Here are the script I posted above for you with the addition of the Ehlers to produce one True/False

Ruby:
# Follow Line Indicator
# Coverted to ToS from TV by bigboss. Original © Dreadblitz

input BbPeriod      = 21;
input BbDeviations  = 1;
input UseAtrFilter  = yes;
input AtrPeriod     = 5;
input HideArrows    = no;

def BBUpper = SimpleMovingAvg(close, BbPeriod) + StDev(close, BbPeriod) * BbDeviations;
def BBLower = SimpleMovingAvg(close, BbPeriod) - StDev(close, BbPeriod) * BbDeviations;

def BBSignal = if close > BBUpper then 1 else if close < BBLower then -1 else 0;

def TrendLine =
    if BBSignal == 1 and UseAtrFilter == 1 then
        Max(low - ATR(AtrPeriod), TrendLine[1])
    else if BBSignal == -1 and UseAtrFilter == 1 then
        Min(high + ATR(AtrPeriod), TrendLine[1])
    else if BBSignal == 0 and UseAtrFilter == 1 then
        TrendLine[1]
    else if BBSignal == 1 and UseAtrFilter == 0 then
        Max(low, TrendLine[1])
    else if BBSignal == -1 and UseAtrFilter == 0 then
        Min(high, TrendLine[1])
    else if BBSignal == 0 and UseAtrFilter == 0 then
        TrendLine[1]
    else TrendLine[1];

def iTrend = if TrendLine > TrendLine[1] then 1 else if TrendLine < TrendLine[1] then -1 else iTrend[1];

plot buy = if iTrend[1] == -1 and iTrend == 1 and !HideArrows then TrendLine else Double.NaN;
buy.SetPaintingStrategy(PaintingStrategy.ARROW_UP);
buy.SetDefaultColor(Color.GREEN);
buy.SetLineWeight(3);

plot sell = if iTrend[1] == 1 and iTrend == -1 and !HideArrows then  TrendLine else Double.NaN;
sell.SetPaintingStrategy(PaintingStrategy.ARROW_DOWN);
sell.SetDefaultColor(Color.RED);
sell.SetLineWeight(3);

plot tline = TrendLine;
tline.AssignValueColor(if iTrend > 0 then CreateColor(33, 150, 243) else CreateColor(255, 82, 82));
tline.SetLineWeight(2);

#Ehler's Distant Coefficient Filter Study Created by Christopher84 05/20/2022
input length = 34;
input coloredCandlesOn = no;
input displace = 13;
def price = (high + low) / 2;

def coeff = length * price * price - 2 * price * Sum(price, length)[1] + Sum(price * price, length)[1];

plot Ehlers = Sum(coeff * price, length) / Sum(coeff, length);
#Ehlers.SetDefaultColor(GetColor(1));

def EhlersD = Ehlers [+displace];

def UP1 = (price > Ehlers);
def DN1 = (price < Ehlers);

#Condition Calculation
def UPBias = UP1;
def DNBias = DN1;
def Direction = UPBias - DNBias;

#AddCloud(Ehlers, EhlersD, Color.GREEN, Color.CURRENT);
#AddCloud(EhlersD, Ehlers, Color.RED, Color.CURRENT);

AssignPriceColor(if coloredCandlesOn and ((Direction > 0)) then Color.GREEN else if coloredCandlesOn and ((Direction < 0)) then Color.RED else Color.CURRENT);

plot Long_Entry = (Direction crosses above 0);
Long_Entry.SetPaintingStrategy(PaintingStrategy.BOOLEAN_ARROW_UP);
Long_Entry.SetLineWeight(3);
Long_Entry.AssignValueColor(Color.UPTICK);

plot Long_Exit =  (Direction crosses below 0);
Long_Exit.SetPaintingStrategy(PaintingStrategy.BOOLEAN_ARROW_DOWN);
Long_Exit.SetLineWeight(3);
Long_Exit.AssignValueColor(Color.DOWNTICK);

plot ema21 = ExpAverage(close, 21);

input showlabel = yes;
AddLabel(showlabel, if ema21 > TrendLine and close > TrendLine and Ehlers > TrendLine then "True" else "False", if ema21 > TrendLine and close > TrendLine and Ehlers > TrendLine then color.light_green else color.light_red);
 

Similar threads

Not the exact question you're looking for?

Start a new thread and receive assistance from our community.

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