Rosh, need your help.

 
Hi Rosh,
I have a question, whether the ex4 can create a log file (.txt) automatically, and the ea can import or use back the info or any number and wording (maybe some instruction script) from the log file? If so, can you help and provide me the sample.
Thank you
 
Yes, of course. This function write an array to file
//+------------------------------------------------------------------+
//| Write an array to file                                           |
//+------------------------------------------------------------------+
void TestWrite(string Array[],string FileName)
  {
 
  int handle=-1;
  int size=ArraySize(Array);
  if (size==0 || StringLen(FileName)==0) return;
  if (StringLen(FileName)==0)
     {
     Print("It is not specified the Name for Debug File!");
     return;
     }
//----
  handle=FileOpen(FileName,FILE_WRITE|FILE_CSV);
  if (handle==-1)
     {
     Print("File opening is failed! Name =",FileName);
     return;
     }
  if (handle>0) for (int i=0;i<size;i++) FileWrite(handle,Array[i]);
  if (handle>0) FileClose(handle);
//----
  return;
  }
and this function read file to array

//+------------------------------------------------------------------+
//| Read strings from file to array[]                                |
//| Return false if failed                                           |
//+------------------------------------------------------------------+
bool ReadFileToArray(string &array[],string FileName)
  {
   bool res=false;
   int FileHandle;
   string tempArray[64000],currString;
   int stringCounter;
   int devider='\x90';
//----
   FileHandle=FileOpen(FileName,FILE_READ,devider);
   if (FileHandle!=-1)
      {
      while(!FileIsEnding(FileHandle)) 
         {
         currString=FileReadString(FileHandle);
         tempArray[stringCounter]=currString;
         stringCounter++;
         }
      if (stringCounter>0) 
         {
         ArrayResize(array,stringCounter);
         for (int i=0;i<stringCounter;i++) array[i]=tempArray[i];
         res=true;
         }
      }
//----
   return(res);
  }
 
thank for your help.
 
Hi ROSH,
how to insert your ADX_Smoothed to any of ex4 or compile to .ex4?
Please provide sample!
Please help, thanks
 


 
Hi ROSH,
Thank you for your fast help and sorry for misunderstanding!
Can you please provide how to insert your ADX_Smoothed code in to MACDSample.mq4?
Thanks again.
 
Hi ROSH,
Can you please help, how to compile your ADX_Smoothed code in to MACDSample.mq4?
Please help.

Thank you

 

I don't know how you want to use calls of ADX_Smoothed in your EA. One possibility is :

MacdCurrent=iCustom(Symbol(),0,"ADX_Smoothed",14,0.25,0.33,0,2,0);
MacdPrevious=iCustom(Symbol(),0,"ADX_Smoothed",14,0.25,0.33,0,2,1);
//SignalCurrent=iMACD(NULL,0,12,26,9,PRICE_CLOSE,MODE_SIGNAL,0);
//SignalPrevious=iMACD(NULL,0,12,26,9,PRICE_CLOSE,MODE_SIGNAL,1);
//MaCurrent=iMA(NULL,0,MATrendPeriod,0,MODE_EMA,PRICE_CLOSE,0);
//MaPrevious=iMA(NULL,0,MATrendPeriod,0,MODE_EMA,PRICE_CLOSE,1);
You have to modify MACDSample EA in wanted way.
Reason: