The cross of the price with a moving average is one of the easiest strategy in and could have worked if market price wasn't so noisy (In general periods of 1 to 20 produces the most whipsaws). So it is possible to create a moving average who can manage to escape those noisy periods and produce 0 whipsaws ?
This question was asked by one of my work colleagues and i responded : "well...almost 0".
The Motion Of A Moving Average
Moving Average estimate the Trend and will always have phase shift, they will still follow the price and cross it during high or low periods, and when a moving average cross the price during a low period you can expect lot of crosses.
In order to fix this behaviour a simple calculation exist :
FixMa = LongPeriodMA + MediumPeriodMA - ShortPeriodMA
We can see things in that way, the medium term MA is high pass filtered (subtracted) with a short term MA and the result is summed to a long term MA. We give more reactivity to our long term MA and thus creating some kind of repulsion motion with the price. Of course this can sometimes make the filter kinda zero-lag to some price periods (when the long term MA is near the price).
In red a of period 100 and in blue our repulsion moving average :
In the image the short term moving average period is 100, since the long term period of the moving average is equal to short term x 3 you could be interested to look at the comparison of our moving average with the actual long term moving average :
Less crosses, i think you can see it.
Something to notice is that its always a tradeoff between Signal Speed and Signal Numbers, a classic moving average create faster signals but also a high numbers of them, a classic trailing stop create less signals but slowest ones, our moving average is some kind of average between those indicators.
Improvement Methods - Choice of The Filter/More Terms
A bad behaviour of our filter can be fixed by using filters who tend to create less crosses with the price or by developing the formula of our filter by adding more terms as follow :
fixma = ma(Price,a) + ma(Price,b) + ma(Price,c) - ma(Price,d) - ma(Price,e)
where a > b > c > d > e. The number of subtractive terms is equal to the number of summing terms - 1.
Way To Use
This indicator can be used like any moving average with cross strategy. Can also be used as a trailing stop.
No tests have been made proving that this indicator provide levels, such signals come from more centered indicators.
Hope you enjoy
For any questions/demands feel free to pm me, i would be happy to help you :)
จากใจ TradingView ผู้เขียนสคริปต์นี้ได้เผยแพร่เป็นโอเพนซอร์ส เพื่อให้ผู้ค้าสามารถเข้าใจและตรวจสอบได้ ยินดีด้วย! คุณสามารถใช้มันได้ฟรี แต่การใช้โค๊ดนี้ซ้ำเพื่อการเผยเเพร่ อยู่ภายใต้ กฎของเรา คุณสามารถตั้งเป็นรายการโปรดเพื่อใช้กับชาร์ตได้
Become a Patreon and get access to exclusive technical indicators!
You can also check out some of the indicators I made for luxalgo : https://www.tradingview.com/u/LuxAlgo/#published-scripts