Topic: EA for daily timeframe

I have been trying to make a portfolio for trading daily time frame but when I run on demo I get a market closed error.  My broker's trading is from 1min past midnight so a trade signaled at 5secs after midnight is rejected which I think is the issue.  Anyone got any idea how to get round this problem?
Is there a setting somewhere in EA Studio that lets a trade be delayed by a short time and accept the market price at that time?

Re: EA for daily timeframe

This is known behaviour. Unfortunately, we don't have a ready solution for it yet, but we can develop one.

Which is your broker? I may test some ideas and come up with a fix.

Re: EA for daily timeframe

Thanks for the response.

Broker is IC Markets

Re: EA for daily timeframe

I just checked a fix, but it doesn't work.

bool  isTradeNotDisabled = true;

bool IsTradeNotDisabled()
  {
   bool isAllowed = SymbolInfoInteger(_Symbol,SYMBOL_TRADE_MODE) != SYMBOL_TRADE_MODE_DISABLED;

   if(!isAllowed && isTradeNotDisabled)
     {
      isTradeNotDisabled = false;
      Print("Trade disabled detected.");
     }
   if(isAllowed && !isTradeNotDisabled)
     {
      isTradeNotDisabled = true;
      Print("Trade enabled detected.");
     }

   return isAllowed;
  }

If you know how to test reliably if the market is closed/open please help.

Re: EA for daily timeframe

I'll try tonight in a more naive way.

      if(lastError == ERR_TRADE_DISABLED)
        {
         Print("Market is closed. Retry after 60 sec.");
         barTime = Time(0) + 60;
         break;
        }

If a trade gives LastError of "Market is closed" the expert will retry the operation in 60 seconds.
I put this code in both entry and exit.

We will know if it works in 03:45 hours.

Trade safe!

Re: EA for daily timeframe

Unfortunately, this doesn't work also.

I'll try to find what is going on on Monday evening.