Check if Magic Number order has been closed

 

I only want my strategy to open a position once per day.

Is there a way i can check if the order attached to a magic number was previously closed (so that a new order would not open)?


Cheers for any help.

 

use

datetime Midnight = TimeCurrent() - (TimeCurrent()%(PERIOD_D1 * 60));

then scan through OrderHistoryTotals to find trades that were opened/closed at a datetime > Midnight, then check the magic number

 

or you could set a flag to 1 when the order is opened, reset it to zero at midnight.