Distance in pips between two SMA

Forums ProRealTime English forum ProBuilder support Distance in pips between two SMA

  • This topic has 10 replies, 4 voices, and was last updated 3 years ago by avatarcfg.
Viewing 11 posts - 1 through 11 (of 11 total)
  • #168415
    cfg

    Hi,

    As the title says… anyone knows how to calculate and display in the chart the distance in pips between two simple moving averages? i.e. SMA 300 and SMA 20.

    Thnx

    cfg

    #168417

    Post your topic in the correct forum:
    _ ProRealTime Platform Support: only platform related issues.
    _ ProOrder: only strategy topics.
    _ ProBuilder: only indicator topics.
    _ ProScreener: only screener topics
    _ General Discussion: any other topics.
    _ Welcome New Members: for new forum members to introduce themselves.

    I moved it from ProRealTime Platform Support.

    Thank you 🙂

     

    This will display both averages and the difference as an average of the difference from Sma300 (to be added ON the price chart):

     

    This one will plot a line for the sole difference (to added BELOW the price chart):

     

    1 user thanked author for this post.
    avatar cfg
    #168692
    cfg

    Hi Robertogozzi, thank you for your message.

    Apologies for posting in the wrong section.

    Both indicators are working correctly, but I cannot understand the “difference”. The difference in pips between 119.868 and 119.739 cannot be 119.97, but 0.129. How can I display the difference in pips between the two simple moving averages? i.e +32 when sma20 superior to sma300 or -32 when sma20 is below sma300.

    Thanks in advance.

    cfg

     

    #168703

    Use the second one, you will have to put it UNDER the price (not ON it), like Macd, etc…, because they are not on the same scale.

    The first one cannot work, actually.

     

    #168704

    In both indicators 300.0 must be replaced with:

     

    #168774

    It can also like this:

     

    1 user thanked author for this post.
    avatar cfg
    #169239
    cfg

    Good morning Zigo,

    Thank you for your message.

    Your code seems to be working well, but it doesn’t display the pips in numbers as in your picture.

    Does it work for pro-real-time?

     

    #169251

    Because the rounding isn’t using decimals, try with a value transformed in points:

     

    1 user thanked author for this post.
    avatar cfg
    #169258
    cfg

    Hi Nicolas.

    Thank you for your message.

    It is working now, thank you so much. Can you clarify if this code would work with JPY pairs?

     

    #169269

    Yes it works OK with forex pairs with JPY.

    #169279
    cfg

    What about the XAUUSD?

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

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