optimization and writing of the input values ​​file

 
    input double TeckProfit=20;
    input double StopLoss=20;
    input uint input_value=0;

double deposit;
double TotalNetProfit;
double MaximalDrawdown;

//+------------------------------------------------------------------+
int OnInit()
  {
   return(INIT_SUCCEEDED);
  }
//+------------------------------------------------------------------+
void OnTick()
  {
  }
//+------------------------------------------------------------------+

double OnTester()
  {
  string name="";
   long   id=0;
   double data[];

   FrameAdd(name,id,input_value,data);
    deposit = TesterStatistics(STAT_INITIAL_DEPOSIT);
    TotalNetProfit = TesterStatistics(STAT_PROFIT);
    MaximalDrawdown = MathMax(TesterStatistics(STAT_EQUITY_DD),TesterStatistics(STAT_BALANCE_DD));
    

   return 0;
  }
//+------------------------------------------------------------------+
void OnTesterInit()
  {
   Print("Begin...");
  }
//+------------------------------------------------------------------+
void OnTesterPass()
  {
   
   ulong pass;
   string name="";
   long id;
   double value;
   ushort data[];





   while(FrameNext(pass,name,id,value,data))
     {
      Print(pass," ",name," ",id," ",value);

     appendLogfile(pass);
     }
  }
//+------------------------------------------------------------------+
void OnTesterDeinit()
  {
   Print("... end.");
  }
//+------------------------------------------------------------------+



  

void appendLogfile(ulong pass){

   //string terminal_data_path=TerminalInfoString(TERMINAL_DATA_PATH); 
   //Print(terminal_data_path+"\\"+"MQL5"+"\\"+"Files"+"\\"); 
   
   string InfoSottostante="InfoSottostante.csv"; 
   if (FileIsExist(InfoSottostante)==false){
      int InfoSottostantehandle=FileOpen(InfoSottostante,FILE_READ|FILE_WRITE|FILE_CSV); 
   FileSeek(InfoSottostantehandle,0,SEEK_END);
    string stamp0,stamp1,stamp2,stamp3,stamp4,stamp5;
    stamp0="Pass";
    stamp1="deposit";
    stamp2="TotalNetPr";
    stamp3="MaximalDrawdown";
    stamp4="TeckProfit";
    stamp5="StopLoss";

    FileWrite(InfoSottostantehandle,
    stamp0, 
    stamp1,
    stamp2,
    stamp3,
    stamp4,
    stamp5); 
    FileClose(InfoSottostantehandle); 
    
   }
   int InfoSottostantehandle=FileOpen(InfoSottostante,FILE_READ|FILE_WRITE|FILE_CSV); 
   FileSeek(InfoSottostantehandle,0,SEEK_END);
    string stamp0,stamp1,stamp2,stamp3,stamp4,stamp5;
    stamp0=DoubleToString(pass,0);
    stamp1=DoubleToString(deposit,0);
    stamp2=DoubleToString(TotalNetProfit,0);
    stamp3=DoubleToString(MaximalDrawdown,0);
    stamp4=DoubleToString(TeckProfit,0);
    stamp5=DoubleToString(StopLoss,0);


    FileWrite(InfoSottostantehandle,
    stamp0, 
    stamp1,
    stamp2,
    stamp3,
    stamp4,
    stamp5); 
    FileClose(InfoSottostantehandle); 
    
}


hello, in the file does not write the optimized variables. Thank you if you want to help me.

Files:
 
    #define STAT_VALUES_COUNT 100
    sinput double TeckProfit=20;
    sinput double StopLoss=20;


double deposit;
double TotalNetProfit;
double MaximalDrawdown;
double stat_values[STAT_VALUES_COUNT]; // Array for testing parameters

//+------------------------------------------------------------------+
int OnInit()
  {
   return(INIT_SUCCEEDED);
  }
//+------------------------------------------------------------------+
void OnTick()
  {
  }
//+------------------------------------------------------------------+

double OnTester()
  {
    deposit = TesterStatistics(STAT_INITIAL_DEPOSIT);
    TotalNetProfit = TesterStatistics(STAT_PROFIT);
    MaximalDrawdown = MathMax(TesterStatistics(STAT_EQUITY_DD),TesterStatistics(STAT_BALANCE_DD));
    stat_values[0]=deposit;
    stat_values[1]=TotalNetProfit;
    stat_values[2]=MaximalDrawdown;
    stat_values[3]=TeckProfit;
    stat_values[4]=StopLoss;
   

      FrameAdd("Statistics",1,0,stat_values);

     

   return 0;
  }
//+------------------------------------------------------------------+
void OnTesterInit()
  {
   Print("Begin...");
   ParameterSetRange("TeckProfit",       true, 0, 20, 50, 70);
   ParameterSetRange("StopLoss",         true, 0, 20, 50, 70);
  }
//+------------------------------------------------------------------+
void OnTesterPass()
  {
      string name ="";  // Public name/frame label
      ulong  pass =0;   // Number of the optimization pass at which the frame is added
      long   id   =0;   // Public id of the frame
      double val  =0.0; // Single numerical value of the frame
      string parameter[];
      uint   parameter_count=0;

  while( FrameNext(pass,name,id,val,stat_values)) {Print("********* ",pass);if( FrameInputs(pass,parameter,parameter_count))appendLogfile(pass);}
//--- Get the pass number, list of parameters, number of parameters
  //if( FrameInputs(pass,parameters_list,parameters_count))Print("********* ",pass);
   //appendLogfile(pass);
   
  }
//+------------------------------------------------------------------+
void OnTesterDeinit()
  {
   Print("... end.");
  }
//+------------------------------------------------------------------+



  

void appendLogfile(ulong pass){

   //string terminal_data_path=TerminalInfoString(TERMINAL_DATA_PATH); 
   //Print(terminal_data_path+"\\"+"MQL5"+"\\"+"Files"+"\\"); 
   
   string InfoSottostante="InfoSottostante.csv"; 
   if (FileIsExist(InfoSottostante)==false){
      int InfoSottostantehandle=FileOpen(InfoSottostante,FILE_READ|FILE_WRITE|FILE_CSV); 
   FileSeek(InfoSottostantehandle,0,SEEK_END);
    string stamp0,stamp1,stamp2,stamp3,stamp4,stamp5;
    stamp0="Pass";
    stamp1="deposit";
    stamp2="TotalNetPr";
    stamp3="MaximalDrawdown";
    stamp4="TeckProfit";
    stamp5="StopLoss";

    FileWrite(InfoSottostantehandle,
    stamp0, 
    stamp1,
    stamp2,
    stamp3,
    stamp4,
    stamp5); 
    FileClose(InfoSottostantehandle); 
    
   }
   int InfoSottostantehandle=FileOpen(InfoSottostante,FILE_READ|FILE_WRITE|FILE_CSV); 
   FileSeek(InfoSottostantehandle,0,SEEK_END);
    string stamp0,stamp1,stamp2,stamp3,stamp4,stamp5;
    stamp0=DoubleToString(pass,0);
    stamp1=DoubleToString(stat_values[0],0);
    stamp2=DoubleToString(stat_values[1],0);
    stamp3=DoubleToString(stat_values[2],0);
    stamp4=DoubleToString(stat_values[3],0);
    stamp5=DoubleToString(stat_values[4],0);


    FileWrite(InfoSottostantehandle,
    stamp0, 
    stamp1,
    stamp2,
    stamp3,
    stamp4,
    stamp5); 
    FileClose(InfoSottostantehandle); 
    
}



I found the solution by placing the correct code
Reason: