Quad_Intraday

solaris

Member
Good Morning, I have a question about the Theo Quad Indicator written by Mobius ,specifically this setting. What does the .5 represent, if this number is increased to .8, or decreased to .2 what type of an affect does this have on the indicator? Any feed back would be appreciated.

Thanks

CumTickMomo < .5 and
ADMomo < .5 and
BreadthMomo < .5 and
PriceMomo < .5


Code:
# TheoQuad_Intraday
# Mobius Dev
# Copyright TheoTrade LLC
# V03.25.2017
#hint: <b>This Study is for intraday trading only. The study uses Consolidated TICK, Advance Decline, Volume Breadth and Price for Trend Momentum. When all 4 agree the study plots a directional marker and colors the candles blue for ascending or yellow for descending price. The markers and candle color can be turned on and off with user inputs. The "n" input is for momentum length calculations.\n Trading Note: Look for the candle color or trend market to "stop plotting" for indication trend may be slowing, possibly changing.

declare hide_on_daily;

input n = 6; #hint n: Length for Momentum calculations.
input CandleColor = yes;
input TrendMarkers = no;
input ShowData = yes;
input TickSymb = {default "$TIKSP", "$TICK", "$TICK/Q"};

def tick = if IsNaN(close("$TIKSP"))
           then tick[1]
           else close("$TICK/Q");
def AD = if IsNaN(close("$ADSPD"))
         then AD[1]
         else close("$ADSPD");
def Breadth = if IsNaN(close("$VOLSPD"))
              then Breadth[1]
              else close("$VOLSPD");
def price = close;
def Hrs = Floor(9.5 + SecondsFromTime(0930) / 60 / 60) - 1;
def Min = ((9.5 + SecondsFromTime(930) / 60 / 60) % 1) * 60;
def active = if SecondsFromTime(0930) >= 0 and
                SecondsTillTime(1600) >= 0
             then  1
             else 0;
def lowestAD = if Active and !Active[1]
               then AD
               else if Active and
                       AD < lowestAD[1]
                    then AD
                    else lowestAD[1];
def AD_low_Time_Hrs = if AD == lowestAD
                        then Hrs
                        else AD_low_Time_Hrs[1];
def AD_low_Time_min = if AD == lowestAD
                        then min
                        else AD_low_Time_min[1];
def highestAD = if Active and !Active[1]
                then AD
                else if Active and
                        AD > highestAD[1]
                     then AD
                     else highestAD[1];
def AD_high_Time_Hrs = if AD == highestAD
                        then Hrs
                        else AD_high_Time_Hrs[1];
def AD_high_Time_min = if AD == highestAD
                        then min
                        else AD_high_Time_min[1];
def sumAD = if Active and !Active[1]
            then AD
            else if Active
                 then sumAD[1] + AD
                 else sumAD[1];
def barLength = if Active and !Active[1]
                then 1
                else if Active
                     then barLength[1] + 1
                     else barLength[1];
def MA_AD = sumAD / barLength;
def CumTick = fold i = 0 to active
              with p
              while active
              do CumTick[1] + tick;
def CumTickMomo = (CumTick - Lowest(CumTick, n)) /
                  (Highest(CumTick, n) - Lowest(CumTick, n));
def ADMomo = (AD - Lowest(AD, n)) /
             (Highest(AD, n) - Lowest(AD, n));
def BreadthMomo = (Breadth - Lowest(Breadth, n)) /
                  (Highest(Breadth, n) - Lowest(Breadth, n));
def PriceMomo = (price - Lowest(price, n)) /
                (Highest(price, n) - Lowest(price, n));
plot QuadTrendUp = if CumTickMomo > .5 and
                      ADMomo > .5 and
                      BreadthMomo > .5 and
                      PriceMomo > .5
                   then low - TickSize()
                   else Double.NaN;
QuadTrendUp.SetPaintingStrategy(PaintingStrategy.BOOLEAN_WEDGE_UP);
QuadTrendUp.SetLineWeight(1);
QuadTrendUp.SetDefaultColor(Color.GREEN);
QuadTrendUp.SetHiding(!TrendMarkers);
plot QuadTrendDn = if [B]CumTickMomo < .5 and
                      ADMomo < .5 and
                      BreadthMomo < .5 and
                      PriceMomo < .5[/B]
                   then high + TickSize()
                   else Double.NaN;
