Page 1 of 2

Average rates

PostPosted: Sat May 05, 2018 7:37 am
by Apprentice
EURUSD H1 (02-27-2017 0436).png

Based on the request.
viewtopic.php?f=27&t=65963
Will give you the ability to create custom equal weighted index.
Average rates.lua
(8.01 KiB) Downloaded 1001 times


Will produce 100 every time average rate for currencies coincides with the values of the first candle in data set.

Arithmetic Mean.lua
(7.17 KiB) Downloaded 844 times

AUD/CAD 0.96838
AUD/CHF 0.75327
AUD/JPY 82.190
Would produce a sum of 83.91165 and average of 27.97055.

Simple Arithmetic Mean.lua
(6.32 KiB) Downloaded 810 times


MT4/MQ4 version
viewtopic.php?f=38&t=68601

Re: Average rates

PostPosted: Sun May 06, 2018 1:03 pm
by speakinmymind
Could you explain the calculations to me? I may have a misunderstanding of how indexes work.

I selected EUR as the base, and EUR/USD for all of the four selections. I noticed the output line is the same visual as the EUR/USD pair, which was expected, however, the output data is 133.1048.

I expected an average of the four selections which would have came out to 1.19596

or a sum of the four selections which would have came out to 4.78384.

Can you help me understand what you did to get your output?

Re: Average rates

PostPosted: Sun May 06, 2018 4:42 pm
by speakinmymind
I did some further research and I understand the currency strength aspect provided here. Is it possible to add the other currencies to the "Base" list? Also the ability to use seven symbols in the calculation?


This indicator is useful but not quite what I was looking for. I'm looking for the same type of output, but instead of measuring the strength of the currency, I'd rather see a visual of what the historical average between multiple rates, i.e.:

AUD/CAD 0.96838
AUD/CHF 0.75327
AUD/JPY 82.190

Would produce an average output of: 27.97055.

or the sum which the output would be 83.91165

In addition, the ability to use the reciprocal would be needed in the following example:

NZD/USD 0.70198
USD/CAD 1.28467
USD/CHF 0.99937

to convert to:

USD/NZD 1.42454
USD/CAD 1.28467
USD/CHF 0.99937

Before producing the optional outputs:

average: 1.23619
sum: 3.70858

Please allow for as many input symbols as possible. Thanks!!

Re: Average rates

PostPosted: Mon May 07, 2018 4:18 am
by Apprentice
Additional "Base" , currency pairs added.

Re: Average rates

PostPosted: Mon May 07, 2018 4:39 am
by Apprentice
Arithmetic Mean.lua added.

Re: Average rates

PostPosted: Mon May 07, 2018 6:33 am
by speakinmymind
Thanks! The Arithmetic Mean.lua is what I was looking for, however, it seems to error out consistently whenever I zoom out to load more data, I'm hoping this can be fixed?? :D :D


With the Average Rates.lua indicator, is it possible to have the indicator automatically pre-select all subscribed instruments related to the base pair for its calculation?


Side note, is there any chance that a future version of Marketscope will allow the streaming of all symbols (opposed to the 20 symbols limit)?

Thanks!

Re: Average rates

PostPosted: Mon May 07, 2018 7:23 am
by Apprentice
Try it now.
TS can have an unlimited number of instruments.
You need to ask FXCM to increase this limit for your account.

Re: Average rates

PostPosted: Wed May 09, 2018 11:30 pm
by speakinmymind
Could you eliminate the "base currency" selection in the Arithmetic Mean.lua indicator?

It shouldn't be needed to find the simple mean between the two rates and not the currency strength.

Also, it prevents me from adding a symbol that isn't related.

For example, I cannot look at the mean between GBP/CAD, USD/CAD, and GBP/USD.

I get an error, as one of the three will not be related to the "base currency"

Thanks!

Re: Average rates

PostPosted: Thu May 10, 2018 4:16 am
by Apprentice
Simple Arithmetic Mean.lua added.

Re: Average rates

PostPosted: Thu May 10, 2018 2:22 pm
by speakinmymind
Thanks Apprentice!!

For the Simple Mean, could you please put the selected pairs in the legend of the indicator, and if inverse is selected it would reflect that? I know it's cosmetic... :D :D :D