OPEN-SOURCE SCRIPT

coates moving averages (cma)

This indicator uses three moving averages:

2 period low simple ma
2 period high simple ma
9 period least squares ma

The trend is determined by the angle of the moving averages, current close relative the the 9 least squares ma (lsm) and the current close relative to the prior two periods high and low.

When there are consecutive closes inside the prior two candles high and low then a range is signaled:

snapshot


In ranges the buy zone is between the lowest low and the lowest close of the current range. The sell zone is between the highest high and the highest close. The zones are adjusted as long as the new close is within the prior two candles range:

snapshot


When price closes above the 2 high ma and the 9 lsm then a bull trend is signaled if all moving averages are angled upward (as seen at #4 in the chart above and #1 the chart below ). If the 9 lsm and / or the 2 low ma continue to angle downward, following a close above the 2 high ma and 9 lsm, then a prolonged range or reversal is expected (#2 in the chart below):

snapshot

During a bull trend the buy zone is between the 2 low ma and the 9 lsm. The profit target is the 2 high ma:

snapshot

During dip buying opportunities price should resist closing below the 9 lsm. If there is one close below the 9 lsm then it is a canary in the coalmine that tells us to proceed with caution. This will often signal a range, based on the conditions outlined above. To avoid a prolonged range, or reversal, price needs to immediately react in the direction of the prevailing trend:

snapshot

snapshot


If the moving averages are angled down and the most recent close is below the 2 low ma and 9 lsm then trend is fully bearish:

snapshot

During a bear trend the short zone is between the 2 high ma and 9 lsm. The profit target is the 2 low ma:

snapshot

When the 2 high ma angles down and the 2 low ma angles up while price closes inside both mas then it indicates a cma squeeze:

snapshot

Volatility is expected in the direction of the breakout following the squeeze. In this situation traps / shakeouts are common. If there is a wick outside the cma, with a close inside, then it indicates a trap / shakeout. If there is a close outside the 2 high / low ma then it signals a breakout.

snapshot

A trend is considered balanced when the 9 lsm is roughly equidistant from the 2 low and 2 high mas. If the 9 lsm crosses the 2 high or 2 low ma then it signals exhaustion / imbalance.

snapshot

For a stop loss I use the prior three periods low, for bull trends, and the prior three periods high for bear trends. I would expect other reliable stops, such as the parabolic sar or bill williams fractal, to be effective as well. The default moving averages should be very effective on all timeframes and assets classes, however this indicator was developed for bitcoin with a focus on higher timeframes such as the 4h, daily and weekly.

As with any other technical indicator there will be bad signals. Proceed with caution and never risk more than you are willing to lose.





buyandsellsignalMoving AveragesstoplossSupport and ResistanceTrend Analysis

Open-source script

In true TradingView spirit, the author of this script has published it open-source, so traders can understand and verify it. Cheers to the author! You may use it for free, but reuse of this code in publication is governed by House rules. You can favorite it to use it on a chart.

Want to use this script on a chart?


emasar Indicator is available for purchase at alphanalysis.io/product/emasar/
Also on:

Disclaimer