As far as I can see you don't seem to consider the time difference of the broker (and Australia, and USA, and ...)
I would suggest you to normalize all your times on GMT considering the different DST of USA, London, Australia and you broker there is a lot to add and/or to subtract!
As far as I can see you don't seem to consider the time difference of the broker (and Australia, and USA, and ...)
I would suggest you to normalize all your times on GMT considering the different DST of USA, London, Australia and you broker there is a lot to add and/or to subtract!
The broker time is the same as mine (UK GMT). So in the case of the Aus200, the market opens at 11:00pm GMT and closes at 5:00am. I believe that's where the EA is getting confused.
If I open the MT4 platform at say 10:00pm (1 hour before the open), it thinks the trading day has already been and gone (because Australia finished at 5:00am that morning rather than about to start in an hour's time at 11:00pm GMT).
I think its the fact that the market hours are across 2 calender days that makes it complicated.
I think its the fact that the market hours are across 2 calender days that makes it complicated.
- 1 hour before open is correct, the day has ended and hasn't stated a new.
- What is complicated? If you trade [5..23] you test time >= 5 && time < 23. If you trade [23..5] test time >= 23 || time < 5.
- 1 hour before open is correct, the day has ended and hasn't stated a new.
- What is complicated? If you trade [5..23] you test time >= 5 && time < 23. If you trade [23..5] test time >= 23 || time < 5.
_orderTime = _startTime;
_orderTime.AddMins(InitCandlestickLength * Period());
CTime timeNow(TimeCurrent());
if ((timeNow >= _startTime) && !ForcePlaceOrder) _ordersPlaced = true;
if (timeNow >= _stopTighteningTime) _stopTightened = true;
ReadHolidays();
}
void DoTick()
{
Date todaysDate(TimeCurrent());
// check the day of the week.
if ((todaysDate.GetDayOfWeek() == dayofweek_saturday) || (todaysDate.GetDayOfWeek() == dayofweek_sunday))
{
return;
}
if (!_init)
{
NewDay();
_init = true;
}
// first check if we are on to a new day...
if (todaysDate.NotEquals(_pCurrentDate.Val)) NewDay();
if (_noTradeToday) return;
// are we past end of trading time?
CTime timeNow(TimeCurrent());
if (!_tradesClosed && (timeNow >= _endTime))
{
_log.Write(INFO,"We have reached the end of trading - closing all positions.");
pTradeManager.Val.RemoveOrdersAndCloseTrades(Magic);
_tradesClosed = true;
}
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
Hi,
I'm in the UK and I have an EA that will trade the Australian 200 Index.
This means that the Index opens 23:00 and closes 05:00, which is confusing my EA, because if I open the MT4 platform at say 22:00, it thinks the trading day has already been and gone (finished at 05:00 that morning rather than starting in an hour's time at 23:00).
How do I get the code to recognize the timing correctly?