How to define limit value of this indicator in order to reduce cpu usage?
Your code is broken: You haven't declared all arrays.
You do a terrible thing -
ArrayResize(iMAonVolume,rates_total+1,rates_total+1); ArrayResize(ExtSupResBuffer,rates_total+1,rates_total+1); ArrayResize(ExtVolumeBuffer,rates_total+1,rates_total+1); ArrayResize(ExtTrendBuffer,rates_total+1,rates_total+1); ArrayResize(ExtReversalBuffer,rates_total+1,rates_total+1); ArrayResize(ExtUIBuffer,rates_total+1,rates_total+1); ArrayResize(ExtVolumeColor,rates_total+1,rates_total+1); ArrayResize(ExtUIColor,rates_total+1,rates_total+1); ArrayResize(ExtTrendColor,rates_total+1,rates_total+1); ArrayResize(ExtSupResColor,rates_total+1,rates_total+1); ArrayResize(ExtReversalColor,rates_total+1,rates_total+1); for(i=limit; i<rates_total; i++) { ArrayResize(ExtSupResBuffer,i+1,rates_total+1); ArrayResize(ExtVolumeBuffer,i+1,rates_total+1); ArrayResize(ExtTrendBuffer,i+1,rates_total+1); ArrayResize(ExtReversalBuffer,i+1,rates_total+1); ArrayResize(ExtSupResColor,i+1,rates_total+1); ArrayResize(ExtVolumeColor,i+1,rates_total+1); ArrayResize(ExtUIColor,i+1,rates_total+1); ArrayResize(ExtTrendColor,i+1,rates_total+1); ArrayResize(ExtUIBuffer,i+1,rates_total+1); ArrayResize(ExtReversalColor,i+1,rates_total+1);
In general, a tip: throw out this code. Take the MQL Wizard and create a template. Then start filling in the code carefully.
The problem is that this indicator is working properly by itself, but when i call it from a script for multiple symbols, after script ended cpu usage keeps high around 95% so that I should restart Terminal to run MT5 again.
I have used profiling and found that there should be something wrong about this indicator. specifically i think the "limit" value.
So, please tell me how should I change the coding to stop calculating excessively.