Hi,
i learned coding since some years ago, but i think my coding ability is not improve much ... ... still learning thought ...
some times i found that my indicators are very slow, and some of them make my MT4 freeze ...
To avoid big load, i try to do these (please see example source code below) :
*) limit the bars to calculate, not using the whole Bars() => i use lookbackcandles here ...
*) trying to calculate it only once at a bar => using newbar check
*) if just calculating once in a bar, it is ok for small timeframe, but need to wait for long time if we use it at big timeframe like @H4 or @D1.
so i try to use refresh at every Xminutes => OnTimer()
*) i am not sure about the IndicatorCounted() function, still we need it ?
Questions :
*) Is there any clue / idea, which kind of coding tricks can be added here ?
*) Is my idea overlapped each other, or some of it are useless ?
in example, i try to calculate the average of an MA line (using iMAOnArray ... ) , but it seem does not work as expected ...
Any idea to solve this is very appreciate.
Thank you in advance
i learned coding since some years ago, but i think my coding ability is not improve much ... ... still learning thought ...
some times i found that my indicators are very slow, and some of them make my MT4 freeze ...
To avoid big load, i try to do these (please see example source code below) :
*) limit the bars to calculate, not using the whole Bars() => i use lookbackcandles here ...
*) trying to calculate it only once at a bar => using newbar check
*) if just calculating once in a bar, it is ok for small timeframe, but need to wait for long time if we use it at big timeframe like @H4 or @D1.
so i try to use refresh at every Xminutes => OnTimer()
*) i am not sure about the IndicatorCounted() function, still we need it ?
Questions :
*) Is there any clue / idea, which kind of coding tricks can be added here ?
*) Is my idea overlapped each other, or some of it are useless ?
in example, i try to calculate the average of an MA line (using iMAOnArray ... ) , but it seem does not work as expected ...
Any idea to solve this is very appreciate.
Thank you in advance
Attached File(s)
testIndicator.mq4
7 KB
|
84 downloads