Perguntas de Iniciantes MQL5 MT5 MetaTrader 5 - página 689
Você está perdendo oportunidades de negociação:
- Aplicativos de negociação gratuitos
- 8 000+ sinais para cópia
- Notícias econômicas para análise dos mercados financeiros
Registro
Login
Você concorda com a política do site e com os termos de uso
Se você não tem uma conta, por favor registre-se
a fórmula é a partir daqui - https://www.mql5.com/ru/articles/1492
A fórmula é retirada daqui - https://www.mql5.com/ru/articles/1492
Ainda não o li. Mas a julgar pela fórmula e pelos gráficos do artigo (Excel), é um aumento de poder.
Posso estar enganado.
Boa altura! Ao pensar em como traduzir uma matriz 2D em formato *.csv, encontrou um exemplo adequado, mas é para mt4, necessário 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
Boa altura! Ao pensar em como traduzir uma matriz 2D em formato *.csv, encontrou um exemplo adequado, mas é para mt4, necessário para 5.
https://www.mql5.com/ru/articles/1443
As arrays só podem ser transferidas por referência:
double & arrayIndexX[], double & arrayIndexY[], double & arrayZ[][])
As arrays só podem ser transferidas por referência:
double & arrayIndexX[], double & arrayIndexY[], double & arrayZ[][])
E no entanto falha&arrayZ[][] diz -'[' - valor de índice inválido
E quantas dimensões é o arrayZ declarado?
Eu declarei &arrayZ[][3000], se eu o igualar a 16, então a função de tratamento de eventos não foi de todo encontrada
#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][3000][3000][3000][3000][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);
}
Como posso mudar a cor de um painel criado usando a classeCAppDialog?
return(false);
Já deve tê-lo preparado. Como é feito lá? Não consigo procurar - estou a escrever a partir do meu telemóvel.
Peço desculpa pelo inconveniente.
//+------------------------------------------------------------------+
//| start |
//+------------------------------------------------------------------+
int start()
{
а надо
//+------------------------------------------------------------------+//| start |
//+------------------------------------------------------------------+
int OnStart
{
Mas o ficheiro cria, não com os dados solicitados,
resultado - uma coluna preenchida com 17 filas de verdade booleana
Há um cordelStringSetChar - jurou no início,
mudou-o paraboolStringSetCharacter- essa deve ser a razão para o 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);
}