Erros, bugs, perguntas - página 1103

 
ingram:
Obrigado pela dica! Tudo funciona como deveria através do CTrade. Mas ainda não é agradável que as funções documentadas não funcionem como deveriam. (((( perdeu 4 horas ontem a tentar fazer o meu Expert Advisor funcionar correctamente, e não é uma biblioteca aleatória, mas uma função nativa documentada. Muito estranho!
O mais importante é que tudo funcionou como deveria.
 
MetaDriver:

1) Qual é exactamente a versão em execução do terminal já instalado?

2) E que tipo de processador tem? Suporta as instruções SSE2?

Desculpe, há muito tempo que não há resposta, tem sido muito trabalho.

1. bilhete terminal versão 4.0 509 está instalado.

2. AMD Duron 1.2 GHz processador SSE instruções são suportadas SSE2 não é suportado...

Arquivos anexados:
fiwq5lfx.JPG  174 kb
Report.txt  31 kb
 
cichiniov:

Lamento não ter respondido durante muito tempo, tem sido um tempo ocupado.

1. bilhete terminal versão 4.0 509 está instalado.

2. AMD Duron 1.2 GHz processador SSE instruções são suportadas SSE2 não é suportado...

É essa a questão. Novas construções não funcionarão sem o suporte de instruções SSE2. É necessário actualizar o seu hardware.
 
Pode dizer-me, por favor, o que significa este erro do Expert Advisor? "2014.02.13 05:29:06.885 stop_gambling EURUSD,H1: Error setting Sell trailing stop: 130" ??
 

Diz na ajuda:

STAT_RECOVERY_FACTOR

O factor de recuperação é o rácio STAT_PROFIT/STAT_BALANCE_DDD

Talvez a ajuda deva ser corrigida. Verifiquei-o. O factor de recuperação é calculado por meios.

 

O código (perito) está a lixar o terminal 64... Desenvolvedores, ajudem! #956630

#import "msvcrt.dll"
   int memcpy(int &dst[], double &src[], int cnt);

#import "ntdll.dll"
   int RtlGetLastWin32Error();
   int RtlSetLastWin32Error(int dwErrCode);

#import "kernel32.dll"
   int   DeleteFileW (string lpFileName);
   
   int   CloseHandle(int hObject);
   int   CreateFileW(      string lpFileName,         int dwDesiredAccess, 
                           int dwShareMode,           int lpSecurityAttributes,
                           int dwCreationDisposition, int dwFlagsAndAttributes, 
                           int hTemplateFile
                     );

   int   SetFilePointer(int hFile, int lDistanceToMove, int& lpDistanceToMoveHigh[], int dwMoveMethod);
   int   SetEndOfFile (int hFile);
   int   ReadFile(int hFile, ushort& lpBuffer[], int nNumberOfBytesToRead, int& lpNumberOfBytesRead[], int lpOverlapped);
   int   WriteFile(int  hFile, int& lpBuffer[], int nNumberOfBytesToWrite, int& lpNumberOfBytesWritten[], int  lpOverlapped);
   int   GetFileSize(int hFile,  int notUsed = 0);
   
   int   FindFirstFileW(string path, int& answer[]);
   int   FindNextFileW(int handle, int& answer[]);
   int   FindClose(int handle);
   
   int   CreateDirectoryW(string path, int securityAttributes /*set to 0*/);
   
#import

#define  F_GENERIC_WRITE                0x40000000 // Доступ к файлу для записи.
const uint F_GENERIC_READ            = 0x80000000; // Доступ к файлу для чтения.

// ---- Параметр "dwShareMode".
#define  F_FILE_SHARE_NO                0x00000000 // Запрещает процессы открытия файла.
#define  F_FILE_SHARE_READ              0x00000001 // Подготавливает работу без ограничений в файле или устройстве для чтения.
#define  F_FILE_SHARE_WRITE             0x00000002 // Подготавливает работу без ограничений в файле или устройстве для записи.
#define  F_FILE_SHARE_DELETE            0x00000004 // Подготавливает работу без ограничений в файле или устройстве для удаления. 

// ---- Параметр "dwCreationDisposition".
#define  F_CREATE_NEW                   1          // Создает новый файл, если его ещё нет. Если файл есть, будет ошибка.
#define  F_CREATE_ALWAYS                2          // Создает новый файл, всегда.
#define  F_OPEN_EXISTING                3          // Открывает файл или устройство, если он существует.
#define  F_OPEN_ALWAYS                  4          // Открывает файл, всегда.
#define  F_TRUNCATE_EXISTING            5          // Открывает файл и исключает это чтобы размер - нулевые байты, только если он существует.

//==== Константы для функции "SetFilePointer()".
#define  F_FILE_BEGIN                   0          // От начала файла.
#define  F_FILE_CURRENT                 1          // От текущей позиции.
#define  F_FILE_END                     2          // От конца файла.

#define  INVALID_SET_FILE_POINTER -1
#define  INVALID_FILE_ATTRIBUTES -1
#define  INVALID_HANDLE_VALUE -1
#define  INVALID_FILE_SIZE 0xFFFFFFFF

#define  FILE_ATTRIBUTE_DIRECTORY 0x10

#define  ERROR_FILE_NOT_FOUND 2
#define  ERROR_PATH_NOT_FOUND 3

string StringFromBuffer(int& buffer[])
{
   string text = "";

   for (int pos = 11; pos < 75; pos++) 
   {
      int curr = buffer[pos];
      text = text + 
         CharToString(uchar(curr       & 0x000000FF)) +
         CharToString(uchar(curr >> 8  & 0x000000FF)) +
         CharToString(uchar(curr >> 16 & 0x000000FF)) +
         CharToString(uchar(curr >> 24 & 0x000000FF)); 
   }

   return (text);
}

int GetFileList(string path, string filter, string& list[])
{
   int Win32Data[80];
   ArrayInitialize(Win32Data, 0);

   RtlSetLastWin32Error(0);
   int hFind = FindFirstFileW(path + filter, Win32Data);
   
   if (INVALID_HANDLE_VALUE == hFind)
   {
      return (RtlGetLastWin32Error());
   }
   
   ArrayResize(list, 0);
   
   if ((Win32Data[0] & FILE_ATTRIBUTE_DIRECTORY) == 0) // if found item is file, not directory
   {
      ArrayResize(list, 1);
      list[0] = StringFromBuffer(Win32Data);
   }
   ArrayInitialize(Win32Data, 0);
   
   while (FindNextFileW(hFind, Win32Data) != 0)
   {
      if ((Win32Data[0] & FILE_ATTRIBUTE_DIRECTORY) == 0) // if found item is file, not directory
      {
         int size = ArraySize(list);
         ArrayResize(list, size + 1);
         list[size] = StringFromBuffer(Win32Data);
      }
      ArrayInitialize(Win32Data, 0);
   }
   
   FindClose(hFind);
   
   return (0);
}

int TryToCaptureFile(string fileName, int& err)
{
   RtlSetLastWin32Error(0);
   int hFile = CreateFileW(fileName, F_GENERIC_WRITE | F_GENERIC_READ, F_FILE_SHARE_NO, 0, F_OPEN_ALWAYS, 0, 0);
   err = RtlGetLastWin32Error();
   return (hFile);
}

bool CheckDirectoryExists(string path)
{
   int Win32Data[80];
   ArrayInitialize(Win32Data, 0);

   RtlSetLastWin32Error(0);
   int hFind = FindFirstFileW(path, Win32Data);

   if (INVALID_HANDLE_VALUE == hFind)
   {
      return (false);
   }

   FindClose(hFind);
   
   return ((Win32Data[0] & FILE_ATTRIBUTE_DIRECTORY) != 0); // if found item is directory
}

string LockFileName = "VolumeDataReceiver";

int hLockFile;
string ClusterDeltaPath;
string LockPath;

int UpdateIntervalSec;

int CheckLock()
{
   int err = 0;
   if (INVALID_HANDLE_VALUE != hLockFile) return (0);
   
   string path = StringSubstr(LockPath, 0, StringLen(LockPath) - 1);
   bool exists = CheckDirectoryExists(path);
   
   if (!exists)
   { // try to create if not available
      RtlSetLastWin32Error(0);
      int res = CreateDirectoryW(LockPath, 0);
      
      if (res == 0)
      {
         err = RtlGetLastWin32Error();
         if (err != 183) // ERROR_ALREADY_EXISTS
         {
            Print("Failed to create directory -- \"", LockPath, "\"");
         }
         return (err);
      }
   }
   
   if (INVALID_HANDLE_VALUE == hLockFile)
   {
      return (err);
   }
   
   return (0);
}

int OnInit()
{
   if (!MQL5InfoInteger(MQL5_DLLS_ALLOWED) ) 
   { 
      Alert("Dlls are not allowed. You should allow dll imports.");
      return (1); 
   }

   hLockFile = INVALID_HANDLE_VALUE;
   
   ClusterDeltaPath = TerminalInfoString(TERMINAL_DATA_PATH) + "\\ClusterDelta\\Volume\\";
   LockPath = TerminalInfoString(TERMINAL_DATA_PATH) + "\\ClusterDelta\\";

   if (UpdateIntervalSec < 30)
   {
      UpdateIntervalSec = 30;
   }

   int err = CheckLock();
   if (err != 0)
   {
      Alert("Failed initializing (Data Receiver already running?), error = ", err);
      return (1);
   }
   
   return (0);
}
 
TheXpert:

O código (perito) está a lixar o terminal 64... Desenvolvedores, ajudem! #956630

O ponteiro deve ser longo.
 
TheXpert:

O código (perito) está a lixar o terminal 64... Desenvolvedores, ajudem! #956630


procurar em MSDN, onde estão as pegas ou apontadores - adicionar versões a longo

Eu faço isto.

#import "kernel32.dll"
    int   CloseHandle(int hObject);
    int   CloseHandle(long hObject);
#import 

int   CloseHandle(long hObject)
{
  if (_Is64) return(kernel32:: CloseHandle(hObject));
  else return(kernel32:: CloseHandle((int)hObject));
}

в коде
::CloseHandle(h); // где h - long типа
 
Obrigado, já o tenho. Acho que olhei para as indicações, mas tinha-me esquecido das pegas. E parte-se de tal maneira que não se sabe o que o está a causar...
 
TheXpert:
As sinalizações parecem ter sido examinadas
int lpOverlapped ???