Function Store Parameters indicators when trade is open !

 

Hi I need help I want to know if is possible and how to do it , Thanks


I want to build a function that store parameters from indicator when the trade is taken  and if that trade is close on profit that parameter will be store on 

file win trade ,and if that trade is loser store that parameter in a folder or file store

the function I want to build it into a expert advisor and save or store that parameter from every time I take a trade  


I already build this

but I don't know how to store it I don't knok if is posible

 

 thank you very much for your time 

 void Parameter_Indicators()
  {

   double Atr = iCustom(NULL,0,"Sanbach_ATR",0,0.003,3.75,10,0,0);
    double MA1= iMA(NULL,0,MA_Fast,0,MODE_EMA,PRICE_CLOSE,0);
     
for(int i=OrdersHistoryTotal()-1; i>=0; i--)
  
  OrderSelect (0,SELECT_BY_POS,MODE_TRADES);
  
  if(OrdersTotal())
  {
    Comment( " MA1 =  " ,MA1,"\n ATR =  ",Atr );
   }
  

\\ OR SOMETHIN LIKE THIS
 fileName = PARAMETERS TRADE TICKETNUBER xxx".csv";

 
   if(parameter trade 1) 
   {
      fileHandle = FileOpen(fileName,FILE_CSV|FILE_READ | FILE_WRITE);
   
      FileSeek(fileHandle, 0, SEEK_END); // Write at the end of the file.
      string data = up[0]+"," Atr1","MA1";
      FileWrite(fileHandle,data);
      FileClose(fileHandle);
      
Reason: