Preguntas de los principiantes MQL5 MT5 MetaTrader 5 - página 689 1...682683684685686687688689690691692693694695696...1503 Nuevo comentario Andrey F. Zelinsky 2016.12.03 22:38 #6881 Roma Ivanov: la fórmula es de aquí - https://www.mql5.com/ru/articles/1492 en el artículo del enlace -- la operación ^ es un aumento de potencia Artyom Trishkin 2016.12.03 22:40 #6882 Roma Ivanov: La fórmula está tomada de aquí - https://www.mql5.com/ru/articles/1492No lo he leído. Pero a juzgar por la fórmula y los gráficos del artículo (Excel), se trata de un aumento de potencia.Podría estar equivocado. Mikhail Toptunov 2016.12.04 07:53 #6883 ¡Buenos tiempos! Me preguntaba cómo traducir un array 2D a formato *.csv, encontré un ejemplo adecuado, pero es para mt4, lo necesito para 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 Трёхмерные графики - профессиональный инструмент анализа рынка 2006.12.06 Antoniuk Oleg www.mql5.com В это статье мы напишем простую библиотеку для создания трехмерных графиков и последующего их проcмотра в Microsoft Excel. Мы воспользуемся стандартными возможностями языка MQL 4 для подготовки и экспорта данных в файл формата *.csv. Archivos adjuntos: 3dGraphicOut.mq4 2 kb generateCsv.mq4 3 kb generateCsv.mqh 5 kb Questions from Beginners MQL5 Cualquier pregunta de novato, Any rookie question, so Artyom Trishkin 2016.12.04 09:14 #6884 Top2n: ¡Buenos tiempos! Me preguntaba cómo traducir un array 2D a formato *.csv, encontré un ejemplo adecuado, pero es para mt4, lo necesito para 5.https://www.mql5.com/ru/articles/1443Las matrices sólo pueden transferirse por referencia:int GenerateCsv(string fileName, int arraySizeX, int arraySizeY, double & arrayIndexX[], double & arrayIndexY[], double & arrayZ[][]) Mikhail Toptunov 2016.12.04 10:07 #6885 Artyom Trishkin: Las matrices sólo pueden transferirse por referencia:int GenerateCsv(string fileName, int arraySizeX, int arraySizeY, double & arrayIndexX[], double & arrayIndexY[], double & arrayZ[][]) Y sin embargo, jura que&arrayZ[][] dice -'[' - valor de índice no válido Artyom Trishkin 2016.12.04 10:11 #6886 Top2n: Y aún así falla yarrayZ[][] dice -'[' - valor de índice no válido¿Y cuántas dimensiones declara arrayZ? Mikhail Toptunov 2016.12.04 11:14 #6887 Artyom Trishkin: ¿Y cuántas dimensiones declara arrayZ?Declaré &arrayZ[][3000], si lo igualo a 16, entonces la función de manejo de eventos no se encuentraen absoluto#define ARRAY_SIZE_X 16#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); }//+------------------------------------------------------------------+ Questions from Beginners MQL5 Cualquier pregunta de novato, Any rookie question, so Artyom Trishkin 2016.12.04 11:46 #6888 Top2n: Declarado &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); } Ya has cogido uno preparado. ¿Cómo se hace allí? No puedo mirarlo, estoy escribiendo desde el móvil. Subscribers 2016.12.04 11:57 #6889 ¿Cómo puedo cambiar el color de un panel creado con la claseCAppDialog? if(!CAppDialog::Create(chart,name,subwin,x1,y1,x2,y2)) return(false); Mikhail Toptunov 2016.12.04 12:23 #6890 Artyom Trishkin: Ya debes tenerlo preparado. ¿Cómo se hace allí? No puedo buscarlo, estoy escribiendo desde el móvil.Pido disculpas por las molestias.//+------------------------------------------------------------------+//| start |//+------------------------------------------------------------------+int start() {а надо //+------------------------------------------------------------------+//| start |//+------------------------------------------------------------------+int OnStart { Pero el archivo se crea, no con los datos solicitados, resultado - una columna llena de 17 filas de boolean trueHay una cadenaStringSetChar - jurada al principio, lo cambió aboolStringSetCharacter- esa debe ser la razón del booleano//+------------------------------------------------------------------+//| 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); } Archivos adjuntos: generateCsv.mqh 5 kb VCSV.mq5 3 kb Questions from Beginners MQL5 Cualquier pregunta de novato, Mejores bandas de Bollinger... 1...682683684685686687688689690691692693694695696...1503 Nuevo comentario
la fórmula es de aquí - https://www.mql5.com/ru/articles/1492
La fórmula está tomada de aquí - https://www.mql5.com/ru/articles/1492
No lo he leído. Pero a juzgar por la fórmula y los gráficos del artículo (Excel), se trata de un aumento de potencia.
Podría estar equivocado.
¡Buenos tiempos! Me preguntaba cómo traducir un array 2D a formato *.csv, encontré un ejemplo adecuado, pero es para mt4, lo necesito para 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
¡Buenos tiempos! Me preguntaba cómo traducir un array 2D a formato *.csv, encontré un ejemplo adecuado, pero es para mt4, lo necesito para 5.
https://www.mql5.com/ru/articles/1443
Las matrices sólo pueden transferirse por referencia:
double & arrayIndexX[], double & arrayIndexY[], double & arrayZ[][])
Las matrices sólo pueden transferirse por referencia:
double & arrayIndexX[], double & arrayIndexY[], double & arrayZ[][])
Y aún así falla yarrayZ[][] dice -'[' - valor de índice no válido
¿Y cuántas dimensiones declara arrayZ?
Declaré &arrayZ[][3000], si lo igualo a 16, entonces la función de manejo de eventos no se encuentraen absoluto
#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);
}
//+------------------------------------------------------------------+
Declarado &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);
}
¿Cómo puedo cambiar el color de un panel creado con la claseCAppDialog?
return(false);
Ya debes tenerlo preparado. ¿Cómo se hace allí? No puedo buscarlo, estoy escribiendo desde el móvil.
Pido disculpas por las molestias.
//+------------------------------------------------------------------+
//| start |
//+------------------------------------------------------------------+
int start()
{
а надо
//+------------------------------------------------------------------+//| start |
//+------------------------------------------------------------------+
int OnStart
{
Pero el archivo se crea, no con los datos solicitados,
resultado - una columna llena de 17 filas de boolean true
Hay una cadenaStringSetChar - jurada al principio,
lo cambió aboolStringSetCharacter- esa debe ser la razón del booleano
//| 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);
}