how do I write the table title with the corresponding values
bool writeFile()
{
string nomeFileTXT = "ottimizzazione.txt";
bool printOK = false;
int filehandle;
int errore=0; // numero dell'erroreuint numBytesWritten=0;
string stringa;
//
filehandle=FileOpen(nomeFileTXT,FILE_READ|FILE_WRITE|FILE_CSV);
// If a file has been opened successfully, the function returns the file handle, which is then used to access the file data. In case of failure returns INVALID_HANDLE.if(filehandle==INVALID_HANDLE) // Incorrect handle = -1 : errore nella creazione del file
{
errore = GetLastError();
Alert(__FUNCTION__," (",__LINE__,"): Errore #"+IntegerToString(errore)+" "+" nel tentativo di apertura del file "+nomeFileTXT);
// FileClose(filehandle); è inutile cercare di chiudere un file che non è stato aperto ed il cui filehandle=-1 per cui FileClose(filehandle) non sortisce effetto!return(false);
}
elseif (printOK) Print(__FUNCTION__," (",__LINE__,"): filehandle = "+IntegerToString(filehandle));
FileWrite(filehandle,
"MaxOrder",
"TeckProfit",
"StopLoss",
"TF_",
"PeriodsADXEntry",
"LivelADXEntry",
"PeriodsADXExit",
"LivelADXExit",
"exit",
"entry",
"periodMA1",
"periodMA2",
"FromHours1",
"FromToUntilHours1",
"FromHours2",
"FromToUntilHours2",
"FromHours3",
"FromToUntilHours3",
"FromHours4",
"FromToUntilHours4",
"parametro1", "parametro2", "parametro3", "parametro4"); // il file viene inizializzatoFileSeek(filehandle, 0, SEEK_END); // si porta il puntatore alla fine del file, così da inserire la nuova riga di dati per la barra i-esima//uint numBytesWritten = FileWrite(filehandle, "#", "Takeprofit", "Stoploss", "ProfitLoss_Pip", "contaBarre", "Profit_Pip", "numTradeInProfit", "(numTradeInProfit/contaBarre)*100", "Loss_Pip", "numTradeInLoss", "(numTradeInLoss/contaBarre)*100", "valorMedioPip_escursioneMax", "numPip_escursioneMax");
numBytesWritten = FileWrite(filehandle,
MaxOrder,
TeckProfit,
StopLoss,
TF_,
PeriodsADXEntry,
LivelADXEntry,
PeriodsADXExit,
LivelADXExit,
exit,
entry,
periodMA1,
periodMA2,
FromHours1,
FromToUntilHours1,
FromHours2,
FromToUntilHours2,
FromHours3,
FromToUntilHours3,
FromHours4,
FromToUntilHours4,
DoubleToString(parametro1,2), DoubleToString(parametro2,2), DoubleToString(parametro3,2), DoubleToString(parametro4,5));
if(numBytesWritten==0)
{
errore = GetLastError();
Alert(__FUNCTION__," (",__LINE__,"): Errore #"+IntegerToString(errore)+" "+" nel tentativo di scrittura sul "+nomeFileTXT);
FileClose(filehandle);
return(false);
}
else
{
if (printOK)
{
Print(__FUNCTION__," (",__LINE__,"): Scritta una riga di parametri di sintesi nel file "+nomeFileTXT);
Print(__FUNCTION__," (",__LINE__,"): questo file ha Filesize="+IntegerToString(FileSize(filehandle))+" dopo aver scritto "+IntegerToString(numBytesWritten)+" bytes");
}
FileClose(filehandle);
return(true);
}
}
how do I write the table title with the corresponding values
MaxOrder TeckProfit StopLoss TF_ PeriodsADXEntry LivelADXEntry PeriodsADXExit LivelADXExit exit entry periodMA1 periodMA2 FromHours1 FromToUntilHours1 FromHours2 FromToUntilHours2 FromHours3 FromToUntilHours3 FromHours4 FromToUntilHours4 parametro1 parametro2 parametro3 parametro4