EA to check for closed order within given number of periods

 
I'm working on an EA and I want it to be able to check if there are any closed orders on the current symbol within the past so many periods. The amount of periods would be a variable. Is this possible?
 
deuce4884: check if there are any closed orders on the current symbol within the past so many periods. The amount of periods would be a variable. Is this possible?
Of course it possible. It's not even hard.
Do an OrderSelect loop on history, filter by magic number and pair, check if the OrderCloseTime is within your window.
 
WHRoeder:
deuce4884: check if there are any closed orders on the current symbol within the past so many periods. The amount of periods would be a variable. Is this possible?
Of course it possible. It's not even hard.
Do an OrderSelect loop on history, filter by magic number and pair, check if the OrderCloseTime is within your window.

Thanks WHRoeder for the reply. I read through the info at the link you gave me. I'm very new to this type of programming so forgive my ignorance. The code I reviewed is a little confusing to me. What I would like is a function that would return a true or false value based on whether or not it finds a closed order for the current market symbol within the past X amount of bar periods. What I reviewed may be what I need exactly, but I'm not sure...could you help by explaining it better to me or giving me another example. Thanks for your help.
Reason: