Bon moment ! Je me demandais comment traduire un tableau 2D en format *.csv, j'ai trouvé un exemple approprié, mais c'est pour mt4, j'en ai besoin pour 5.
В это статье мы напишем простую библиотеку для создания трехмерных графиков и последующего их проcмотра в Microsoft Excel. Мы воспользуемся стандартными возможностями языка MQL 4 для подготовки и экспорта данных в файл формата *.csv.
Bon moment ! Je me demandais comment traduire un tableau 2D en format *.csv, j'ai trouvé un exemple approprié, mais c'est pour mt4, j'en ai besoin pour 5.
Si vous n'avez pas de compte, veuillez vous inscrire
Autorisez l'utilisation de cookies pour vous connecter au site Web MQL5.com.
Veuillez activer les paramètres nécessaires dans votre navigateur, sinon vous ne pourrez pas vous connecter.
Vous êtes connecté. L'authentification à deux facteurs a été désactivée. Configurez-la à nouveau et scannez un nouveau code QR, ou continuez avec l'authentification à deux facteurs désactivée.
la formule est d'ici - https://www.mql5.com/ru/articles/1492
La formule est tirée d'ici - https://www.mql5.com/ru/articles/1492
Je ne l'ai pas lu. Mais à en juger par la formule et les graphiques de l'article (Excel), il s'agit d'une augmentation de puissance.
Je peux me tromper.
Bon moment ! Je me demandais comment traduire un tableau 2D en format *.csv, j'ai trouvé un exemple approprié, mais c'est pour mt4, j'en ai besoin pour 5.
//| generateCsv.mq4 |
//| Copyright © 2006, Antonio Banderass. All rights reserved |
//| banderassa@ukr.net |
//+------------------------------------------------------------------+
#property copyright "Copyright © 2006, Antonio Banderass. All rights reserved"
#property link "banderassa@ukr.net"
#property library
#define ARRAY_SIZE_X 16
#define ARRAY_SIZE_Y 16
//+------------------------------------------------------------------+
//| PrepareString |
//+------------------------------------------------------------------+
string PrepareString(string s)
{
bool exit = false;
int index = 0;
string str = s;
//----
while(!exit)
{
index = StringFind(str, ".", index);
if(index > -1)
str = StringSetCharacter(str, index, ',');
else
exit = true;
}
return(str);
}
//+------------------------------------------------------------------+
//| GenerateCsv |
//+------------------------------------------------------------------+
int GenerateCsv(string fileName, int arraySizeX, int arraySizeY,
double arrayIndexX[], double arrayIndexY[], double arrayZ[][]) // Ругается говорит - arrays are passed by reference only пробовал добавить &_array.. но запинается на двумерном
{
int handle = FileOpen(fileName, FILE_CSV|FILE_WRITE, ' '), x, y;
string str;
if(handle < 1)
{
Print("Error:", GetLastError());
return(handle);
}
else
{
str = ";";
for(x = 0; x < arraySizeX; x++)
{
str = str + arrayIndexX[x];
str = str + ";";
}
FileWrite(handle, PrepareString(str));
for(y = 0; y < arraySizeY; y++)
{
str = "";
str = str + arrayIndexY[y] + ";";
for(x = 0; x < arraySizeX; x++)
{
str = str + arrayZ[x,y];
str = str + ";";
}
FileWrite(handle, PrepareString(str));
}
}
FileClose(handle);
return(handle);
}
//+------------------------------------------------------------------+
https://www.mql5.com/ru/articles/1443
Bon moment ! Je me demandais comment traduire un tableau 2D en format *.csv, j'ai trouvé un exemple approprié, mais c'est pour mt4, j'en ai besoin pour 5.
https://www.mql5.com/ru/articles/1443
Les tableaux ne peuvent être transférés que par référence :
double & arrayIndexX[], double & arrayIndexY[], double & arrayZ[][])
Les tableaux ne peuvent être transférés que par référence :
double & arrayIndexX[], double & arrayIndexY[], double & arrayZ[][])
Et pourtant, cela échoue&arrayZ[][] dit -'[' - valeur d'index invalide
Et combien de dimensions est déclaré arrayZ ?
J'ai déclaré &arrayZ[][3000], si je l'assimile à 16, alors la fonction de traitement des événements n'est pas trouvéedu tout
#define ARRAY_SIZE_Y 16
int start()
{
int x, y;
double arrayIndexX[ARRAY_SIZE_X];
double arrayIndexY[ARRAY_SIZE_Y];
double arrayZ[ARRAY_SIZE_X,ARRAY_SIZE_Y];
//----
for(x = 0; x < ARRAY_SIZE_X; x++)
arrayIndexX[x] = x / 10.0;
//----
for(y = 0; y < ARRAY_SIZE_Y; y++)
arrayIndexY[y] = y / 10.0;
//----
for(x = 0; x < ARRAY_SIZE_X; x++)
for(y = 0; y < ARRAY_SIZE_Y; y++)
arrayZ[x,y] = MathSin(arrayIndexX[x] + arrayIndexY[y]);
GenerateCsv("test.csv", ARRAY_SIZE_X, ARRAY_SIZE_Y, arrayIndexX, arrayIndexY, arrayZ); // 'arrayZ' - parameter conversion not allowed
//----
return(0);
}
//| PrepareString |
//+------------------------------------------------------------------+
string PrepareString(string s)
{
bool exit = false;
int index = 0;
string str = s;
//----
while(!exit)
{
index = StringFind(str, ".", index);
if(index > -1)
str = StringSetCharacter(str, index, ',');
else
exit = true;
}
return(str);
}
//+------------------------------------------------------------------+
//| GenerateCsv |
//+------------------------------------------------------------------+
int GenerateCsv(string fileName, int arraySizeX, int arraySizeY,
double &arrayIndexX[], double &arrayIndexY[], double &arrayZ[][3000])
{
int handle = FileOpen(fileName, FILE_CSV|FILE_WRITE, ' '), x, y;
string str;
if(handle < 1)
{
Print("Error:", GetLastError());
return(handle);
}
else
{
str = ";";
for(x = 0; x < arraySizeX; x++)
{
str = str + arrayIndexX[x];
str = str + ";";
}
FileWrite(handle, PrepareString(str));
for(y = 0; y < arraySizeY; y++)
{
str = "";
str = str + arrayIndexY[y] + ";";
for(x = 0; x < arraySizeX; x++)
{
str = str + arrayZ[x,y];
str = str + ";";
}
FileWrite(handle, PrepareString(str));
}
}
FileClose(handle);
return(handle);
}
//+------------------------------------------------------------------+
Déclaré &arrayZ[][3000]
string PrepareString(string s);
int GenerateCsv(string fileName, int arraySizeX, int arraySizeY,
double &arrayIndexX[], double &arrayIndexY[],
double &arrayZ[][3000]);
int start()
{
int x, y;
double arrayIndexX[ARRAY_SIZE_X];
double arrayIndexY[ARRAY_SIZE_Y];
double arrayZ[ARRAY_SIZE_X,ARRAY_SIZE_Y];
//----
for(x = 0; x < ARRAY_SIZE_X; x++)
arrayIndexX[x] = x / 10.0;
//----
for(y = 0; y < ARRAY_SIZE_Y; y++)
arrayIndexY[y] = y / 10.0;
//----
for(x = 0; x < ARRAY_SIZE_X; x++)
for(y = 0; y < ARRAY_SIZE_Y; y++)
arrayZ[x,y] = MathSin(arrayIndexX[x] + arrayIndexY[y]);
GenerateCsv("test.csv", ARRAY_SIZE_X, ARRAY_SIZE_Y, arrayIndexX, arrayIndexY, arrayZ); // 'arrayZ' - parameter conversion not allowed
//----
return(0);
}
Comment changer la couleur d'un panneau créé à l'aide de la classeCAppDialog?
return(false);
Vous devez déjà l'avoir préparé. Comment cela se passe-t-il là-bas ? Je ne peux pas vérifier - j'écris depuis mon téléphone portable.
Je m'excuse pour ce désagrément.
//+------------------------------------------------------------------+
//| start |
//+------------------------------------------------------------------+
int start()
{
а надо
//+------------------------------------------------------------------+//| start |
//+------------------------------------------------------------------+
int OnStart
{
Mais le fichier se crée, pas avec les données demandées,
résultat - une colonne remplie de 17 rangées de booléens vrais
Il y a une chaîneStringSetChar - juré au début,
je l'ai changé enboolStringSetCharacter- cela doit être la raison pour le booléen
//| PrepareString |
//+------------------------------------------------------------------+
string PrepareString(string s)
{
bool exit = false;
int index = 0;
string str = s;
//----
while(!exit)
{
index = StringFind(str, ".", index);
if(index > -1)
str = StringSetChar(str, index, ',');
else
exit = true;
}
return(str);
}