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)
-   -   mql schrott oder mein pc schrott? (http://www.expert-advisor.com/forum/showthread.php?t=4495)

Thomas Welling 01.10.15 17:31

mql schrott oder mein pc schrott?
 
Hallo allerseits,
mein Problem die eingespeicherten Daten sind nicht korrekt, bei der Ausgabe durch einen anderen EA sind die Daten schlichtwig falsch.
Ich bin echt am rätseln warum das so ist.
Kann jmd den folgenden Code mal ausprobieren?
Falls noch ein Ausgabe EA benötigt wird, stelle ich einen bereit.
Im folgenden Code ein Beispiel einer Einspeicherung:

Code:

#property copyright "Copyright 2015"
#property link      "https://www.mql5.com"
#property version  "1.00"
//--- input parameters
input string InpFileName="save.bin";
input string InpDirectoryName="Saves";

#include <stdlib.mqh>
#include <WinUser32.mqh>

datetime BarTime1 = 0;
//+------------------------------------------------------------------+
//| Structure for storing price data                                |
//+------------------------------------------------------------------+
struct prices
  {
  double Preis1;
  double Preis1_High;
  double Preis1_Low;
  };
 
 
 
 
//--- global variables
int    count=0,count2=0,count3=0,ExpectedTime1=0,ccM1=0,ccM5=0;
int    size=1,bidask;int zz;
double cc;
string path=InpDirectoryName+"//"+InpFileName; double Werte[99999];
prices arr[];
//+------------------------------------------------------------------+
//| Expert initialization function                                  |
//+------------------------------------------------------------------+
int OnInit()
  {
//--- allocate memory for the array
  ArrayResize(arr,size);
//---
  return(INIT_SUCCEEDED);
  }
//+------------------------------------------------------------------+
//| Expert deinitialization function                                |
//+------------------------------------------------------------------+
void OnDeinit(const int reason)
  {
//--- write the remaining count strings if count<n

  }
//+------------------------------------------------------------------+
//| Expert tick function                                            |
//+------------------------------------------------------------------+
void OnTick()
  {
// M1_bidask++;
// M5_bidask++;
// M15_bidasl++;

// MarktWerte[bidask]=Bid+Ask/2
zz=zz+1;
Werte[zz]=(Bid+Ask)/2;

  Save();


  if(count==size)
    {
      WriteData(size);
      count=0;
    }
  }
//+------------------------------------------------------------------+
//| Write n elements of the array to file                            |
//+------------------------------------------------------------------+
void WriteData(const int n)
  {
//--- open the file
  ResetLastError();
  int handle=FileOpen(path,FILE_READ|FILE_WRITE|FILE_BIN);
  if(handle!=INVALID_HANDLE)
    {
      //--- write array data to the end of the file
      FileSeek(handle,0,SEEK_END);
      FileWriteArray(handle,arr,0,n);
      //--- close the file
      FileClose(handle);
    }
  else
      Print("Failed to open the file, error ",GetLastError());
  }


void Save(){

 
   
   
 // Eine Minute Vorbei 
   
    int datetime800 = TimeLocal();
    if (ExpectedTime1 == 0 || datetime800 > ExpectedTime1 + 60)
    {
        ExpectedTime1 = datetime800 + 60 * 1;  // reset paused time
    }
    if (datetime800 >= ExpectedTime1 && datetime800 < ExpectedTime1 + 60)
    {
        ExpectedTime1 = datetime800 + 60 * 1;
     
    //  bool qw=OrderSend(Symbol(),OP_BUY,0.01,Ask,20,0,0,"",0,0,Red); 
    //  arr[count].Tag=Day;
     
      arr[count].Preis1=(Bid+Ask)/2;
 
 
      double H=High[0],L=Low[0];
      arr[count].Preis1_Low=L;
      arr[count].Preis1_High=Werte[ArrayMaximum(Werte,WHOLE_ARRAY,0)];
     
      zz=0;
     
      for (int i=0;i<500;i++){Werte[i]=0;}
     
        arr[count].Preis1_Low=L;
     
 
     

          ccM1=ccM1+1;
          Comment(count);
          count=count+1;
    }
     
   
   


}



Alle Zeitangaben in WEZ +2. Es ist jetzt 17:12 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