I’m not sure what you mean by your own DOpen (Dopen() is used to get the price of a previous daily open) but I’m guessing you want this?
// No positions will open before this time so only at or after this time but make sure you have the time zone on the platform to South Africa and that this code is at the beginning of your system
DEFPARAM FlatBefore = 083000
// Close all positions and don’t open any positions after
//DEFPARAM Flatafter = ??????
If that’s not what you’re after maybe a more specific example would help.