Troubles Building A Walk Forward Analysis Library

 

Hey everyone,

I've been working on this for quite sometime so I figured I would reach out and see if anyone has done this before and if they have any pointers. 

Basically all I'm trying to do is build an add on for mt5 ea's so that I can do an unanchored walk forward analysis (or rolling/continuous/floating..whatever you want to call it).

Anyways, I'm having trouble gathering the out of sample data and printing it to the report, I'm not a very good programmer so I've been working with some AI's to help and they figure

I need to calculate all the OOS on the side in a csv and then put it back into the report which makes sense but I'm having troubles tying it all together if I'm even doing it right. the part that does that is in the onTesterPass() as seen below:

         string fileName = "WFA_data.csv";
         int handle = FileOpen(fileName, FILE_WRITE|FILE_READ|FILE_CSV|FILE_COMMON|FILE_SHARE_WRITE);
         if(handle != INVALID_HANDLE)
           {
            Print("33");
            FileSeek(handle, 0, SEEK_END); // Append mode

            // Write CSV line: WindowStart, WindowEnd, ForwardStart, ForwardEnd, InSampleProfit, OutSampleProfit, StepOffset
            FileWrite(handle,
                      TimeToString(g_windowStart, TIME_DATE),
                      TimeToString(g_windowEnd, TIME_DATE),
                      TimeToString(g_forwardStart, TIME_DATE),
                      TimeToString(g_forwardEnd, TIME_DATE),
                      DoubleToString(g_inSampleProfit, 2),
                      DoubleToString(g_outSampleProfit, 2),
                      IntegerToString(offsetDays)
                     );
            Print("34");
            FileClose(handle);
            Print("35");
           }

If anyone wants to have a look feel free, ill post my include file and a simple range breakout ea i'm trying to practice implementing it with. if you look in the report screenshot you can see it's all blank.


Thanks!