Perguntas de Iniciantes MQL4 MT4 MetaTrader 4 - página 229
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
Obrigado, existe outra solução? Depois disso, a EA abre e imediatamente fecha a posição.
você precisa fixar o tempo com a condição
e não atualizá-lo até que a posição seja fechada
em seguida, subtraia do tempo atual o tempo que você memorizou
, quando os segundos dados tiverem passado, feche as posições.
Eu o fiz
double op = CalculateProfit();
int time_waiting=0;
if (op >= Profit)
time_waiting = TimeLocal() + 10;
if (TimeLocal() < time_waiting)
{
CloseAll();
}
mas isso me dá um erro
possível perda de dados devido à conversão do tipo
não é um erro, mas um aviso: os dados podem ser perdidos ao se converter de um tipo para outro:
datetime time_waiting;
Ou seja, não quero que a EA feche tão logo eu veja 2 libras, mas um pouco mais.
E o que, sempre após 10 segundos o lucro é maior?)
Se você não se importa, por favor, ajude-me a consertá-lo...
Aceitando plena responsabilidade pelo fato de que
ushort
O tipo curtonão assinado é o tipo ushort, que também tem um tamanho de 2 bytes. O valor mínimo é 0, o valor máximo é 65.535.
int
O tipo int inteiro tem um tamanho de 4 bytes (32 bits). O valor mínimo é de -2 147 483 648, o valor máximo é de 2 147 483 647.
Eu fiz como você disse, mas por alguma razão depois de fechar o Expert Advisor fecha alguns negócios, apesar do fato de eu ter um deslize de uma hora após a função CloseAll().
double op = CalculateProfit();
if (op >= Lucro && LastTime == 0)
LastTime = TimeCurrent ();
if(LastTime > 0 && TimeCurrent () - LastTime >= Second)
{
CloseAll();
LastTime = 0;
SendNotification("Trade is over");
Sleep(60*60000);// 60.000 = 1 min
}