
You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
Are you saying that after if(rates_total-i >= rates_total-100);, when there are only 100 bars left to calculate, the iMAOnArray() function first recalculates the ALL array?
Are you saying that after if(rates_total-i >= rates_total-100);, when there are only 100 bars left to calculate, the iMAOnArray() function first recalculates the WHOLE array?
iMAOnArray
Returnsthe valueof Moving Averagetechnical indicator calculated on data stored in the array.
doubleiMAOnArray(
doublearray[],// array
inttotal,// number of elements
intma_period,//period
intma_shift,// shift of average
intma_method,// averaging method
int shift//shift
);
Parameters
array[]
[in] Array with data.
total
[in]Number of elements to calculate. 0 means all elements of the array.
That's right, the first call to iMAOnArray with 0 in the size value unconditionally calculates the entire array, and then it seems that only the last or at most the last 2 values are calculated, although who knows, it may recalculate everything... That's why it is slowing down. That's why it doesn't matter how many bars you want to get by offset, the entire array is counted anyway.
iMAOnArray
Returnsthe valueof Moving Averagetechnical indicator calculated on data stored in the array.
doubleiMAOnArray(
doublearray[],// array
inttotal,// number of elements
intma_period,//period
intma_shift,// shift of average
intma_method,// averaging method
int shift//shift
);
Parameters
array[]
[in] Array with data.
total
[in]Number of elements to calculate. 0 means all elements of the array.
That's right, the first call of iMAOnArray with 0 in the size value will certainly calculate the entire array, and then it seems that only the last or at most the last 2 values are calculated, although who knows, it may recalculate everything... That's why it is slowing down. That's why it doesn't matter how many bars you want to get by offset, the entire array is counted anyway.
Then I've got it wrong. So why is there no lag without your complicated calculations?
That's the question, why it lags when calling it from code, but not when just overlaying on the chart. Well, only the developers know where to look for the answer. I have a lot of complicated indicators in my charts and some of them even use recursive loops and they are supposed to "think long", but this is a simple task that takes so long to be calculated.
I'm not talking about a simple chart overlay. I'm talking about that test code. It's called there, not superimposed.
Still, I think I've beaten the crap through copying part of the array. And even MODE_LWMA recalculates the same way as counting the whole array.
Red is calculated on the entire history. Green is the last 50 bars.
...
Still, I think I've beaten the crap through copying part of the array. And even MODE_LWMA recalculates the same way as counting the whole array.
...
He's beaten it too.
I'm not talking about a simple chart overlay. I'm talking about that test code. It's called there, not overlaid.
Still, I think I've beaten the crap through copying part of the array. And even MODE_LWMA recalculates the same way as counting the whole array.
Red counts the entire history. Green is the last 50 bars.
I get the impression that you read my posts word for word or even sentence for sentence. Winning what? I wrote that I had such an idea (similar code with bar calculation limitation) immediately, and I immediately tried it and got no performance increase, because The array is still calculated entirely (total=0), the fact that you copy (fill in the buffer) just last 100 elements doesn't take away brake from calculations, it's not getting elements into the buffer, it's the calculation of array average, which is either calculated entirely (total=0) or shows results only first N elements (total=N), and the last are needed, change of indexing direction doesn't give the desired effect.
Apparently my messages are read through too... The previous code doesn't fit, I figured out where the mistake was made. The last screenshot shows a different approach, although only last 50 bars are counted.
I didn't post the code right away expecting such reactions as "it won't work anyway" because... The code is not secret, if you want to check how it will work with your indicator, let me know.
He won, too.
...
All you can do is make a fuss. Count up how many forum users you talk to with that tone of voice like you talk to me now. Be gone, Satan.That's how I've been talking to people like you. There's a coalition of you here, I know.
Even yesterday you wrote here about the failure of the array copying approach. It was pointed at LWMA - it worked. You don't have enough lazy to check it with EMA, and the host of holy power? Did you put a candle in the church?
You keep whipping and whipping, and every time you keep saying, "Oops, I've got it, I made a mistake.
A fight. If you had a little sense, long ago would have seen that the issue of this topic is resolved.
You wanted to show off once again, but you got your horns blown off and immediately lamented to Satan. Man!
Apparently my messages are read through too... The previous code doesn't fit, I figured out where the mistake was made. The last screenshot shows a different approach, although only last 50 bars are counted.
I didn't post the code right away expecting such reactions as "it won't work anyway" because... The code is not secret, if you want to check how it will work with your indicator, tell me.