OPEN-SOURCE SCRIPT

Bars Since MA Cross Can Help Trend Following

Moving average crosses are popular signals for trend followers. Like many conditions, they tend to reverse after a certain amount of time. Today’s script is designed to help traders visualize and interpret these turns.

Bars Since MA Cross counts how many bars have passed since a fast-moving average crossed a slower MA. Bullish readings, with the faster MA above the slow, are plotted with positive numbers. The opposite is true for bearish conditions. Users can choose between simple, exponential and weighed average types. They can also mix them, comparing a fast EMA for a slower SMA, for example.

By default, it uses the 8- and 21-day EMAs.

This approach can help in a couple of ways. First, it can show divergences as a move weakens. Microsoft, in the example above, had a shorter bullish phase as it made new highs last December. This was followed by even briefer periods in January before the bear market took hold.

Likewise in May and June, Bars Since MA Cross showed shorter bearish periods before July’s counter-trend rally.

The second potential application is to know the age of a move. In this case look at September 2020. MSFT’s 8-day EMA was above its 21-day EMA for 108 days. The chart shows this was unusually long by previous examples, giving traders a sense the rally was getting long in the tooth. (MSFT would go the rest of that year without a new high.)

In conclusion, Bars Since MA Cross judges a move by its age and not its intensity. It’s a different approach that can sometimes help more than viewing simple price action.

TradeStation has, for decades, advanced the trading industry, providing access to stocks, options, futures and cryptocurrencies. See our Overview for more.

Important Information
TradeStation Securities, Inc., TradeStation Crypto, Inc., and TradeStation Technologies, Inc. are each wholly owned subsidiaries of TradeStation Group, Inc., all operating, and providing products and services, under the TradeStation brand and trademark. You Can Trade, Inc. is also a wholly owned subsidiary of TradeStation Group, Inc., operating under its own brand and trademarks. TradeStation Crypto, Inc. offers to self-directed investors and traders cryptocurrency brokerage services. It is neither licensed with the SEC or the CFTC nor is it a Member of NFA. When applying for, or purchasing, accounts, subscriptions, products, and services, it is important that you know which company you will be dealing with. Please click here for further important information explaining what this means.

This content is for informational and educational purposes only. This is not a recommendation regarding any investment or investment strategy. Any opinions expressed herein are those of the author and do not represent the views or opinions of TradeStation or any of its affiliates.

Investing involves risks. Past performance, whether actual or indicated by historical tests of strategies, is no guarantee of future performance or success. There is a possibility that you may sustain a loss equal to or greater than your entire investment regardless of which asset class you trade (equities, options, futures, or digital assets); therefore, you should not invest or risk money that you cannot afford to lose. Before trading any asset class, first read the relevant risk disclosure statements on the Important Documents page, found here: https://www.tradestation.com/important-information.
Moving AveragesTrend Analysis

开源脚本

本着真正的TradingView精神,此脚本的作者已将其开源,以便交易者可以理解和验证它。向作者致敬!您可以免费使用它,但在出版物中重复使用此代码受网站规则约束。 您可以收藏它以在图表上使用。

想在图表上使用此脚本?

免责声明