Errors, bugs, questions - page 119

 
I read somewhere on a forum that comments during testing are not written to the log (in order to save disk space). In this regard, my question is: How can I debug the program in the tester? I tried printf and PrintFormat - nothing works in the tester, I even tried Alert.
 
Scriptong:
I read somewhere on a forum that comments during testing are not written to the log (in order to save disk space). So, my question is: How can I debug the program in the tester? I tried printf and PrintFormat - nothing works in the tester, I even tried Alert.
Look at the logs of test agents - everything is written there, but only for local agents. Remote agents do not write Print() output into logs for information saving reasons.
Документация по MQL5: Общие функции / Print
Документация по MQL5: Общие функции / Print
  • www.mql5.com
Общие функции / Print - Документация по MQL5
 

Checked. My agent is local (at least it is listed in Local). After running Expert Advisor in"Every tick" mode, the contents of "Log" tab matches the contents of agent log file (Expert Advisor and log files attached).

Yes, I forgot. The test period is "Last Month".

Files:
test.mq5  2 kb
 

Your log says "debug version of 'test.ex5', please recompile it".

It means, that EX5 intended for debugging (pressing F5 in the editor produces EX5 with debugging information) cannot be run in the tester.

We will make automatic recompilation of such EAs. In the meantime, manually recompile your EA.

 
alexvd:
And you can bring the full code?

And I've probably brought the whole thing up, I can't think of any other reason...

I will try to describe the situation in more detail.

There is a simple class "CMqlTimer", the task of this class is to track the moment of change of different time intervals: hour, day, week, month, year.

Everything is realized with very simple primitive, for example, if minutes equal 0 then "new hour" has come; if number of day of week doesn't correspond to stored in variable then day alternation ("00:00:00" by server time) has come. So on.

The analysis is performed when the timer is triggered, with an interval of 1 second, the work is done in CMqlTimer::OnTimer(). If the time interval changes, the function must be executed. For example if it is a "new" day the function CMqlTimer::OnRolloverDay() should be executed.


If we remove the rest of the code and write only OnRolloverDay(), the result will be the following:

//Function CMqlTimer.OnRolloverDay
bool CMqlTimer::OnRolloverDay()
//Дневной ролловер
{
//----------------------------------------------------------------------------//
//Work variables
string MessageText; //Text for message
int    UserEventID; //Identifier of the user event  

bool Result; //Returned importance
//----------------------------------------------------------------------------//

Result = true;

ResetLastError();

RolloverCountDay = RolloverCountDay+1;

UserEventID = CHARTEVENT_CUSTOM+15;
MessageText = StringFormat("Rollover Day (№ %d)",RolloverCountDay); //Можно просто "Rollover Day"
//We refer user event of the work chart
EventChartCustom(0,(ushort)UserEventID-CHARTEVENT_CUSTOM,0,0,MessageText);

//Checking for presence of the errors
  if(_LastError!=0)
  //В результате работы произошла ошибка
  {
  Result = false;  
  }
//----------------------------------------------------------------------------//
return(Result);
//----------------------------------------------------------------------------//
}

All user events are tracked and passed for handling to the main class

It looks something like this

void OnChartEvent(const int id,         // идентификатор события  
                  const long& lparam,   // параметр события типа long
                  const double& dparam, // параметр события типа double
                  const string& sparam  // параметр события типа string
                  )
{
//----------------------------------------------------------------------------//
//Work variables
//----------------------------------------------------------------------------//

//----------------------------------------------------------------------------//
//                          Processing user events                            //
//----------------------------------------------------------------------------//
  if(id>CHARTEVENT_CUSTOM)
  //User event is received
  {
  Expert.OnEvent(id,lparam,dparam,sparam);
  }
//----------------------------------------------------------------------------//  
}

So, the events don't reach OnChartEvent in testing mode, i.e. the Expert Advisor cannot handle an event sent using EventChartCustom in testing mode. Checked it by displaying all events in the log.

PS

The most interesting thing is that the demo all events reach, but in the tester is working refuses.

Prior to 319 all worked and in the tester, events were successfully handled. True the last release where it worked I can't say...

 
stringo:

Your log says "debug version of 'test.ex5', please recompile it".

It means, that EX5 intended for debugging (pressing F5 in the editor produces EX5 with debugging information) cannot be run in the tester.

We will make automatic recompilation of such EAs. In the meantime, manually recompile your EA.

Thank you. I didn't know there was a difference between files obtained by pressing F5 and F7.
 
Interesting:

And I've probably brought the whole thing up, I can't think of any other reason...

I will try to describe the situation in more detail.

...
Thank you. We'll think about it.
 

I do not understand what is wrong, EA works in the tester without errors and in the organiser's test machine also passes without errors.

When I run it on a demo account, I get an error when I try to open an order:

2010.09.06 13:26:50 Trades '101894' : failed instant buy 0.10 USDJPY at 84.179 [Unsupported filling mode]
2010.09.06 13:26:45 Trades '101894' : failed instant buy 0.10 USDCAD at 1.03689 [Unsupported filling mode]
2010.09.06 13:26:39 Trades '101894' : failed instant buy 0.10 USDJPY at 84.174 [Unsupported filling mode]
2010.09.06 13:26:34 Trades '101894' : failed instant buy 0.10 USDCAD at 1.03685 [Unsupported filling mode]
2010.09.06 13:26:28 Trades '101894' : failed instant buy 0.10 USDJPY at 84.174 [Unsupported filling mode]
2010.09.06 13:26:23 Trades '101894' : failed instant buy 0.10 USDCAD at 1.03688 [Unsupported filling mode]
2010.09.06 13:26:18 Trades '101894' : failed instant buy 0.10 USDJPY at 84.181 [Unsupported filling mode]

SELL request:

MqlTradeRequest request;
         request.action=TRADE_ACTION_DEAL;
         request.symbol=Symbol_[i];
         request.volume=volume_exe;
         request.price=SymbolInfoDouble(Symbol_[i], SYMBOL_BID);
         request.sl=0;
         request.tp=0;
         request.deviation=SymbolInfoInteger(Symbol_[i], SYMBOL_SPREAD)*2;
         request.type=ORDER_TYPE_SELL;
         request.type_filling=ORDER_FILLING_CANCEL

Request for BUY:

MqlTradeRequest request;
         request.action=TRADE_ACTION_DEAL;
         request.symbol=Symbol_[i];
         request.volume=volume_exe;
         request.price=SymbolInfoDouble(Symbol_[i], SYMBOL_ASK);
         request.sl=0;
         request.tp=0;
         request.deviation=SymbolInfoInteger(Symbol_[i], SYMBOL_SPREAD)*2;
         request.type=ORDER_TYPE_BUY;
         request.type_filling=ORDER_FILLING_CANCEL;

OrderCheck does not find any error.


 

Replaced ORDER_FILLING_CANCEL query with ORDER_FILLING_AON query , expert works.

But the problem remains, why is there such a difference in tester and server operation.


Документация по MQL5: Стандартные константы, перечисления и структуры / Торговые константы / Свойства ордеров
Документация по MQL5: Стандартные константы, перечисления и структуры / Торговые константы / Свойства ордеров
  • www.mql5.com
Стандартные константы, перечисления и структуры / Торговые константы / Свойства ордеров - Документация по MQL5
 

What a joke if the championship server becomes the other way round.