Distance between 2 moving averages coding question

Forums ProRealTime English forum ProBuilder support Distance between 2 moving averages coding question

Viewing 5 posts - 1 through 5 (of 5 total)
  • #18561

    Hi,

    I’m using two exponential moving averages (30EMA and 50 EMA). My question is how do I code to check the distance between the 30EMA and 50EMA is less than 20 PIPS over the last 20 bars, and the 30 EMA has remained above the 50 EMA over the same period, i.e. last 20 bars?

     

    #18570

    Do the distance must be strictly less than 20 pips during all the last 20 bars?

    #18623

    Ideally I want to be able to control the distance between the two EMA’s, 20 PIPs was an example. The main aim is not to see the two ema’s drift wider and wider apart.

    #18642

    So this code should do the test for you:

     

    #18837

    Many thanks Nicolas.

Viewing 5 posts - 1 through 5 (of 5 total)

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