Directional Movement Change

Forums ProRealTime English forum ProBuilder support Directional Movement Change

Viewing 6 posts - 1 through 6 (of 6 total)
  • #20034

    I want to make a indicator that calculates the change of Directional Movement (DI) in current bar, compared to last bar.

    Say the last bar has a value of 20 and the current bar has a value of 10. The change would then be = 100%.

    Say the last bar has a value of -10 and the current bar has a value of 30. The change would then be = 400%.

    Say the last bar has a value of 15 and the current bar has a value of -15. The change would then be = 200%.

    This is some what easy to do. But the problem i face is when a bar has a value that starts with 0. Or when there’s a negative value on either side.

    My code

     

    #20035

    It’s not necessary to calculate it so it displays exactly like the example above. What i want is a indicator that shows the strength of the change.

    #20062

    Hey Johan, you are reinventing the wheel. You can use the Rate Of Change (ROC) to compare the change between the current value and one of the past. In your case, you only want to compare the actual one to the previous one, so the ROC period should be set to 1 and your code should now look like this:

    Please tell me if I’m totally wrong, it’s Friday coding 🙂

     

    #20075

    Thanks Nicolas. Looks like this is the way to go. But still, get’s huge spikes when there’s a zero value involved. This becomes nasty noise when there’s a small rate of change in price action but the DI value flips side. See my attached image. If you look to the right, the ROC of the last green and the first red bar should have the spike. Does this make any sense? 🙂

    #20083

    Made some changes to get rid of the zero value.

    But what i don’t understand is how the ROC work. If i draw two rulers between the values of the one that i can see has the most ROC (distance) and the one where the indicator spikes. You can clearly see the it don’t correspond to the distance of the DI move. See image…

     

    #20086

    OK. The ruler drawing was a good thing to do 🙂  I think i found the solution.

     

    1 user thanked author for this post.
Viewing 6 posts - 1 through 6 (of 6 total)

Create your free account now and post your request to benefit from the help of the community
Register or Login