alexgrover

Motion To Attraction Channels

Introduction

Channels are used a lot on technical-analysis, however most of the them rely on adding/subtracting a volatility indicator to a central tendency indicator, sometimes the central tendency indicator can even be replaced by pure price. A great channel who does not rely on this kind of architecture is the Donchian channels or the quartiles bands. Here i propose a channel similar to the one made by Richard Donchian with some additional abilities.

The Channels

In my indicator, Motion To Attraction mean that the movement of an object a attract an object b, but we can resume this approach by saying that the longer a trend period is, the smaller the distance between each channels, for example if the price create a new highest then the lowest will move toward this new highest, each time coming closer. The philosophy behind this is that the longer a trend is the more probable it is that she will end.

The code reflect it this way :

here the parameter controlling the channel A (upper)

c = change(b) ? nz(c) + alpha : change(a) ? 0 : nz(c)

this is traduced by : if channel b move then the parameter c become greater, if channel a move then reset the parameter, the parameter d do the same.

c is used to move the channel A, when c < 1 A is closer to the highest, when c = 1 A is in a central tendency point, when c > 1 A is closer to the lowest.

Slaving the Movement

It is possible to have a better control over the channels, this is done by making c and d always equal or lower than 1. Of course it could be another max value selected by the user.

In order to do that add c1 and d1 as parameter with c1 = c > 1 ? 1 : c, same with d1 but replace c by d.

Its safer to do this but i prefer how the channels act the other way, i will consider implementing this option in the future.

Conclusion

This channel indicator does not rely on past data thanks to recursion. The alpha variable at the start can also be adaptive, this let you make the channels adaptive even if such idea can add non desired results. Low length values can create effects where the lower channel can be greater than the higher one, this can be fixed directly in the code or using the method highlighted in the Slaving the Movement part.




Check out the indicators we are making at luxalgo: www.tradingview.com/u/LuxAlgo/
Script de código abierto

Siguiendo el verdadero espíritu de TradingView, el autor de este script lo ha publicado en código abierto, para que los traders puedan entenderlo y verificarlo. ¡Un hurra por el autor! Puede utilizarlo de forma gratuita, aunque si vuelve a utilizar este código en una publicación, debe cumplir con lo establecido en las Normas internas. Puede añadir este script a sus favoritos y usarlo en un gráfico.

Exención de responsabilidad

La información y las publicaciones que ofrecemos, no implican ni constituyen un asesoramiento financiero, ni de inversión, trading o cualquier otro tipo de consejo o recomendación emitida o respaldada por TradingView. Puede obtener información adicional en las Condiciones de uso.

¿Quiere utilizar este script en un gráfico?