ingram: Gracias por el consejo! Todo funciona como debería a través de CTrade. Pero sigue sin ser agradable que las funciones documentadas no funcionen como deberían. (((( perdió ayer 4 horas tratando de hacer que mi Asesor Experto funcione correctamente, y no es una biblioteca al azar, sino una función nativa documentada. ¡Muy extraño!
Lo más importante es que todo ha funcionado como debía.
El código (experto) está jodiendo el terminal 64... Desarrolladores, ¡ayuda! #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// Доступ к файлу для записи.constuint 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 3string 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);
}
intOnInit()
{
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);
}
El código (experto) está jodiendo el terminal 64... Desarrolladores, ¡ayuda! #956630
buscar en MSDN, donde están los handles o punteros - añadir versiones a largo
Yo hago esto.
#import "kernel32.dll"int CloseHandle(int hObject);
int CloseHandle(long hObject);
#import
int CloseHandle(long hObject)
{
if (_Is64) return(kernel32:: CloseHandle(hObject));
elsereturn(kernel32:: CloseHandle((int)hObject));
}
в коде
::CloseHandle(h); // где h - long типа
Gracias por el consejo! Todo funciona como debería a través de CTrade. Pero sigue sin ser agradable que las funciones documentadas no funcionen como deberían. (((( perdió ayer 4 horas tratando de hacer que mi Asesor Experto funcione correctamente, y no es una biblioteca al azar, sino una función nativa documentada. ¡Muy extraño!
1) ¿Cuál es exactamente la versión del terminal ya instalada?
2) ¿Y qué tipo de procesador tienes? ¿Soporta instrucciones SSE2?
Lo siento, no he respondido durante mucho tiempo, ha sido mucho trabajo.
1. Se ha instalado la versión 4.0 ticket 509 del terminal.
2. Procesador AMD Duron de 1,2 GHz Se admiten las instrucciones SSE No se admite SSE2...
Siento no haber contestado durante mucho tiempo, ha sido una época de mucho trabajo.
1. Se ha instalado la versión 4.0 ticket 509 del terminal.
2. Procesador AMD Duron de 1,2 GHz Se admiten las instrucciones SSE No se admite SSE2...
Lo dice la ayuda:
STAT_RECOVERY_FACTOR
El factor de recuperación es la relación STAT_PROFIT/STAT_BALANCE_DD
Tal vez haya que corregir la ayuda. Lo he comprobado. El factor de recuperación se calcula mediante.
El código (experto) está jodiendo el terminal 64... Desarrolladores, ¡ayuda! #956630
El código (experto) está jodiendo el terminal 64... Desarrolladores, ¡ayuda! #956630
El código (experto) está jodiendo el terminal 64... Desarrolladores, ¡ayuda! #956630
buscar en MSDN, donde están los handles o punteros - añadir versiones a largo
Yo hago esto.
Parece que se han mirado las señales
int lpOverlapped ???