INNER CODE UNIT · Python
directional_movement_plus
aticio/legitindicators · legitindicators.py:242
directional_movement_plus = max(high - high1, 0)
else:
directional_movement_plus = 0
if low1 - low > high - high1:
directional_movement_minus = max(low1 - low, 0)
else:
directional_movement_minus = 0
smoothed_true_range.append(smoothed_true_range[i-1] - (smoothed_true_range[i-1] / length) + trng)
smoothed_directional_movement_plus.append(smoothed_directional_movement_plus[i-1] - (smoothed_directional_movement_plus[i - 1] / length) + directional_movement_plus)
smoothed_directional_movement_minus.append(smoothed_directional_movement_minus[i-1] - (smoothed_directional_movement_minus[i - 1] / length) + directional_movement_minus)
di_plus = smoothed_directional_movement_plus[i] / smoothed_true_range[i] * 100
di_minus = smoothed_directional_movement_minus[i] / smoothed_true_range[i] * 100
dxi.append(abs(di_plus - di_minus) / (di_plus + di_minus) * 100)
szladxi.append(dxi[i] + (dxi[i] - dxi[i-round(lag)]))