QuadTrendDn.SetPaintingStrategy(PaintingStrategy.BOOLEAN_WEDGE_DOWN);
QuadTrendDn.SetLineWeight(1);
QuadTrendDn.SetDefaultColor(Color.Black);
QuadTrendDn.SetHiding(!TrendMarkers);
AssignPriceColor(if CandleColor and !IsNaN(QuadTrendUp)
                 then Color.Green
                 else if CandleColor and !IsNaN(QuadTrendDn)
                      then Color.Red
                      else Color.CURRENT);

AddLabel(ShowData, "Quad Data:  " +
          "  Tick = " + tick +
          "  || AD = " + AD +
          "  Highest AD = " + highestAD + "  At: " + AD_high_Time_Hrs + ":" + AD_high_Time_min +
          "  Lowest AD = " + lowestAD + "  At: " + AD_low_Time_Hrs + ":" + AD_low_Time_min +
          "  Avg AD = " + Round(MA_AD, 0) +
          "  || Breadth = " + Round(Breadth / 1000000, 2) + "m",
             if !IsNaN(QuadTrendUp)
             then Color.Green
             else if !IsNaN(QuadTrendDn)
                  then Color.Red
                  else Color.yellow);

# End Code TheoQuad_Intraday
 
Last edited by a moderator:
Solution
I have the feeling it would bias the indicator to favour (reliably or not) up or down trends. I added the threshold as a variable. Adjust it and try:

Code:
# TheoQuad_Intraday
# Mobius Dev
# Copyright TheoTrade LLC
# V03.25.2017
# mod mashume for playing with the QuadTrend Threshold 2023.09
#hint: <b>This Study is for intraday trading only. The study uses Consolidated TICK, Advance Decline, Volume Breadth and Price for Trend Momentum. When all 4 agree the study plots a directional marker and colors the candles blue for ascending or yellow for descending price. The markers and candle color can be turned on and off with user inputs. The "n" input is for momentum length calculations.\n Trading Note: Look for the candle color or trend market...
I have the feeling it would bias the indicator to favour (reliably or not) up or down trends. I added the threshold as a variable. Adjust it and try:

Code:
# TheoQuad_Intraday
# Mobius Dev
# Copyright TheoTrade LLC
# V03.25.2017
# mod mashume for playing with the QuadTrend Threshold 2023.09
#hint: <b>This Study is for intraday trading only. The study uses Consolidated TICK, Advance Decline, Volume Breadth and Price for Trend Momentum. When all 4 agree the study plots a directional marker and colors the candles blue for ascending or yellow for descending price. The markers and candle color can be turned on and off with user inputs. The "n" input is for momentum length calculations.\n Trading Note: Look for the candle color or trend market to "stop plotting" for indication trend may be slowing, possibly changing.

declare hide_on_daily;

input n = 6; #hint n: Length for Momentum calculations.
input CandleColor = yes;
input TrendMarkers = no;
input ShowData = yes;
input TickSymb = {default "$TIKSP", "$TICK", "$TICK/Q"};
input QuadTrendThreshold = 0.5;
def tick = if IsNaN(close("$TIKSP"))
           then tick[1]
           else close("$TICK/Q");
def AD = if IsNaN(close("$ADSPD"))
         then AD[1]
         else close("$ADSPD");
def Breadth = if IsNaN(close("$VOLSPD"))
              then Breadth[1]
              else close("$VOLSPD");
def price = close;
def Hrs = Floor(9.5 + SecondsFromTime(0930) / 60 / 60) - 1;
def Min = ((9.5 + SecondsFromTime(930) / 60 / 60) % 1) * 60;
def active = if SecondsFromTime(0930) >= 0 and
                SecondsTillTime(1600) >= 0
             then  1
             else 0;
def lowestAD = if Active and !Active[1]
               then AD
               else if Active and
                       AD < lowestAD[1]
                    then AD
                    else lowestAD[1];
def AD_low_Time_Hrs = if AD == lowestAD
                        then Hrs
                        else AD_low_Time_Hrs[1];
def AD_low_Time_min = if AD == lowestAD
                        then min
                        else AD_low_Time_min[1];
def highestAD = if Active and !Active[1]
                then AD
                else if Active and
                        AD > highestAD[1]
                     then AD
                     else highestAD[1];
def AD_high_Time_Hrs = if AD == highestAD
                        then Hrs
                        else AD_high_Time_Hrs[1];
def AD_high_Time_min = if AD == highestAD
                        then min
                        else AD_high_Time_min[1];
def sumAD = if Active and !Active[1]
            then AD
            else if Active
                 then sumAD[1] + AD
                 else sumAD[1];
def barLength = if Active and !Active[1]
                then 1
                else if Active
                     then barLength[1] + 1
                     else barLength[1];
def MA_AD = sumAD / barLength;
def CumTick = fold i = 0 to active
              with p
              while active
              do CumTick[1] + tick;
def CumTickMomo = (CumTick - Lowest(CumTick, n)) /
                  (Highest(CumTick, n) - Lowest(CumTick, n));
def ADMomo = (AD - Lowest(AD, n)) /
             (Highest(AD, n) - Lowest(AD, n));
def BreadthMomo = (Breadth - Lowest(Breadth, n)) /
                  (Highest(Breadth, n) - Lowest(Breadth, n));
def PriceMomo = (price - Lowest(price, n)) /
                (Highest(price, n) - Lowest(price, n));
plot QuadTrendUp = if CumTickMomo > QuadTrendThreshold and
                      ADMomo > QuadTrendThreshold and
                      BreadthMomo > QuadTrendThreshold and
                      PriceMomo > QuadTrendThreshold
                   then low - TickSize()
                   else Double.NaN;
QuadTrendUp.SetPaintingStrategy(PaintingStrategy.BOOLEAN_WEDGE_UP);
QuadTrendUp.SetLineWeight(1);
QuadTrendUp.SetDefaultColor(Color.GREEN);
QuadTrendUp.SetHiding(!TrendMarkers);
plot QuadTrendDn = if CumTickMomo < QuadTrendThreshold and
                      ADMomo < QuadTrendThreshold and
                      BreadthMomo < QuadTrendThreshold and
                      PriceMomo < QuadTrendThreshold
                   then high + TickSize()
                   else Double.NaN;
QuadTrendDn.SetPaintingStrategy(PaintingStrategy.BOOLEAN_WEDGE_DOWN);
QuadTrendDn.SetLineWeight(1);
QuadTrendDn.SetDefaultColor(Color.Black);
QuadTrendDn.SetHiding(!TrendMarkers);
AssignPriceColor(if CandleColor and !IsNaN(QuadTrendUp)
                 then Color.Green
                 else if CandleColor and !IsNaN(QuadTrendDn)
                      then Color.Red
                      else Color.CURRENT);

AddLabel(ShowData, "Quad Data:  " +
          "  Tick = " + tick +
          "  || AD = " + AD +
          "  Highest AD = " + highestAD + "  At: " + AD_high_Time_Hrs + ":" + AD_high_Time_min +
          "  Lowest AD = " + lowestAD + "  At: " + AD_low_Time_Hrs + ":" + AD_low_Time_min +
          "  Avg AD = " + Round(MA_AD, 0) +
          "  || Breadth = " + Round(Breadth / 1000000, 2) + "m",
             if !IsNaN(QuadTrendUp)
             then Color.Green
             else if !IsNaN(QuadTrendDn)
                  then Color.Red
                  else Color.yellow);

# End Code TheoQuad_Intraday
 
Solution

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

I have the feeling it would bias the indicator to favour (reliably or not) up or down trends. I added the threshold as a variable. Adjust it and try:

Code:
# TheoQuad_Intraday
# Mobius Dev
# Copyright TheoTrade LLC
# V03.25.2017
# mod mashume for playing with the QuadTrend Threshold 2023.09
#hint: <b>This Study is for intraday trading only. The study uses Consolidated TICK, Advance Decline, Volume Breadth and Price for Trend Momentum. When all 4 agree the study plots a directional marker and colors the candles blue for ascending or yellow for descending price. The markers and candle color can be turned on and off with user inputs. The "n" input is for momentum length calculations.\n Trading Note: Look for the candle color or trend market to "stop plotting" for indication trend may be slowing, possibly changing.

declare hide_on_daily;

input n = 6; #hint n: Length for Momentum calculations.
input CandleColor = yes;
input TrendMarkers = no;
input ShowData = yes;
input TickSymb = {default "$TIKSP", "$TICK", "$TICK/Q"};
input QuadTrendThreshold = 0.5;
def tick = if IsNaN(close("$TIKSP"))
           then tick[1]
           else close("$TICK/Q");
def AD = if IsNaN(close("$ADSPD"))
         then AD[1]
         else close("$ADSPD");
