AGAIG Trend Vertical Line For ThinkOrSwim

csricksdds

Trader Educator
VIP
This is my Upper TrendChange Vertical Lines

Code:
##AsGood_Trend_VerticalLine

declare upper;

input Length =21;
input Reversal = 3.0;


def Change;
def V;

def p1v = Max(-100, Min(100, (StochasticFull(kPeriod = 5, slowing_period = 3, averageType=averageType.EXPONENTIAL))) - 50) / 50.01;
def p2v = Max(-100, Min(100, (StochasticFull(KPeriod = 8, slowing_period = 5, averageType=averageType.EXPONENTIAL))) - 50) / 50.01;
def p3v = Max(-100, Min(100, (StochasticFull(KPeriod = 17, slowing_period = 5, averageType=averageType.EXPONENTIAL))) - 50) / 50.01;

if p2v > 0
Then {
    Change = if p1v <= p2v and p1v[1] > p2v[1] and p2v[1] > 0 then -1 else 0;
    V = CompoundValue(1,  Min (0, V[1]) + Change, 0);
}
else {
    Change = if p1v >= p2v and p1v[1] < p2v[1] and p2v[1] <= 0 then 1 else 0;
    V = CompoundValue (1,  Max (0, V[1]) + Change, 0);
}

DefineGlobalColor ("Trend Transition Buy", Color.Light_Green);
DefineGlobalColor ("TREND CHANGE Buy", Color.Green);
DefineGlobalColor ("Trend Transition Sell", Color.Light_RED);
DefineGlobalColor ("TREND CHANGE SELL", Color.RED);

AddVerticalLine (((p2v > 0 and p1v <= p2v and p1v[1] > p2v[1]) or (p2v < 0 and p1v >= p2v and p1v[1] < p2v[1])),
if AbsValue(V) > 1 then "TREND CHANGE" else "Trend Transition",
if V > 1 then
    GlobalColor ("TREND CHANGE BUY")
else if V == 1 then
    GlobalColor ("Trend Transition Buy")
else if V < -1 then
    GlobalColor ("TREND CHANGE SELL")
else GlobalColor ("Trend Transition Sell"));

#End
 
Last edited by a moderator:

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

NOTE: I use this indicator as a "heads up" only and don't make trades based on it. For trades I use the AsGoodAsItGets Indicator with the AsGoodTrendColorCandles_MTFs to show continued trend.
 
NOTE: I use this indicator as a "heads up" only and don't make trades based on it. For trades I use the AsGoodAsItGets Indicator with the AsGoodTrendColorCandles_MTFs to show continued trend.
I can’t seem to find the two you reference. Tried searching for them but wasn’t successful.
 
This is my Upper TrendChange Vertical Lines

Code:
##AsGood_Trend_VerticalLine

declare upper;

input Length =21;
input Reversal = 3.0;


def Change;
def V;

def p1v = Max(-100, Min(100, (StochasticFull(kPeriod = 5, slowing_period = 3, averageType=averageType.EXPONENTIAL))) - 50) / 50.01;
def p2v = Max(-100, Min(100, (StochasticFull(KPeriod = 8, slowing_period = 5, averageType=averageType.EXPONENTIAL))) - 50) / 50.01;
def p3v = Max(-100, Min(100, (StochasticFull(KPeriod = 17, slowing_period = 5, averageType=averageType.EXPONENTIAL))) - 50) / 50.01;

if p2v > 0
Then {
    Change = if p1v <= p2v and p1v[1] > p2v[1] and p2v[1] > 0 then -1 else 0;
    V = CompoundValue(1,  Min (0, V[1]) + Change, 0);
}
else {
    Change = if p1v >= p2v and p1v[1] < p2v[1] and p2v[1] <= 0 then 1 else 0;
    V = CompoundValue (1,  Max (0, V[1]) + Change, 0);
}

DefineGlobalColor ("Trend Transition Buy", Color.Light_Green);
DefineGlobalColor ("TREND CHANGE Buy", Color.Green);
DefineGlobalColor ("Trend Transition Sell", Color.Light_RED);
DefineGlobalColor ("TREND CHANGE SELL", Color.RED);

AddVerticalLine (((p2v > 0 and p1v <= p2v and p1v[1] > p2v[1]) or (p2v < 0 and p1v >= p2v and p1v[1] < p2v[1])),
if AbsValue(V) > 1 then "TREND CHANGE" else "Trend Transition",
if V > 1 then
    GlobalColor ("TREND CHANGE BUY")
else if V == 1 then
    GlobalColor ("Trend Transition Buy")
else if V < -1 then
    GlobalColor ("TREND CHANGE SELL")
else GlobalColor ("Trend Transition Sell"));

#End
How do you make the vertical lines thicker?
 
I'd like to see the AsGoodAsItGets Vertical Line indicator converted to a watchlist. In the watchlist I need to see 4 time frames, and to have a Red or Green color applied when AsGood fires. I want to see the status of Asgood on the 4 hour, Daily, 3 Day and Weekly time frames. I have found that when the Asgood vertical lines appear simultaneously on all 4 time frames (on or very near to the same date), often a long swing trade is available. The color of the watchlist column will be determined by the color of the most recent Asgood bar in each time aggregation. Any help is appreicated!

Here is a link to the Asgood Vetical Lines study I use: This is the basis for the desired watchlist.

https://usethinkscript.com/threads/asgood_trendverticalline-for-thinkorswim.13893/#post-122575
 
Last edited:

Similar threads

Not the exact question you're looking for?

Start a new thread and receive assistance from our community.

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