Repaints AGAIG MTF Tri-Trend Align Dashboard For ThinkOrSwim

Repaints

csricksdds

Trader Educator
VIP
AGAIG Tri-Trend Align Indicator

This is a new lower indicator “AGAIG TriTrend Align” which has the ability to show three (Tri) Trend Dot Levels or, if you prefer four (Quad) TriTrend Aligns. You can toggle the Quad on or off. I use this for day trading and am looking for stacked dots the same color for trading purposes. If you use the current chart time frame it will probably be more active and may give false signals although it is the most current rather than the three further out.

How it looks on the lower chart (I am showing the three (TRI0 on right chart) and the Four (Quad on left chart):
pXk3k01.png


I am using a 5 min. chart with the 10 min., I hr., and Day further out. The right chart is QQQ and the left chart SPY. You can toggle in the timeframes you wish to use.

For confession purposes I like to use this better than my AGAIG Combined Alignment Oscillator which I posted on Sunday. Remember: The Trend Is Your Friend and I need all the friends I can get for trading purposes!

In short:

TriTrend Align — A lower-panel indicator that shows trend direction (bullish/bearish/neutral) across three selectable timeframes as color-coded dots, with an optional 4th timeframe toggle. Highlights and confirms when all timeframes align, giving a clean, noise-filtered signal for trade timing.

Gray for "no data yet" keeps the indicator from implying any kind of prediction, and the moment real price prints, the dot picks up its actual green/red/yellow color based on the math. Clean distinction between known and unknown.

The numbers 1, 2, 3, 4 to the right of the dots shows the dot lineup from top to bottom.

Feedback always appreciated.

The Indicator Link: http://tos.mx/!vgtz7d1d
Code:
# TriTrend Align
# Lower Study: 3-4 selectable timeframes, trend alignment (Red/Green/Yellow)
# Row labels + persistence filter + optional 4th timeframe toggle
# Future/empty bars shown as gray placeholders
# Defaults set to 5min / 10min / 15min / 20min

declare lower;

input fastLength = 8;
input slowLength = 13;
input neutralThresholdPercent = 0.1;
input minBarsAligned = 2;

input timeframe1 = AggregationPeriod.FIVE_MIN;
input timeframe2 = AggregationPeriod.TEN_MIN;
input timeframe3 = AggregationPeriod.FIFTEEN_MIN;

input showTimeframe4 = yes;
input timeframe4 = AggregationPeriod.TWENTY_MIN;

def isFuture = IsNaN(close);

def close1 = close(period = timeframe1);
def fast1 = ExpAverage(close1, fastLength);
def slow1 = ExpAverage(close1, slowLength);
def sep1 = (fast1 - slow1) / slow1 * 100;
def dir1 = if AbsValue(sep1) < neutralThresholdPercent then 0 else if sep1 > 0 then 1 else -1;

def close2 = close(period = timeframe2);
def fast2 = ExpAverage(close2, fastLength);
def slow2 = ExpAverage(close2, slowLength);
def sep2 = (fast2 - slow2) / slow2 * 100;
def dir2 = if AbsValue(sep2) < neutralThresholdPercent then 0 else if sep2 > 0 then 1 else -1;

def close3 = close(period = timeframe3);
def fast3 = ExpAverage(close3, fastLength);
def slow3 = ExpAverage(close3, slowLength);
def sep3 = (fast3 - slow3) / slow3 * 100;
def dir3 = if AbsValue(sep3) < neutralThresholdPercent then 0 else if sep3 > 0 then 1 else -1;

def close4 = close(period = timeframe4);
def fast4 = ExpAverage(close4, fastLength);
def slow4 = ExpAverage(close4, slowLength);
def sep4 = (fast4 - slow4) / slow4 * 100;
def dir4 = if AbsValue(sep4) < neutralThresholdPercent then 0 else if sep4 > 0 then 1 else -1;

plot Dot1 = if showTimeframe4 then 4 else 3;
Dot1.SetPaintingStrategy(PaintingStrategy.POINTS);
Dot1.AssignValueColor(if isFuture then Color.GRAY else if dir1 == 1 then Color.GREEN else if dir1 == -1 then Color.RED else Color.YELLOW);
Dot1.SetLineWeight(5);

plot Dot2 = if showTimeframe4 then 3 else 2;
Dot2.SetPaintingStrategy(PaintingStrategy.POINTS);
Dot2.AssignValueColor(if isFuture then Color.GRAY else if dir2 == 1 then Color.GREEN else if dir2 == -1 then Color.RED else Color.YELLOW);
Dot2.SetLineWeight(5);

plot Dot3 = if showTimeframe4 then 2 else 1;
Dot3.SetPaintingStrategy(PaintingStrategy.POINTS);
Dot3.AssignValueColor(if isFuture then Color.GRAY else if dir3 == 1 then Color.GREEN else if dir3 == -1 then Color.RED else Color.YELLOW);
Dot3.SetLineWeight(5);

plot Dot4 = if showTimeframe4 then 1 else Double.NaN;
Dot4.SetPaintingStrategy(PaintingStrategy.POINTS);
Dot4.AssignValueColor(if isFuture then Color.GRAY else if dir4 == 1 then Color.GREEN else if dir4 == -1 then Color.RED else Color.YELLOW);
Dot4.SetLineWeight(5);

AddLabel(yes, "TF1 (" +
(if timeframe1 == AggregationPeriod.MIN then "1m"
else if timeframe1 == AggregationPeriod.FIVE_MIN then "5m"
else if timeframe1 == AggregationPeriod.TEN_MIN then "10m"
else if timeframe1 == AggregationPeriod.FIFTEEN_MIN then "15m"
else if timeframe1 == AggregationPeriod.TWENTY_MIN then "20m"
else if timeframe1 == AggregationPeriod.THIRTY_MIN then "30m"
else if timeframe1 == AggregationPeriod.HOUR then "1H"
else if timeframe1 == AggregationPeriod.TWO_HOURS then "2H"
else if timeframe1 == AggregationPeriod.FOUR_HOURS then "4H"
else if timeframe1 == AggregationPeriod.DAY then "D"
else if timeframe1 == AggregationPeriod.WEEK then "W"
else if timeframe1 == AggregationPeriod.MONTH then "M"
else "?") + ")",
if dir1 == 1 then Color.GREEN else if dir1 == -1 then Color.RED else Color.YELLOW);

AddLabel(yes, "TF2 (" +
(if timeframe2 == AggregationPeriod.MIN then "1m"
else if timeframe2 == AggregationPeriod.FIVE_MIN then "5m"
else if timeframe2 == AggregationPeriod.TEN_MIN then "10m"
else if timeframe2 == AggregationPeriod.FIFTEEN_MIN then "15m"
else if timeframe2 == AggregationPeriod.TWENTY_MIN then "20m"
else if timeframe2 == AggregationPeriod.THIRTY_MIN then "30m"
else if timeframe2 == AggregationPeriod.HOUR then "1H"
else if timeframe2 == AggregationPeriod.TWO_HOURS then "2H"
else if timeframe2 == AggregationPeriod.FOUR_HOURS then "4H"
else if timeframe2 == AggregationPeriod.DAY then "D"
else if timeframe2 == AggregationPeriod.WEEK then "W"
else if timeframe2 == AggregationPeriod.MONTH then "M"
else "?") + ")",
if dir2 == 1 then Color.GREEN else if dir2 == -1 then Color.RED else Color.YELLOW);

AddLabel(yes, "TF3 (" +
(if timeframe3 == AggregationPeriod.MIN then "1m"
else if timeframe3 == AggregationPeriod.FIVE_MIN then "5m"
else if timeframe3 == AggregationPeriod.TEN_MIN then "10m"
else if timeframe3 == AggregationPeriod.FIFTEEN_MIN then "15m"
else if timeframe3 == AggregationPeriod.TWENTY_MIN then "20m"
else if timeframe3 == AggregationPeriod.THIRTY_MIN then "30m"
else if timeframe3 == AggregationPeriod.HOUR then "1H"
else if timeframe3 == AggregationPeriod.TWO_HOURS then "2H"
else if timeframe3 == AggregationPeriod.FOUR_HOURS then "4H"
else if timeframe3 == AggregationPeriod.DAY then "D"
else if timeframe3 == AggregationPeriod.WEEK then "W"
else if timeframe3 == AggregationPeriod.MONTH then "M"
else "?") + ")",
if dir3 == 1 then Color.GREEN else if dir3 == -1 then Color.RED else Color.YELLOW);

AddLabel(showTimeframe4, "TF4 (" +
(if timeframe4 == AggregationPeriod.MIN then "1m"
else if timeframe4 == AggregationPeriod.FIVE_MIN then "5m"
else if timeframe4 == AggregationPeriod.TEN_MIN then "10m"
else if timeframe4 == AggregationPeriod.FIFTEEN_MIN then "15m"
else if timeframe4 == AggregationPeriod.TWENTY_MIN then "20m"
else if timeframe4 == AggregationPeriod.THIRTY_MIN then "30m"
else if timeframe4 == AggregationPeriod.HOUR then "1H"
else if timeframe4 == AggregationPeriod.TWO_HOURS then "2H"
else if timeframe4 == AggregationPeriod.FOUR_HOURS then "4H"
else if timeframe4 == AggregationPeriod.DAY then "D"
else if timeframe4 == AggregationPeriod.WEEK then "W"
else if timeframe4 == AggregationPeriod.MONTH then "M"
else "?") + ")",
if dir4 == 1 then Color.GREEN else if dir4 == -1 then Color.RED else Color.YELLOW);

def rawBullish = if showTimeframe4
then dir1 == 1 and dir2 == 1 and dir3 == 1 and dir4 == 1
else dir1 == 1 and dir2 == 1 and dir3 == 1;

def rawBearish = if showTimeframe4
then dir1 == -1 and dir2 == -1 and dir3 == -1 and dir4 == -1
else dir1 == -1 and dir2 == -1 and dir3 == -1;

def hasNeutral = if showTimeframe4
then dir1 == 0 or dir2 == 0 or dir3 == 0 or dir4 == 0
else dir1 == 0 or dir2 == 0 or dir3 == 0;

def bullishStreak = if rawBullish then bullishStreak[1] + 1 else 0;
def bearishStreak = if rawBearish then bearishStreak[1] + 1 else 0;

def confirmedBullish = bullishStreak >= minBarsAligned;
def confirmedBearish = bearishStreak >= minBarsAligned;

def cloudTop = if showTimeframe4 then 4.5 else 3.5;
AddCloud(if confirmedBullish then cloudTop else Double.NaN, 0.5, Color.GREEN, Color.GREEN);
AddCloud(if confirmedBearish then cloudTop else Double.NaN, 0.5, Color.RED, Color.RED);

AddLabel(yes,
"TriTrend Align: " +
(if confirmedBullish then "ALL BULLISH (confirmed)"
else if confirmedBearish then "ALL BEARISH (confirmed)"
else if rawBullish then "Bullish forming (" + bullishStreak + "/" + minBarsAligned + ")"
else if rawBearish then "Bearish forming (" + bearishStreak + "/" + minBarsAligned + ")"
else if hasNeutral then "NEUTRAL PRESENT"
else "MIXED"),
if confirmedBullish then Color.GREEN
else if confirmedBearish then Color.RED
else if rawBullish or rawBearish then Color.CYAN
else if hasNeutral then Color.YELLOW
else Color.GRAY);
 
Last edited by a moderator:

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

AGAIG Tri-Trend Align Indicator

This is a new lower indicator “AGAIG TriTrend Align” which has the ability to show three (Tri) Trend Dot Levels or, if you prefer four (Quad) TriTrend Aligns. You can toggle the Quad on or off. I use this for day trading and am looking for stacked dots the same color for trading purposes. If you use the current chart time frame it will probably be more active and may give false signals although it is the most current rather than the three further out.

How it looks on the lower chart (I am showing the three (TRI0 on right chart) and the Four (Quad on left chart):
pXk3k01.png


I am using a 5 min. chart with the 10 min., I hr., and Day further out. The right chart is QQQ and the left chart SPY. You can toggle in the timeframes you wish to use.

For confession purposes I like to use this better than my AGAIG Combined Alignment Oscillator which I posted on Sunday. Remember: The Trend Is Your Friend and I need all the friends I can get for trading purposes!

In short:

TriTrend Align — A lower-panel indicator that shows trend direction (bullish/bearish/neutral) across three selectable timeframes as color-coded dots, with an optional 4th timeframe toggle. Highlights and confirms when all timeframes align, giving a clean, noise-filtered signal for trade timing.

Gray for "no data yet" keeps the indicator from implying any kind of prediction, and the moment real price prints, the dot picks up its actual green/red/yellow color based on the math. Clean distinction between known and unknown.

The numbers 1, 2, 3, 4 to the right of the dots shows the dot lineup from top to bottom.

Feedback always appreciated.

The Indicator Link: http://tos.mx/!vgtz7d1d
# TriTrend Align
# Lower Study: 3-4 selectable timeframes, trend alignment (Red/Green/Yellow)
# Row labels + persistence filter + optional 4th timeframe toggle
# Future/empty bars shown as gray placeholders
# Defaults set to 5min / 10min / 15min / 20min

declare lower;

input fastLength = 8;
input slowLength = 13;
input neutralThresholdPercent = 0.1;
input minBarsAligned = 2;

input timeframe1 = AggregationPeriod.FIVE_MIN;
input timeframe2 = AggregationPeriod.TEN_MIN;
input timeframe3 = AggregationPeriod.FIFTEEN_MIN;

input showTimeframe4 = yes;
input timeframe4 = AggregationPeriod.TWENTY_MIN;

def isFuture = IsNaN(close);

def close1 = close(period = timeframe1);
def fast1 = ExpAverage(close1, fastLength);
def slow1 = ExpAverage(close1, slowLength);
def sep1 = (fast1 - slow1) / slow1 * 100;
def dir1 = if AbsValue(sep1) < neutralThresholdPercent then 0 else if sep1 > 0 then 1 else -1;

def close2 = close(period = timeframe2);
def fast2 = ExpAverage(close2, fastLength);
def slow2 = ExpAverage(close2, slowLength);
def sep2 = (fast2 - slow2) / slow2 * 100;
def dir2 = if AbsValue(sep2) < neutralThresholdPercent then 0 else if sep2 > 0 then 1 else -1;

def close3 = close(period = timeframe3);
def fast3 = ExpAverage(close3, fastLength);
def slow3 = ExpAverage(close3, slowLength);
def sep3 = (fast3 - slow3) / slow3 * 100;
def dir3 = if AbsValue(sep3) < neutralThresholdPercent then 0 else if sep3 > 0 then 1 else -1;

def close4 = close(period = timeframe4);
def fast4 = ExpAverage(close4, fastLength);
def slow4 = ExpAverage(close4, slowLength);
def sep4 = (fast4 - slow4) / slow4 * 100;
def dir4 = if AbsValue(sep4) < neutralThresholdPercent then 0 else if sep4 > 0 then 1 else -1;

plot Dot1 = if showTimeframe4 then 4 else 3;
Dot1.SetPaintingStrategy(PaintingStrategy.POINTS);
Dot1.AssignValueColor(if isFuture then Color.GRAY else if dir1 == 1 then Color.GREEN else if dir1 == -1 then Color.RED else Color.YELLOW);
Dot1.SetLineWeight(5);

plot Dot2 = if showTimeframe4 then 3 else 2;
Dot2.SetPaintingStrategy(PaintingStrategy.POINTS);
Dot2.AssignValueColor(if isFuture then Color.GRAY else if dir2 == 1 then Color.GREEN else if dir2 == -1 then Color.RED else Color.YELLOW);
Dot2.SetLineWeight(5);

plot Dot3 = if showTimeframe4 then 2 else 1;
Dot3.SetPaintingStrategy(PaintingStrategy.POINTS);
Dot3.AssignValueColor(if isFuture then Color.GRAY else if dir3 == 1 then Color.GREEN else if dir3 == -1 then Color.RED else Color.YELLOW);
Dot3.SetLineWeight(5);

plot Dot4 = if showTimeframe4 then 1 else Double.NaN;
Dot4.SetPaintingStrategy(PaintingStrategy.POINTS);
Dot4.AssignValueColor(if isFuture then Color.GRAY else if dir4 == 1 then Color.GREEN else if dir4 == -1 then Color.RED else Color.YELLOW);
Dot4.SetLineWeight(5);

AddLabel(yes, "TF1 (" +
(if timeframe1 == AggregationPeriod.MIN then "1m"
else if timeframe1 == AggregationPeriod.FIVE_MIN then "5m"
else if timeframe1 == AggregationPeriod.TEN_MIN then "10m"
else if timeframe1 == AggregationPeriod.FIFTEEN_MIN then "15m"
else if timeframe1 == AggregationPeriod.TWENTY_MIN then "20m"
else if timeframe1 == AggregationPeriod.THIRTY_MIN then "30m"
else if timeframe1 == AggregationPeriod.HOUR then "1H"
else if timeframe1 == AggregationPeriod.TWO_HOURS then "2H"
else if timeframe1 == AggregationPeriod.FOUR_HOURS then "4H"
else if timeframe1 == AggregationPeriod.DAY then "D"
else if timeframe1 == AggregationPeriod.WEEK then "W"
else if timeframe1 == AggregationPeriod.MONTH then "M"
else "?") + ")",
if dir1 == 1 then Color.GREEN else if dir1 == -1 then Color.RED else Color.YELLOW);

AddLabel(yes, "TF2 (" +
(if timeframe2 == AggregationPeriod.MIN then "1m"
else if timeframe2 == AggregationPeriod.FIVE_MIN then "5m"
else if timeframe2 == AggregationPeriod.TEN_MIN then "10m"
else if timeframe2 == AggregationPeriod.FIFTEEN_MIN then "15m"
else if timeframe2 == AggregationPeriod.TWENTY_MIN then "20m"
else if timeframe2 == AggregationPeriod.THIRTY_MIN then "30m"
else if timeframe2 == AggregationPeriod.HOUR then "1H"
else if timeframe2 == AggregationPeriod.TWO_HOURS then "2H"
else if timeframe2 == AggregationPeriod.FOUR_HOURS then "4H"
else if timeframe2 == AggregationPeriod.DAY then "D"
else if timeframe2 == AggregationPeriod.WEEK then "W"
else if timeframe2 == AggregationPeriod.MONTH then "M"
else "?") + ")",
if dir2 == 1 then Color.GREEN else if dir2 == -1 then Color.RED else Color.YELLOW);

AddLabel(yes, "TF3 (" +
(if timeframe3 == AggregationPeriod.MIN then "1m"
else if timeframe3 == AggregationPeriod.FIVE_MIN then "5m"
else if timeframe3 == AggregationPeriod.TEN_MIN then "10m"
else if timeframe3 == AggregationPeriod.FIFTEEN_MIN then "15m"
else if timeframe3 == AggregationPeriod.TWENTY_MIN then "20m"
else if timeframe3 == AggregationPeriod.THIRTY_MIN then "30m"
else if timeframe3 == AggregationPeriod.HOUR then "1H"
else if timeframe3 == AggregationPeriod.TWO_HOURS then "2H"
else if timeframe3 == AggregationPeriod.FOUR_HOURS then "4H"
else if timeframe3 == AggregationPeriod.DAY then "D"
else if timeframe3 == AggregationPeriod.WEEK then "W"
else if timeframe3 == AggregationPeriod.MONTH then "M"
else "?") + ")",
if dir3 == 1 then Color.GREEN else if dir3 == -1 then Color.RED else Color.YELLOW);

AddLabel(showTimeframe4, "TF4 (" +
(if timeframe4 == AggregationPeriod.MIN then "1m"
else if timeframe4 == AggregationPeriod.FIVE_MIN then "5m"
else if timeframe4 == AggregationPeriod.TEN_MIN then "10m"
else if timeframe4 == AggregationPeriod.FIFTEEN_MIN then "15m"
else if timeframe4 == AggregationPeriod.TWENTY_MIN then "20m"
else if timeframe4 == AggregationPeriod.THIRTY_MIN then "30m"
else if timeframe4 == AggregationPeriod.HOUR then "1H"
else if timeframe4 == AggregationPeriod.TWO_HOURS then "2H"
else if timeframe4 == AggregationPeriod.FOUR_HOURS then "4H"
else if timeframe4 == AggregationPeriod.DAY then "D"
else if timeframe4 == AggregationPeriod.WEEK then "W"
else if timeframe4 == AggregationPeriod.MONTH then "M"
else "?") + ")",
if dir4 == 1 then Color.GREEN else if dir4 == -1 then Color.RED else Color.YELLOW);

def rawBullish = if showTimeframe4
then dir1 == 1 and dir2 == 1 and dir3 == 1 and dir4 == 1
else dir1 == 1 and dir2 == 1 and dir3 == 1;

def rawBearish = if showTimeframe4
then dir1 == -1 and dir2 == -1 and dir3 == -1 and dir4 == -1
else dir1 == -1 and dir2 == -1 and dir3 == -1;

def hasNeutral = if showTimeframe4
then dir1 == 0 or dir2 == 0 or dir3 == 0 or dir4 == 0
else dir1 == 0 or dir2 == 0 or dir3 == 0;

def bullishStreak = if rawBullish then bullishStreak[1] + 1 else 0;
def bearishStreak = if rawBearish then bearishStreak[1] + 1 else 0;

def confirmedBullish = bullishStreak >= minBarsAligned;
def confirmedBearish = bearishStreak >= minBarsAligned;

def cloudTop = if showTimeframe4 then 4.5 else 3.5;
AddCloud(if confirmedBullish then cloudTop else Double.NaN, 0.5, Color.GREEN, Color.GREEN);
AddCloud(if confirmedBearish then cloudTop else Double.NaN, 0.5, Color.RED, Color.RED);

AddLabel(yes,
"TriTrend Align: " +
(if confirmedBullish then "ALL BULLISH (confirmed)"
else if confirmedBearish then "ALL BEARISH (confirmed)"
else if rawBullish then "Bullish forming (" + bullishStreak + "/" + minBarsAligned + ")"
else if rawBearish then "Bearish forming (" + bearishStreak + "/" + minBarsAligned + ")"
else if hasNeutral then "NEUTRAL PRESENT"
else "MIXED"),
if confirmedBullish then Color.GREEN
else if confirmedBearish then Color.RED
else if rawBullish or rawBearish then Color.CYAN
else if hasNeutral then Color.YELLOW
else Color.GRAY);
NOTE: I just updated the indicator link and code as it had a small bug so use the new
 

Similar threads

Not the exact question you're looking for?

Start a new thread and receive assistance from our community.

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