yes I know the function iMA() and Bars and I have some exp in coding. But the question is how to count and save the data. For example It should count the bars that were above or below (not touching the MA) a certain period and save that info somewhere and after that sum those numbers up and divide it to the number of crosses that the price made. I am just not sure if that is possible to do in MT4.
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
rori4:
yes I know the function iMA() and Bars and I have some exp in coding. But the question is how to count and save the data. For example It should count the bars that were above or below (not touching the MA) a certain period and save that info somewhere and after that sum those numbers up and divide it to the number of crosses that the price made. I am just not sure if that is possible to do in MT4.
yes I know the function iMA() and Bars and I have some exp in coding. But the question is how to count and save the data. For example It should count the bars that were above or below (not touching the MA) a certain period and save that info somewhere and after that sum those numbers up and divide it to the number of crosses that the price made. I am just not sure if that is possible to do in MT4.
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.
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
Hello guys,
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