IBD PowerTrend For ThinkOrSwim

TETRIZ

New member
"Never fight the stock market — it's bigger than you are."
--IBD founder William O'Neil


Trade the power trends. Power Trend starts when these four events occur simultaneously on a major index:

The low is above the 21-day exponential moving average (EMA) for at least 10 days.
The 21-day EMA is above the 50-day simple moving average for at least five days.
The 50-day line is in an uptrend.
The market closes up for the day.
A power trend will usually end with the 21-day line crossing back below the 50-day.
gaw82Iu.png


Precise Pinescript code for IBD power trend Tradingview: https://www.tradingview.com/script/97Wco05D-IBD-PowerTrend/

This exactly matches the Power Trend test case https://www.investors.com/how-to-in...r-trend-is-when-you-really-need-to-be-buying/
 
Last edited by a moderator:

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

Precise Pinescript code for IBD power trend Tradingview: https://www.tradingview.com/script/97Wco05D-IBD-PowerTrend/

This exactly matches the Power Trend test case https://www.investors.com/how-to-in...r-trend-is-when-you-really-need-to-be-buying/
check the below:

CSS:
#// Indicator for TOS
#// © fyntrade
#indicator("IBD PowerTrend", overlay=false)
# Converted by Sam4Cok@Samer800    - 07/2024 - request from useThinkScript.com member
Declare lower;

input source = close;
input fastMovAvg = 21;
input slowMovAvg = 50;
input fastMovAvgType = AverageType.EXPONENTIAL;
input slowMovAvgType = AverageType.SIMPLE;

def na = Double.NaN;
def last = isNaN(close);
#// Calculate moving averages
def ema21 = MovingAverage(fastMovAvgType, source, fastMovAvg);
def sma50 = MovingAverage(slowMovAvgType, source, slowMovAvg);

#// Conditions for starting a power trend
#// Condition 1: The low is above the 21-day EMA for at least 10 days
def condition1 = lowest(low, 10) >= lowest(ema21, 10);

#// Condition 2: The 21-day EMA is above the 50-day SMA for at least five days
def barssince = if ema21 < sma50 then 0 else barssince[1] + 1;
def condition2 = barssince >= 5;

#// Condition 3: The 50-day SMA is in an uptrend (one day is sufficient)
def condition3 = sma50 > sma50[1];

#// Condition 4: The market closes up for the day
def condition4 = close > close[1];

#// Combine all conditions
def start_trend = condition1 and condition2 and condition3 and condition4;

#// End power trend conditions
def end_condition1 = (sma50 > ema21) and (sma50[1] <= ema21[1]);
def end_condition2 = close < (highest(high, 63) * 0.9) and close < sma50;
def end_trend = end_condition1 or end_condition2;

#// Maintain trend status
def trend = if (start_trend) then yes else
            if (end_trend) then no else trend[1];

#// Plot a line in a separate pane to indicate the power trend status
plot TrendLine = if trend then 0 else na;
plot zeroLine = if last then na else 0; # "PowerTrend Status"
TrendLine.SetLineWeight(3);
TrendLine.SetDefaultColor(Color.GREEN);
TrendLine.SetPaintingStrategy(PaintingStrategy.POINTS);
zeroLine.SetDefaultColor(Color.DARK_GRAY);


#-- END of CODE
 

Similar threads

Not the exact question you're looking for?

Start a new thread and receive assistance from our community.

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