Please is this possible or correct? - page 3

 
Nkechi Sonia Kanu:

Fernando, thank you for reviving this topic, i really appreciate your effort.

i dont really know much of mql4, so i cant really say about using the OrdersHistoryTotal() or OrderTotal()... i have no idea which is the best, any suggestion will do.

i went through your code and i saw something; your subtracting an hour from the current time lets say for example the current time is 10:00-1:00=9:00, and the last closing time of an position is 10:00.

datetime OneHourBack = TimeCurrent() - 3600; 

Logically if( OrderCloseTime() >= OneHourBack ) ---10:00>=9:00 will always return false.

thats just my idea thought as a novice i might be wrong.

i believe we should use the reverse if( OrderCloseTime() =< OneHourBack )

Was it not your request that you only wanted to open new orders once closed orders were at least one hour old?

So, think about it! If the close time is greater than "OneHourBack", then obviously that order is still "not old enough", meaning that you still have at least one order that is too "young".

So, you cannot open new orders and therefore the function OneHour() must return "false" if there is any orders that are "still too young"!

In can only return "true" when ALL orders are "older" than one hour (i.e. all closed before "OneHourBack").

As for the exercise, you have to put in the effort and read the documentation, and look at the CodeBase examples and apply yourself to come up with some logic to solve the problem.

 
Fernando Carreiro:

As for the exercise, you have to put in the effort and read the documentation, and look at the CodeBase examples and apply yourself to come up with some logic to solve the problem.

 it was in the process of testing weather the code will work that i got the logic, thanks once again i owe you .

Since the code did work, the exercise  is too make sure that the EA works even when there is an open trade, right?

 
Nkechi Sonia Kanu: Since the code did work, the exercise  is too make sure that the EA works even when there is an open trade, right?
Correct! However, I don't know the rest of your code, so you will have to figure out if that is necessary or not, and if it is, then the exercise is to solve it!
 
Fernando Carreiro:
Correct! However, I don't know the rest of your code, so you will have to figure out if that is necessary or not, and if it is, then the exercise is to solve it!



THANK YOU FERNANDO CARREIRO and everyone else.


i know someday, someone else will be face with this same or similar challenge and might have no one to help out...but the solution is in this forum for everyone to see just make your search 

 
Nkechi Sonia Kanu: THANK YOU FERNANDO CARREIRO and everyone else.
You are welcome!