Source: https://fxcodebase.com/code/viewtopic.php?f=17&t=66105
Forum: 17 · Topic 66105 · 20 post(s)
Apprentice · Sat May 05, 2018 7:37 am

Based on the request. viewtopic.php?f=27&t=65963 Will give you the ability to create custom equal weighted index.
Will produce 100 every time average rate for currencies coincides with the values of the first candle in data set.
AUD/CAD 0.96838 AUD/CHF 0.75327 AUD/JPY 82.190 Would produce a sum of 83.91165 and average of 27.97055.
MT4/MQ4 version viewtopic.php?f=38&t=68601
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 · 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!!
Apprentice · Mon May 07, 2018 4:18 am
Additional “Base” , currency pairs added.
Apprentice · Mon May 07, 2018 4:39 am
Arithmetic Mean.lua added.
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??
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!
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.
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!
Apprentice · Thu May 10, 2018 4:16 am
Simple Arithmetic Mean.lua added.
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…
Apprentice · Mon May 14, 2018 6:21 am
Try it now.
speakinmymind · Mon May 14, 2018 8:40 pm
Could you automate this process for me?
The Simple Arithmetic Mean is used four times:
Selected Pair (EUR/USD in this example)
(GBP is base in this example) Put GBP on left of quote and use both currencies in the selected pair. (Here it would be GBP/USD and GBP/EUR).
Recipricol of step 2. (Here it would be USD/GBP and EUR/GBP.
Add step 2 and 3 to create a midpoint. (Here it would be GBP/USD, GBP/EUR, USD/GBP, and EUR/GBP
The only thing the user should be able to change is the base currency. All JPY related quotes should have a 0.01 weight.
Thanks!
Apprentice · Tue May 15, 2018 8:14 am
Try this version. viewtopic.php?f=17&t=66125
jusiur · Sat Jun 22, 2019 7:59 pm
Thank you for those indies, may I ask if it´s possible an MT4 version of Simple Arithmetic Mean please? really we have here a very valuable tool, good concept and good work. Thanks again Apprentice & speakinmymind !!
Apprentice · Sun Jun 23, 2019 11:32 am
Your request is added to the development list under Id Number 4742
Apprentice · Tue Jun 25, 2019 4:46 am
MT4/MQ4 version viewtopic.php?f=38&t=68601
jusiur · Tue Jun 25, 2019 8:46 pm
Apprentice wrote: MT4/MQ4 version viewtopic.php?f=38&t=68601
I appreciate your help, thank you
speakinmymind · Sun Jul 23, 2023 10:01 pm
Can you make a Simple Mean that will use indicator input?
I want to select (and customize data source) on two indicators and produce the mean in a line.
It would also help to be able to select which data stream for indicators that have more than one.
Thanks!
Apprentice · Tue Jul 25, 2023 5:24 am
We have added your request to the development list. Development reference 639.
Apprentice · Tue Jul 25, 2023 11:22 am
Try this version. https://fxcodebase.com/code/viewtopic.php?f=17&t=73968