Radius Trend [ChartPrime] for ThinkOrSwim

samer800

Moderator - Expert
VIP
Lifetime
8NLhq6p.png


Author Message:

The Radius Trend [ChartPrime] indicator is an innovative technical analysis tool designed to visualize market trends using a dynamic, radius-based approach. By incorporating adaptive bands that adjust based on price action and volatility, this indicator provides traders with a unique perspective on trend direction, strength, and potential reversal points.

The Radius Trend concept involves creating a dynamic trend line that adjusts its angle and position based on market movements, similar to a radius sweeping across a chart. This approach allows for a more fluid and adaptive trend analysis compared to traditional linear trend lines.

CODE:

CSS:
#// Indicator For TOS
#// ©ChartPrime
#indicator("Radius Trend [ChartPrime]", overlay = true)
# Convertted by Sam4Cok@Samer800    - 08/2024

input RadiusStep = 0.15;         # "Radius Step"
input StartPointsDistance = 2.0; # "Start Points Distance"

def na = Double.NaN;
def x = x[1] + 1;
def bar = CompoundValue(1, x , 1); #if !isNaN(close) then BarNumber() else bar[1];
#// Initialize variables
#bool trend       = na
def multi1; # = 0.
def multi2; # = 0.
def n = 3;
def band; #   = 0.

#// 𝙄𝙉𝘿𝙄𝘾𝘼𝙏𝙊𝙍 𝘾𝘼𝙇𝘾𝙐𝙇𝘼𝙏𝙄𝙊𝙉𝙎
#// Calculate distances for band placement
def tr = AbsValue(high - low);
def lookback = 100;
def distance  = Average(tr, lookback) * StartPointsDistance;
def distance1 = Average(tr, lookback) * 0.2;

def trend = CompoundValue(1, if close < (if !band[1] then low * 0.8 else band[1]) then no else
                             if close > (if !band[1] then low * 0.8 else band[1]) then yes else trend[1], yes);

#// Adjust band on trend changes
if trend[1] == no and (trend - trend[1]) {
    multi1 = multi1[1];
    multi2 = multi2[1];
    band = low - distance;
} else
if trend[1] == yes and (trend - trend[1]) {
    multi1 = multi1[1];
    multi2 = multi2[1];
    band = high + distance;
} else
if (bar % n) == 0 and trend {
    multi1 = 0;
    multi2 = multi2[1] + RadiusStep;
    band   = band[1] + distance1 * multi2;
} else
if (bar % n) == 0 and !trend {
    multi1 = multi1[1] + RadiusStep;
    multi2 = 0 ;
    band   = band[1] - distance1 * multi1;
} else {
    multi1 = multi1[1];
    multi2 = multi2[1];
    band = (if !band[1] then low * 0.8 else band[1]);
}

#// Smooth the band
def Sband = Average(band, n);

#// Calculate upper and lower bands
def band_upper = if bar < 1 then Average(band + atr(lookback) * 0.5, n) else Average(band + distance * 0.5, n);
def band_lower = if bar < 1 then Average(band - atr(lookback) * 0.5, n) else Average(band - distance * 0.5, n);
def band1      = if trend then band_upper else band_lower;

#// Plot the outer band
plot radius1 = if (trend == trend[1]) and band1 then band1 else na;
plot trendLine = if (trend - trend[1]) then na else Sband;
def p2 = Average(hl2, 20);

radius1.SetStyle(Curve.LONG_DASH);
radius1.SetDefaultColor(Color.GRAY);
trendLine.AssignValueColor(if trend then Color.GREEN else Color.RED);

def trend2 = trend;
def diff = band - p2;

AddCloud(if trend2  then trendLine else na, p2 + (trendLine - p2) / 1.5, Color.DARK_GREEN, Color.DARK_GREEN);
AddCloud(if !trend2 then trendLine else na, p2 + (trendLine - p2) / 1.5, Color.DARK_RED, Color.DARK_RED);
AddCloud(radius1, trendLine, Color.DARK_GREEN, Color.DARK_RED);

#-- END of CODE
 

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
475 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