Lagging Indicator Accuracy In ThinkOrSwim

bobhobe

New member
Here is a moving average that identifies breakout points.
The accuracy of the breakout/breakdown points are not that good.
Any suggestions to improve accuracy would be appreciated.

Code:
declare lower;

input length = 15;
input multiplier = 2.0;

def price = close;

def average = MovingAverage(AverageType.SIMPLE, price, length);

def upperBand = average + multiplier * StDev(price, length);
def lowerBand = average - multiplier * StDev(price, length);

def isBullishBreakout = close > upperBand;
def isBearishBreakout = close < lowerBand;

plot MA = average;
plot BullishBreakoutPoints = if isBullishBreakout then close else Double.NaN;
plot BearishBreakoutPoints = if isBearishBreakout then close else Double.NaN;

BullishBreakoutPoints.SetPaintingStrategy(PaintingStrategy.POINTS);
BullishBreakoutPoints.SetLineWeight(2);
BullishBreakoutPoints.SetDefaultColor(Color.GREEN);

BearishBreakoutPoints.SetPaintingStrategy(PaintingStrategy.POINTS);
BearishBreakoutPoints.SetLineWeight(2);
BearishBreakoutPoints.SetDefaultColor(Color.RED);

MA.SetDefaultColor(Color.BLUE);
 
Last edited by a moderator:
Moving averages make poor strategies for several reasons:
  1. Lagging indicator: Moving averages are based on past price data, which means they are lagging indicators. They reflect historical price trends and do not accurately capture the current market conditions. By the time a moving average signal occurs, the price has already moved, resulting in suboptimal profits.
  2. Whipsaw movement: Moving averages generate false signals during periods of volatility and / or market noise. In such cases, the price crosses above or below the moving average multiple times, leading to frequent buying or selling signals. This whipsaw effect combined with the lag results in multiple losses which eats into trader confidence.
  3. Lack of adaptability: Moving averages use fixed lengths (e.g., 50-day or 200-day moving average) to calculate the average price. However, different securities and markets exhibit varying levels of volatility and trends. Fixed moving average periods are not suitable for all assets nor for all timeframes, leading to suboptimal results. Additionally, moving averages do not adjust dynamically to changing market conditions or emerging trends.
  4. Insensitivity to market reversals: Moving averages tend to be slow in responding to market reversals. They are smoother indicators that provide a broader view of the price trend, which can cause delays in identifying trend reversals. As a result, traders using moving averages, enter or exit trades too late, missing out on potential profits or suffering larger losses.
  5. Over-reliance on a single indicator: Relying solely on moving averages as a trading strategy is not recommended. The market is influenced by multiple factors, including fundamental news, economic data, geopolitical events, and investor sentiment. Ignoring these factors and relying solely on buy / sell signals overlooks critical information that significantly affects profits.
While moving averages can be useful as part of a broader trading strategy on the higher timeframes, use of lagging indicators on lower timeframes should be limited in scope.

@bobhobe
 
Last edited:

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