Help to make an EA for statistics

 

Hello,


Like the title, I want to make an EA for example to count bars that are above certain "variable value" and bellow another "variable value". The thing is I don't want to make trades, but to check for statistics after the test. For example how many of those bars comply with the condition, out of all the bars tested.

Is this even possible with MT5?

I know how to program a Expert to make trades using similar conditions, but wanted to know if it's possible to make this happen. Maybe I can just make a counter, but how can I obtain the value after? With comment()?

Is there a better way?

 

Yes you can do this in oninit() in a loop for example.

Store the end result in array or counter variables. 

 
Marco vd Heijden:

Yes you can do this in oninit() in a loop for example.

Store the end result in array or counter variables. 

Very interesting. So I need to write all the EA basically in the oninit() function? That part will be calculated at first and then the test is over right?

I need to test using some technical indicators, so I need to have all the code in there right(meaning handle, transformation the array to series, and "if" conditions)?

Thank you. Probably this can be done much more elegant on python and want to learn it in the future, but at the moment I can't do it on another language.