I was wondering if there is a way to get data with an indicator or an EA that will count how many bars on average was the price not touching the Moving average. I tried searching the forum and other sources but I don't know what exactly should I search for. Thanks in advanse
If you have coding experience you could write a script to check each Bar against a moving average and count each one that doesnt touch. Look up iMA() and Bars. In the documentation.
Count the bars that have their low above the MA
and those that have their high below the MA
otherwise, they must have straddled the MA
Counting and holding values for calculations is beginner level coding. You probably need to read the MQL4 Book and Reference.
You can use For loops for counting and cycling through the Bars and variables for holding the values you want to perform calculations on.
To add comments, please log in or register