Download MetaTrader 5
To add comments, please log in or register
Publish your article and thousands of people all over the world will read it!
baza12
15
baza12 2014.03.03 16:47 

i have this code :

my file write in directory :C:\Users\asd\AppData\Roaming\MetaQuotes\Terminal\18D0C7f585FFD316854F27B2A71B7F37\MQL4\Files


why i change to write directory C:\trade\

//+------------------------------------------------------------------+
//|                                             ad.mq4 |
//|                        Copyright 2014, MetaQuotes Software Corp. |
//|                                              https://www.mql5.com |
//+------------------------------------------------------------------+
#property copyright "Copyright 2014, MetaQuotes Software Corp."
#property link      "https://www.mql5.com"
#property version   "1.00"
#property strict
//+------------------------------------------------------------------+
//| Expert initialization function                                   |
//+------------------------------------------------------------------+
int OnInit()
  {
//---
   
//---
   return(INIT_SUCCEEDED);
  }
//+------------------------------------------------------------------+
//| Expert deinitialization function                                 |
//+------------------------------------------------------------------+
void OnDeinit(const int reason)
  {
//---
   
  }
//+------------------------------------------------------------------+
//| Expert tick function                                             |
//+------------------------------------------------------------------+
void OnTick()
  {
//---

double sAsk=Ask;
double sBid=Bid;

   WriteLog(sBid,"Admirali\\Bid.txt");
   WriteLog(sAsk,"Admiral\\Ask.txt");
  }
//+------------------------------------------------------------------+
void WriteLog(double j,string Position) {

  string log_file_name =Position;
  int handle = FileOpen(log_file_name, FILE_ANSI|FILE_TXT|FILE_WRITE);
  if (handle > 0) {
    FileWrite(handle,DoubleToStr(j,2));
    FileClose(handle);
    
  }
}
Simon Gniadkowski
Moderator
17963
Simon Gniadkowski 2014.03.03 17:04  
baza12:

i have this code :

my file write in directory :C:\Users\asd\AppData\Roaming\MetaQuotes\Terminal\18D0C7f585FFD316854F27B2A71B7F37\MQL4\Files


why i change to write directory C:\trade\

You cannot write outside of the MT4 sandbox using standard mql4 functions.
/
To add comments, please log in or register