How can I get the final closing price for the Friday session on a Saturday when the market is closed, via using an infinite loop ???

 

As soon as the day of the week turns from a Friday to a Saturday I then want to get the closing price (midpoint of the last Bid / Ask spread) for Friday forex trading session. I want to try and do this using an infinite loop as there will be no ticks coming through on Saturday as the FX market closes on Friday at 5pm New York time. Will the code below work? Or will it not work because the DayofWeek() function will not work as the broker server time and date will stop updating as of Friday 5pm?? Will this code work below:

int start()

{

If (Year() > 2002) // infinite loop as this condition will always be true.

{

If (DayOfWeek()==6) // ie Day of week = Saturday

{

Weekly_Closing_Price = (Bid+Ask) / 2 ; // capture last know bid and ask price as of when the market watch box stops undating which is Friday 5pm.

}

}

}

will this work???

thanks in advance. any help would be really appreciated.

Regards,

Rod

Reason: