Errors, bugs, questions - page 2438

 
Slava:

2. one type of frames is read in OnTesterPass, finished in OnTesterDeinit. Other frames are read in OnTesterDeinit

This feature does not allow us to work in real time with the results of calculated passes if there are several frames per pass.

 
It seems to be a purely methodological flaw here

Forum on trading, automated trading systems & strategy testing

Testing of Strategy Timetables with Autosubstitution of Results in EAs

Slava, 2013.04.10 15:04

void OnTesterDeinit()
  {
   string        name;
   ulong         pass;
   long          id;
   double        value;
   int           handle,i;
   BalanceInTime balance[];
   MqlRates      rates[];
//---
   FrameFirst();
   FrameFilter("",1);
   while(FrameNext(pass,name,id,value,balance))
     {
      handle=FileOpen(name+"_"+string(id)+"_"+IntegerToString(pass,5,'0')+".txt",FILE_WRITE|FILE_CSV|FILE_ANSI);
      if(handle!=INVALID_HANDLE)
        {
         for(i=0; i<ArraySize(balance); i++)
            FileWrite(handle,balance[i].date,EnumToString(balance[i].entry),DoubleToString(balance[i].price,5),DoubleToString(balance[i].balance,2));
         FileClose(handle);
        }
     }
//---
   FrameFirst();
   FrameFilter("",2);
   while(FrameNext(pass,name,id,value,rates))
     {
      handle=FileOpen(name+"_"+string(id)+"_"+IntegerToString(pass,5,'0')+".txt",FILE_WRITE|FILE_CSV|FILE_ANSI);
      if(handle!=INVALID_HANDLE)
        {
         for(i=0; i<ArraySize(rates); i++)
            FileWrite(handle,rates[i].time,DoubleToString(rates[i].open,5),DoubleToString(rates[i].high,5),DoubleToString(rates[i].low,5),DoubleToString(rates[i].close,5),string(rates[i].tick_volume));
         FileClose(handle);
        }
     }
//---
  }
Before FrameNext in the loop, it would be good to call ArrayFree on each pass of the loop.
 
Slava:

1. Yes. May be redundant.

2. one type of frames is read in OnTesterPass and finished in OnTesterDeinit. The remaining frames are read in OnTesterDeinit

This ability to transmit-receive several types of frames allowed us to correct some hard-to-reproduce errors in the tester. And frames were transmitted only if there was a difference with some reference value.

Earlier I mentioned loss of frames, if many frames are passed in one pass and there are problems with the agent - connection is broken - will something be done about this situation?

 
fxsaber:

Will you open the opt-format?

Yes.

In exchange for publishing the code to read the opt file

 
fxsaber:

This feature does not allow you to work in real time with the results of counted passes if there are several frames per pass.

Yes.

That's why we have to read frames of "non-core" type after optimization is finished.

 
Aleksey Vyazmikin:

Earlier I talked about frame loss, if many frames are transmitted in one pass and there were problems with the agent - a break in communication - will something be done about this situation?

What can you do?

The optimization result will in any case leave earlier and faster than its frame. If the agent has been stalled (computer shutdown, service stopped), there is definitely nothing to be done.

We could try to do the following: until the frame is sent, don't send the result. But it is unknown when we will correct it.

 
fxsaber:
This seems to be a purely methodological flaw
Before FrameNext in the loop, it's a good idea to call ArrayFree on every loop pass.

We avoid unnecessary memory reallocation.

In this case there is 99% probability that the array buffer will be allocated once

 
Slava:

What can you do?

The result of the optimization will anyway leave earlier and faster than its frame. If the agent has been stalled (computer shutdown, service stopped), there's exactly nothing you can do about it.

We could try the following: until a frame is sent, don't send the result. But it is not known when we will correct it.

Maybe before transmission of frames, you can say how many frames are expected, and if it's less than expected and the agent is unavailable, then give the pass to another agent and overwrite the frames already received?

Or in the body of each frame write the total number and its sequence number in that number, and in the same way, if all did not come, reoptimize.
 
Slava:

Yes.

In exchange for publishing the code to read the opt file

I'm even more interested in the recording. I'll do the reading, if the format is known.

 
Aleksey Vyazmikin:

Can you tell how many frames are expected before you start transmitting, and if less than expected arrived and the agent is unavailable, then give the pass to another agent and overwrite the frames already received?

Or in the body of each frame to write the total number and its sequence number in this quantity, and the same way, if all did not come, re-optimize.

What if not every pass returns a frame?

I gave above an example on error catching in the tester. Frames were sent only when some result value did not coincide with the benchmark