Metatrader Forum | Forex Expert-Advisor | Broker & Forex Tools

Metatrader Forum | Forex Expert-Advisor | Broker & Forex Tools (http://www.expert-advisor.com/forum/index.php)
-   Programmierung MQL4 (http://www.expert-advisor.com/forum/forumdisplay.php?f=220)
-   -   Wert aus Datei lesen (http://www.expert-advisor.com/forum/showthread.php?t=6821)

Max2018 02.11.20 13:10

Wert aus Datei lesen
 
Hallo,
ich habe in einer Datei nur einen einzigen Wert stehen und den möchte ich auslesen und als Comment anzeigen... Geht aber nicht .... :confused: Habt Ihr ne Idee wo der Fehler liegt? DANKE

Code:

#property strict

double WERT01[];
int      ind=0;
int      size=0;
datetime time_buff[];
 
void OnTick()
  {
  if(Seconds()==0||Seconds()==10||Seconds()==20||Seconds()==30||Seconds()==40||Seconds()==50)AusDatei();
 
  Comment(WERT01[0]);
  }
//+------------------------------------------------------------------+
void AusDatei()
  {
 string symbol=Symbol();
 string TextDatei;
 TextDatei=StringConcatenate("MaxiMini","-",symbol,".","txt");
 
 
 //###################################################################################################################################
     
 if(Seconds()==5)

  int handle; 
  handle = FileOpen(TextDatei,FILE_READ|FILE_WRITE|FILE_TXT,"/t"); // Datei wird unter \MQL4\Files abgelegt
  FileSeek(handle, 0, SEEK_END);     
  // if(FileSize(handle)>0)WERT01=FileReadDouble(handle,DOUBLE_VALUE);
  for(int i=0;i<size;i++)
        {
        time_buff[i]=(datetime)FileReadDouble(handle,DOUBLE_VALUE);
        WERT01[i]=FileReadDouble(handle,DOUBLE_VALUE);
        }
 
  FileClose(handle);
    if(handle<1)
    {
    Print("File my_data.dat not found, the last error is ", GetLastError()); 
    }
   
  }
  }


Max2018 02.11.20 14:36

OK ... Lösung im Forum gefunden
http://www.expert-advisor.com/forum/...-fileread.html


Alle Zeitangaben in WEZ +2. Es ist jetzt 09:09 Uhr.

Powered by vBulletin® Version 3.8.5 (Deutsch)
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
SEO by vBSEO 3.6.1
Powered by vBCMS® 2.7.0 ©2002 - 2024 vbdesigns.de
Copyright ©2009 - 2023 by Expert-Advisor.com - Das Metatrader Forum