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.

Moderator: admin

Average rates

Postby Apprentice » Sat May 05, 2018 7:37 am

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 997 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 840 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 807 times


MT4/MQ4 version
viewtopic.php?f=38&t=68601
User avatar
Apprentice
FXCodeBase: Confirmed User
 
Posts: 36341
Joined: Thu Dec 31, 2009 11:59 am
Location: Zagreb, Croatia

Re: Average rates

Postby speakinmymind » Sun May 06, 2018 1:03 pm

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
FXCodeBase: Graduate
 
Posts: 320
Joined: Thu Feb 28, 2013 8:18 am

Re: Average rates

Postby speakinmymind » Sun May 06, 2018 4:42 pm

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!!
speakinmymind
FXCodeBase: Graduate
 
Posts: 320
Joined: Thu Feb 28, 2013 8:18 am

Re: Average rates

Postby Apprentice » Mon May 07, 2018 4:18 am

Additional "Base" , currency pairs added.
User avatar
Apprentice
FXCodeBase: Confirmed User
 
Posts: 36341
Joined: Thu Dec 31, 2009 11:59 am
Location: Zagreb, Croatia

Re: Average rates

Postby Apprentice » Mon May 07, 2018 4:39 am

Arithmetic Mean.lua added.
User avatar
Apprentice
FXCodeBase: Confirmed User
 
Posts: 36341
Joined: Thu Dec 31, 2009 11:59 am
Location: Zagreb, Croatia

Re: Average rates

Postby speakinmymind » Mon May 07, 2018 6:33 am

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!
speakinmymind
FXCodeBase: Graduate
 
Posts: 320
Joined: Thu Feb 28, 2013 8:18 am

Re: Average rates

Postby Apprentice » Mon May 07, 2018 7:23 am

Try it now.
TS can have an unlimited number of instruments.
You need to ask FXCM to increase this limit for your account.
User avatar
Apprentice
FXCodeBase: Confirmed User
 
Posts: 36341
Joined: Thu Dec 31, 2009 11:59 am
Location: Zagreb, Croatia

Re: Average rates

Postby speakinmymind » Wed May 09, 2018 11:30 pm

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
FXCodeBase: Graduate
 
Posts: 320
Joined: Thu Feb 28, 2013 8:18 am

Re: Average rates

Postby Apprentice » Thu May 10, 2018 4:16 am

Simple Arithmetic Mean.lua added.
User avatar
Apprentice
FXCodeBase: Confirmed User
 
Posts: 36341
Joined: Thu Dec 31, 2009 11:59 am
Location: Zagreb, Croatia

Re: Average rates

Postby speakinmymind » Thu May 10, 2018 2:22 pm

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
speakinmymind
FXCodeBase: Graduate
 
Posts: 320
Joined: Thu Feb 28, 2013 8:18 am

Next

Return to Custom Indicators

Who is online

Users browsing this forum: Bing [Bot] and 52 guests