I want to test a trading system with the strategy tester (30 Minute timeframe). Trading this system I first decide discretionally whether I determine the Market to be long or short. So for testing the system in the Strategy Tester I need to define a certein period of time, let's say from Jan. 1st 2017 20:00 h until Feb. 20th 2017 10:00 h. I cant't work it out. I can programm in another programming language similar to Trade Station (called Equilla) but I'm new to mql4. I've tried in the file below to 'find' the period seareched for, but defined periods of time only work out for me for reoccuring events during the day, like every day from 9:00 to 18:00 and probably every week or fixed dates during the months. Here what I did to define the period I was looking for:
Is it possible to define a given period of time in mql4 that covers any time series, ranging from hour to day to month? Please..................
thank you for helping so much. I also found a good example here: https://www.mql5.com/en/articles/585.Your Question: 'Time2 minus time1 (plus one) is the number of seconds between those times. Why do you care?'Answer: I though maybe the program structure could identity by each second which period of time it refers to. Just thinking......For finding the defined period I tried to followed your instructions. But still it wouldn't work and gives me all trades for the period chosen in the Strategy Tester 'use date' box.
Do you have another clou for finding a defined period of time? Syntax is quite a hard job for beginners.
thank you for helping so much. ...
whroeder1: The strategy tester now works!!!!!!!!!!!! THANK YOU SO MUCH !!!!!!!!!!!!!!!!!
1. Sorry, but the 'reply' button only appears at certain instances. I didn't find it and so I clicked on any button I could see.
2. I had a problem understanding the way the function TimeCurrent() works. Quoting the documentation:
'In the OnTick() handler, this function returns the time of the received handled tick. In other cases (for example, call in handlers OnInit(), OnDeinit(), OnTimer() and so on) this is the time of the last quote receipt for any symbol available in the "Market Watch" window, the time shown in the title of this window.'
3. So it is neccessary to refer to the TimeCurrent() for the program to 'find' the variables first_time and second_time unconditionally. The variable 'now' at any rate no longer refers to time of the last tick the server receives. Instead the function TimeCurrent() with the variables 'now' ( with the variable 'first_time' and 'second_time') is found in a defined intervall of certain dates. Therefore it is not neccessary to define 'first_time < second_time' additionally.
That's at least how I understand it and I hope I didn't mix up my English.....