ExponentialAverage – Map to Bloomberg

Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #100947 quote
    Paget76
    Participant
    New

    Hi all,

    I am trying to get my exponential moving average to return figures that map to those given by Bloomberg (with price tolerance, of course). I have the units set to 5 minutes (testing against DAX), and am running (for example) ExponentialAverage[100](Close). However, the results I am getting are different enough to be causing issues.

    One thought I had was that the PRT averages run for the last n units regardless of time, whereas I believe Bbg only run for values when the markets are open. I don’t know if there is a way around this.

    Another thought is simply that the underlying calculation is different, although that would surprise me.

    Has anyone had experience with this, or is able to give me some guidance?

    Many thanks,

    Richard

    #100951 quote
    swapping
    Participant
    Master

    This is it ?

    open_ema.png open_ema.png
    #100953 quote
    Vonasi
    Moderator
    Master

    PRT averages run for the last n units regardless of time, whereas I believe Bbg only run for values when the markets are open.

    This is most likely your issue. Due to the lack of arrays in PRT coding the only way to get the same result would be to store the last 100 values in 100 different variables while the market is open and then store the latest value and shift all the previous variable values and forgetting the first one.

    Something like (except that this is just for an average with a lookback of 4 and just a simple average:

    if opentime >= 130000 and opentime < 220000 then 
    a1 = a2 
    a2 = a3 
    a3 = a4 
    a4 = close 
    endif 
    
    average4 = (a1 + a2 + a3 + a4) / 4 
    
    return average4

    Your question is more of an indicator question than a platform question so I have moved it to the ProBuilder forum.

    #101049 quote
    Paget76
    Participant
    New

    Thanks – as someone from a programming background I do find the PRT language exasperatingly limited at times. It took me quite a while to realise that it didn’t allow text variables, which is just downright odd!

    Do you know what the code would be for an exponential moving average, as calculated by Bloomberg or by PRT?

    Also, would it work to limit the market times in the general template settings, as that seems to limit the values shown in the charts, which is presumably what the indicators are based on? I have tried to check, but I am having (unrelated) issues getting the detailed results window up for my probacktest…

    #101050 quote
    robertogozzi
    Moderator
    Master

    Many features are missing, arrays, text, integer & date data types,

    Unfortunately they are not easy to support and it’s not likely we are gonna have them before long!

    You may try using these averages, setting their time range https://www.prorealcode.com/prorealtime-indicators/time-range-moving-averages-simple-exponential-weighted-trsma-trema-trwma/

    It could be a workaround.

    Paget76 thanked this post
    #101052 quote
    Paget76
    Participant
    New

    Thanks – looks like it could be an answer. Not terribly efficient, but hopefully not enough to impact.

Viewing 6 posts - 1 through 6 (of 6 total)
  • You must be logged in to reply to this topic.

ExponentialAverage – Map to Bloomberg


ProBuilder: Indicators & Custom Tools

New Reply
Author
author-avatar
Paget76 @paget76 Participant
Summary

This topic contains 5 replies,
has 4 voices, and was last updated by Paget76
6 years, 7 months ago.

Topic Details
Forum: ProBuilder: Indicators & Custom Tools
Language: English
Started: 06/18/2019
Status: Active
Attachments: 1 files
Logo Logo
Loading...