Welcome to NexusFi: the best trading community on the planet, with over 150,000 members Sign Up Now for Free
Genuine reviews from real traders, not fake reviews from stealth vendors
Quality education from leading professional traders
We are a friendly, helpful, and positive community
We do not tolerate rude behavior, trolling, or vendors advertising in posts
We are here to help, just let us know what you need
You'll need to register in order to view the content of the threads and start contributing to our community. It's free for basic access, or support us by becoming an Elite Member -- see if you qualify for a discount below.
-- Big Mike, Site Administrator
(If you already have an account, login at the top of the page)
I think this is close to what you are looking for (function XAverage_a). I am struggling myself to come to terms with the syntax of EasyLanguage, while trying to implement the QQE indicator, so please test it to see if you are comfortable with the result compared to the ordinary EMA
I created a test myself, and I am disappointed to see that they are not 100% identical. The code is based on XAverage, and I cannot yet see where the small difference come from, but it is slightly different. Perhaps I will know when I have gained more experience with EasyLanguage myself.
Here is the indicator used to compare the two
inputs:
Price( Close ),
Value1Color( green ),
Value2Color( Yellow ) ;
Arrays:
buffer[100](0);
variables:
emaNormal( 0 ), j(0) , emaArr(0);
I tried this at first glance, too. But I think the problem is that the XAverage code is looking at the previous value in the dataseries [1], whereas when you use the array it is incremented so that the most recent value is not [0] or [1] but is instead the currentbar number.
So you would need to inverse the array, or the XAverage math, and this is where I got stuck.
It matches the built-in XAverage EMA. But it is unusable because it is so slow.
The small change is:
PriceValue[Array_GetMaxIndex(PriceValue)-1]
I also tried creating a new array and just copying the last 'length' into it, but because this happens on every new bar, it is equally as slow. The issue seems to be moving to the end of array backwards.
If your array size matches the currentbar figure, you could skip the Array_GetMaxIndex() function and just use currentbar, it is faster - but still somewhat slow.
Ok, I see why we got different results. Your function did not give the correct result on my side, and it is because the array that I tested with had the last price in index 0 and not the other way around. Not sure how to speed up the lookup of the last/max index when the data is stored the other way around.