def Breadth = if IsNaN(close("$VOLSPD"))
              then Breadth[1]
              else close("$VOLSPD");
def price = close;
def Hrs = Floor(9.5 + SecondsFromTime(0930) / 60 / 60) - 1;
def Min = ((9.5 + SecondsFromTime(930) / 60 / 60) % 1) * 60;
def active = if SecondsFromTime(0930) >= 0 and
                SecondsTillTime(1600) >= 0
             then  1
             else 0;
def lowestAD = if Active and !Active[1]
               then AD
               else if Active and
                       AD < lowestAD[1]
                    then AD
                    else lowestAD[1];
def AD_low_Time_Hrs = if AD == lowestAD
                        then Hrs
                        else AD_low_Time_Hrs[1];
def AD_low_Time_min = if AD == lowestAD
                        then min
                        else AD_low_Time_min[1];
def highestAD = if Active and !Active[1]
                then AD
                else if Active and
                        AD > highestAD[1]
                     then AD
                     else highestAD[1];
def AD_high_Time_Hrs = if AD == highestAD
                        then Hrs
                        else AD_high_Time_Hrs[1];
def AD_high_Time_min = if AD == highestAD
                        then min
                        else AD_high_Time_min[1];
def sumAD = if Active and !Active[1]
            then AD
            else if Active
                 then sumAD[1] + AD
                 else sumAD[1];
def barLength = if Active and !Active[1]
                then 1
                else if Active
                     then barLength[1] + 1
                     else barLength[1];
def MA_AD = sumAD / barLength;
def CumTick = fold i = 0 to active
              with p
              while active
              do CumTick[1] + tick;
def CumTickMomo = (CumTick - Lowest(CumTick, n)) /
                  (Highest(CumTick, n) - Lowest(CumTick, n));
def ADMomo = (AD - Lowest(AD, n)) /
             (Highest(AD, n) - Lowest(AD, n));
def BreadthMomo = (Breadth - Lowest(Breadth, n)) /
                  (Highest(Breadth, n) - Lowest(Breadth, n));
def PriceMomo = (price - Lowest(price, n)) /
                (Highest(price, n) - Lowest(price, n));
plot QuadTrendUp = if CumTickMomo > QuadTrendThreshold and
                      ADMomo > QuadTrendThreshold and
                      BreadthMomo > QuadTrendThreshold and
                      PriceMomo > QuadTrendThreshold
                   then low - TickSize()
                   else Double.NaN;
QuadTrendUp.SetPaintingStrategy(PaintingStrategy.BOOLEAN_WEDGE_UP);
QuadTrendUp.SetLineWeight(1);
QuadTrendUp.SetDefaultColor(Color.GREEN);
QuadTrendUp.SetHiding(!TrendMarkers);
plot QuadTrendDn = if CumTickMomo < QuadTrendThreshold and
                      ADMomo < QuadTrendThreshold and
                      BreadthMomo < QuadTrendThreshold and
                      PriceMomo < QuadTrendThreshold
                   then high + TickSize()
                   else Double.NaN;
QuadTrendDn.SetPaintingStrategy(PaintingStrategy.BOOLEAN_WEDGE_DOWN);
QuadTrendDn.SetLineWeight(1);
QuadTrendDn.SetDefaultColor(Color.Black);
QuadTrendDn.SetHiding(!TrendMarkers);
AssignPriceColor(if CandleColor and !IsNaN(QuadTrendUp)
                 then Color.Green
                 else if CandleColor and !IsNaN(QuadTrendDn)
                      then Color.Red
                      else Color.CURRENT);

AddLabel(ShowData, "Quad Data:  " +
          "  Tick = " + tick +
          "  || AD = " + AD +
          "  Highest AD = " + highestAD + "  At: " + AD_high_Time_Hrs + ":" + AD_high_Time_min +
          "  Lowest AD = " + lowestAD + "  At: " + AD_low_Time_Hrs + ":" + AD_low_Time_min +
          "  Avg AD = " + Round(MA_AD, 0) +
          "  || Breadth = " + Round(Breadth / 1000000, 2) + "m",
             if !IsNaN(QuadTrendUp)
             then Color.Green
             else if !IsNaN(QuadTrendDn)
                  then Color.Red
                  else Color.yellow);

# End Code TheoQuad_Intraday
Thanks for the help, much appreciated
 

Similar threads

Not the exact question you're looking for?

Start a new thread and receive assistance from our community.

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