Average rates

Here you can post and download custom indicators. PLEASE: Do not start topics unless you are posting your own indicator, they will be moved to appropriate section even if you do.

Average rates

Based on the request.
viewtopic.php?f=27&t=65963
Will give you the ability to create custom equal weighted index.
Average rates.lua

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

Arithmetic Mean.lua

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

Simple Arithmetic Mean.lua

Apprentice
FXCodeBase: Confirmed User

Posts: 19598
Joined: Thu Dec 31, 2009 11:59 am
Location: Zagreb, Croatia

Re: Average rates

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?
speakinmymind

Posts: 310
Joined: Thu Feb 28, 2013 8:18 am

Re: Average rates

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/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/CHF 0.99937

to convert to:

USD/NZD 1.42454
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!!
speakinmymind

Posts: 310
Joined: Thu Feb 28, 2013 8:18 am

Re: Average rates

Apprentice
FXCodeBase: Confirmed User

Posts: 19598
Joined: Thu Dec 31, 2009 11:59 am
Location: Zagreb, Croatia

Re: Average rates

Apprentice
FXCodeBase: Confirmed User

Posts: 19598
Joined: Thu Dec 31, 2009 11:59 am
Location: Zagreb, Croatia

Re: Average rates

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??

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!
speakinmymind

Posts: 310
Joined: Thu Feb 28, 2013 8:18 am

Re: Average rates

Try it now.
TS can have an unlimited number of instruments.
You need to ask FXCM to increase this limit for your account.

Apprentice
FXCodeBase: Confirmed User

Posts: 19598
Joined: Thu Dec 31, 2009 11:59 am
Location: Zagreb, Croatia

Re: Average rates

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!
speakinmymind

Posts: 310
Joined: Thu Feb 28, 2013 8:18 am

Re: Average rates

Apprentice
FXCodeBase: Confirmed User

Posts: 19598
Joined: Thu Dec 31, 2009 11:59 am
Location: Zagreb, Croatia

Re: Average rates

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...
speakinmymind