Como codificar? - página 24

 

obrigado

obrigado. você é um salva-vidas

 
BC Brett:
Gostaria de ter a resposta.

Acabei de escrever meu primeiro EA e tentei testá-lo no Strategy Tester.

Eu estava recebendo erros mostrados no diário ST, então tentei usar a função Imprimir no meu EA para depurar os problemas. Até agora, resolvi alguns bugs desta maneira, mas é um processo lento.

no metaeditor em menu de edição existem "toggle breakpoint" ... como usar breakpoint?

 

Apenas a título de informação:

- tópico sobre a função de e-mail (como codificar) https://www.mql5.com/en/forum/174336

- bom artigo com alguma ferramenta https://www.mql5.com/en/forum/176053

 

Código para TP e SL Invisível dos Corretores

Olá a todos,

Com a paranóia dos corretores à caça de SLs e o alargamento dos spreads para evitar TPs, estou procurando informações sobre como esconder TP e SL dos corretores.

Sei que, ao submeter um TP e SL ao corretor, caso você esteja desconectado de seu pedido é "seguro". Enquanto mantém a informação à distância, há o perigo de grandes perdas caso a conexão seja perdida.

Alguém tem um EA ou exemplo de código sobre como manter TP e SL escondidos do corretor?

Obrigado!

Mike

 

Esta EA tem isso

Oi MikeP

Acho que esta EA contém o que você está procurando. Por favor, me pergunte se isto é o que você está procurando, tenho outra idéia com isto.

Arquivos anexados:
jlpigrid.mq4  8 kb
 

Ajuda para simplificar um pedaço de código

Olá!

Eu não sou um programador profissional (veja abaixo!). Este código funciona bem, mas é possível simplificá-lo? Com um tempo/ por ciclo, por exemplo? Eu desejo o código mais leve! Este é muito "pesado" e eu recebo o erro "excesso de pilha interna - simplifique o programa, por favor"!!!

É um indicador em uma janela separada.

No código de exemplo, ele exibe o para cima ou para baixo para MA para multi TF.

Obrigado por sua ajuda.

int start()

{

string MAfast_Trend_1, MAfast_Trend_5, MAfast_Trend_15;

double x;

color color_indic;

// period M1

double FastMA_1_1 = iMA(NULL,PERIOD_M1,FastMAPeriod,0,MAMethod,MAPrice,MAShift);

double FastMA_2_1 = iMA(NULL,PERIOD_M1,FastMAPeriod,0,MAMethod,MAPrice,MAShift+1);

if ((FastMA_1_1 > FastMA_2_1)) { MAfast_Trend_1 = "UP"; x = 256; color_indic = Lime; }

if ((FastMA_1_1 < FastMA_2_1)) { MAfast_Trend_1 = "DOWN"; x = 246; color_indic = Red; }

ObjectCreate("Trend_MAfast_1", OBJ_LABEL, WindowFind("xxxxxxx"), 0, 0);

ObjectSetText("Trend_MAfast_1",MAfast_Trend_1,7, "Verdana", color_indic);

ObjectSet("Trend_MAfast_1", OBJPROP_CORNER, 0);

ObjectSet("Trend_MAfast_1", OBJPROP_XDISTANCE, x);

ObjectSet("Trend_MAfast_1", OBJPROP_YDISTANCE, 22);

// period M5

double FastMA_1_5 = iMA(NULL,PERIOD_M5,FastMAPeriod,0,MAMethod,MAPrice,MAShift);

double FastMA_2_5 = iMA(NULL,PERIOD_M5,FastMAPeriod,0,MAMethod,MAPrice,MAShift+1);

if ((FastMA_1_5 > FastMA_2_5)) { MAfast_Trend_5 = "UP"; x = 256; color_indic = Lime; }

if ((FastMA_1_5 < FastMA_2_5)) { MAfast_Trend_5 = "DOWN"; x = 246; color_indic = Red; }

ObjectCreate("Trend_MAfast_5", OBJ_LABEL, WindowFind("xxxxxxx"), 0, 0);

ObjectSetText("Trend_MAfast_5",MAfast_Trend_5,7, "Verdana", color_indic);

ObjectSet("Trend_MAfast_5", OBJPROP_CORNER, 0);

ObjectSet("Trend_MAfast_5", OBJPROP_XDISTANCE, x);

ObjectSet("Trend_MAfast_5", OBJPROP_YDISTANCE, 37);

// period M15

double FastMA_1_15 = iMA(NULL,PERIOD_M15,FastMAPeriod,0,MAMethod,MAPrice,MAShift);

double FastMA_2_15 = iMA(NULL,PERIOD_M15,FastMAPeriod,0,MAMethod,MAPrice,MAShift+1);

if ((FastMA_1_15 > FastMA_2_15)) { MAfast_Trend_15 = "UP"; x = 256; color_indic = Lime; }

if ((FastMA_1_15 < FastMA_2_15)) { MAfast_Trend_15 = "DOWN"; x = 246; color_indic = Red; }

ObjectCreate("Trend_MAfast_15", OBJ_LABEL, WindowFind("xxxxxxx"), 0, 0);

ObjectSetText("Trend_MAfast_15",MAfast_Trend_15,7, "Verdana", color_indic);

ObjectSet("Trend_MAfast_15", OBJPROP_CORNER, 0);

ObjectSet("Trend_MAfast_15", OBJPROP_XDISTANCE, x);

ObjectSet("Trend_MAfast_15", OBJPROP_YDISTANCE, 52);

etc ...............

return(0);

}
 

Ajuda do código? Apenas um comércio por vela

Estou tentando restringir minha ea a tomar apenas um comércio por vela. Estou descobrindo que em picos de preços contra a tendência, estou obtendo múltiplos negócios perdidos, pois os indicadores estão atrasados.

Eu já vi o código antes, mas não consigo encontrá-lo. Se alguém pudesse me indicar uma ea que tenha o código correto ou me mostrar como ele é feito.

Ele é feito na UniversalMa ea, mas não é tão claro para mim lá.

Qualquer ajuda seria bem-vinda.

 

Está aqui https://www.mql5.com/en/forum/173026

Estou coletando todas as funções desta linha https://www.mql5.com/en/forum/174329

 

Obrigado novamente

Olá NewDigital, como sempre obrigado por sua pronta resposta.

saúde

 

Aqui estão algumas maneiras de simplificar seu código:

SUBSTITUIR VALORES INDICADORES INDIVIDUAIS POR FUNÇÃO

duplo FastMA_1_5 = iMA(NULL,PERÍODO_M5,FastMAPeriod,0,MAMethod,MAPrice,MAShift);

duplo FastMA_1_15 = iMA(NULL,PERÍODO_M15,FastMAPeriod,0,MAMethod,MAPrice,MAShift);

.... se transforma nisto com uma função adicional

maVal(5,1);

maVal(15,1);

A FUNÇÃO QUE ELES ESTÃO CHAMANDO ESTÁ ABAIXO:

maVal(int tf, int shift)

{

retorno ( iMA(NULL,tf,FastMAPeriod,0,MAMethod,MAPrice,shift) )

}

Substitua também outras variáveis individuais que você tenha como as variáveis de string por uma matriz de string. Os arrays funcionarão muito bem em loops e simplificarão seu código porque você tem menos declarações a fazer.

String MAfast_Trend_1, MAfast_Trend_5, MAfast_Trend_15;

.... torna-se esta.....

string MAfast_Trend_Trend [3];