ExponentialAverage – Map to Bloomberg
Forums › ProRealTime English forum › ProBuilder support › ExponentialAverage – Map to Bloomberg
- This topic has 5 replies, 4 voices, and was last updated 5 years ago by Paget76.
-
-
06/18/2019 at 10:25 AM #100947
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
06/18/2019 at 12:07 PM #10095106/18/2019 at 12:47 PM #100953PRT 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:
12345678910if opentime >= 130000 and opentime < 220000 thena1 = a2a2 = a3a3 = a4a4 = closeendifaverage4 = (a1 + a2 + a3 + a4) / 4return average4Your question is more of an indicator question than a platform question so I have moved it to the ProBuilder forum.
06/19/2019 at 1:05 PM #101049Thanks – 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…
06/19/2019 at 1:15 PM #101050Many 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.
1 user thanked author for this post.
06/19/2019 at 1:36 PM #101052robertogozzi wrote:
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/Thanks – looks like it could be an answer. Not terribly efficient, but hopefully not enough to impact.
-
AuthorPosts