Library "lib_momentum" This library calculates the momentum, derived from a sample range of prior candles. Depending on set MomentumType it either deduces the momentum from the price, volume, or a product of both. If price/product are selected, you can choose from SampleType if only candle body, full range from high to low or a combination of both (body counts full, wicks half for each direction) should be used. Optional: You can choose to normalize the results, dividing each value by its average (normalization_ma_length, normalization_ma). This will allow comparison between different instruments. For the normalization Moving Average you can choose any currently supported in my lib_no_delay.
get_momentum(momentum_type, sample_type, sample_length, normalization_ma_length, normalization_ma) Parameters: momentum_type (series MomentumType): select one of MomentumType.[Price, Volume, Product] to sample the price, volume or a product of both sample_type (series SampleType): select one of SampleType.[Body, Range, Body_Range] to sample the body, total range from high to low or a combination of both (body count full, wicks half for each direction) sample_length (simple int): how many candles should be sampled (including the current) normalization_ma_length (simple int): if you want to normalize results (momentum / momentum average) this sets the period for the average. (default = 0 => no normalization) normalization_ma (simple MovingAverage enum from robbatt/lib_no_delay/9): is the type of moving average to normalize / compare with Returns: returns the current momentum [total, up, down] where the total line is not just (up - down) but also sampled over the sample_length and can therefore be used as trend indicator. If up/down fail to reach total's level it's a sign of decreasing momentum, if up/down exceed total the trend it's a sign of increasing momentum.
Siguiendo fielmente el espíritu TradingView, el autor ha publicado este código Pine como una biblioteca de código abierto, permitiendo que otros programadores de Pine en nuestra comunidad lo utilicen de nuevo. ¡Olé por el autor! Puede utilizar esta biblioteca de forma privada o en otras publicaciones de código abierto, pero tenga en cuenta que la reutilización de este código en una publicación se rige por las Normas internas.
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.