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.
MATHstatisticstechindicator

مكتبة باين

كمثال للقيم التي تتبناها TradingView، نشر المؤلف شيفرة باين كمكتبة مفتوحة المصدر بحيث يمكن لمبرمجي باين الآخرين من مجتمعنا استخدامه بحرية. تحياتنا للمؤلف! يمكنك استخدام هذه المكتبة بشكل خاص أو في منشورات أخرى مفتوحة المصدر، ولكن إعادة استخدام هذا الرمز في المنشور تحكمه قوانين الموقع.

إخلاء المسؤولية