Ajuda na codificação - página 326

 

Alerta sobre a mudança de direção

Olá,

Em um EA que compra, por exemplo se MA10>MA20 (e vende ao contrário), como posso escrever um alerta se Comprar e MA10<MA20 ( e ao contrário) ?

Obrigado.

Jo

 
Jovager:
Olá,

Em um EA que compra, por exemplo se MA10>MA20 (e vende ao contrário), como posso escrever um alerta se Comprar e MA10<MA20 ( e ao contrário) ?

Obrigado.

Jo

Tente assim :

se (MA10<MA20) para a primeira condição

se (MA10 anterior>MA20 anterior && MA10<MA20) para a segunda condição

 
mladen:
Você está tentando alertas em um back test? Se sim, então essa é a causa: os alertas não funcionam no back test.

Obrigado. Eles costumavam, como no Build 509.

 
Big Be:
Obrigado. Eles costumavam, como no Build 509.

:):)

Muitas coisas costumavam funcionar e agora já não funcionam mais neste "novo metatarraxador". Experimente um período de tempo múltiplo no teste visual de costas e você terá um "divertimento" para o fim de semana.

 
mladen:
Parece-me familiarVisitará se já existe

Qualquer sorte nisso Sr. Mladen ...

Conseguiu encontrá-lo ...?

Obrigado ...

 
mladen:
):):):)Muitas coisas costumavam funcionar e agora não funcionam mais neste "novo metatrader". Experimente um período de tempo múltiplo no teste visual de costas e você terá um "divertimento" para o fim de semana

Olá Mladen

Vejo que você é um desses programadores prestativos, então eu poderia perguntar se você poderia fazer um EA com o indicador adicionado. Este não está repintando e fornece bons sinais surpreendentes!

Arquivos anexados:
 

Olá pessoal, pls ajudam a olhar para este código, o que pode ser feito para torná-lo alerta e mostrar setas na vela atual.

Obrigado de antemão.

// B83A886A5C437CCD9AC15473FD6F1788

void f0_2(string As_0) {

if (IsTesting() == FALSE && IsOptimization() == FALSE && IsVisualMode() == FALSE) SendMail(WindowExpertName(), As_0);

}

// A8CFDE6331BD59EB2AC96F8911C4B666

void f0_1(string A_name_0, string A_text_8, string A_fontname_16, int A_fontsize_24, cor A_color_28, int A_y_32, int A_x_36, int A_corner_40, int A_bool_44) {

ObjectCreate(A_name_0, OBJ_LABEL, 0, 0, 0, 0);

ObjectSetText(A_name_0, A_text_8, A_fontsize_24, A_fontname_16, A_color_28);

ObjectSet(A_name_0, OBJPROP_CORNER, A_corner_40);

ObjectSet(A_name_0, OBJPROP_XDISTANCE, A_x_36);

ObjectSet(A_name_0, OBJPROP_YDISTANCE, A_y_32);

ObjectSet(A_name_0, OBJPROP_BACK, A_bool_44);

}

// 085FEA7ABDC5D904FE69A3081EFD7398

void f0_0(string As_0, int GetBar) {

if (IsTesting() == FALSE && IsOptimization() == FALSE && IsVisualMode() == FALSE) {

se (som) PlaySound("News.wav");

if (alerta) Alerta("Novo sinal " + As_0+ " @ Symbol: "Símbolo()+" & Período: M "+Periodo()+" & Tempo: "+TimeToString(GetBar,TIME_MINUTES|TIME_SECONDS))

if (e-mail) f0_2("Novo sinal " + As_0+ " @ Symbol: "+Symbol()+" & Período: M "+Periodo()+" & Tempo: "+TimeToString(GetBar,TIME_MINUTES|TIME_SECONDS)));

}

}

// BE8F80182E0C983916DA7338C2C1C040

int f0_3(string A_name_0, string A_name_8) {

se (ObjectFind(A_name_0) == -1) retornar (0);

if (ObjectFind(A_nome_8) == -1) retorna (0);

if (ObjectGet(A_name_0, OBJPROP_XDISTANCE) > ObjectGet(A_name_8, OBJPROP_XDISTANCE) - 10.0 && ObjectGet(A_name_0, OBJPROP_XDISTANCE) < ObjectGet(A_name_8, OBJPROP_XDISTANCE) +

10.0) {

if (ObjectGet(A_name_0, OBJPROP_YDISTANCE) > ObjectGet(A_name_8, OBJPROP_YDISTANCE) - 10.0 && ObjectGet(A_name_0, OBJPROP_YDISTANCE) < ObjectGet(A_name_8, OBJPROP_YDISTANCE) +

10,0) retorno (1);

}

retorno (0);

}

// E4DB2306E8CC4DEB5830201DE61935CA

duplo f0_4() {

duplo Ld_ret_0 = 0;

para (int pos_8 = 0; pos_8 < OrdersTotal(); pos_8++) {

if (OrderSelect(pos_8, SELECT_BY_POS, MODE_TRADES) == VERDADEIRO)

se (OrderSymbol() == Symbol()) Ld_ret_0 += OrderProfit();

}

retorno (Ld_ret_0);

}

// EA2B2676C28C0DB26D39331A336C6B92

int start() {

fio Ls_0;

duplo iatr_20;

duplo Ld_28;

duplo Ld_36;

int TimeBar=0;

if (f0_3("x", "r4") == 1) {

alerta = FALSO;

ObjectDelete("r2");

f0_1("x", "G", "Wingdings", 25, Pink, 160, 55, 1, FALSE);

PlaySound("Tick.wav");

G_time_192 = 0;

RefreshRates();

}

se (f0_3("x", "t4") == 1) {

som = FALSO;

ObjectDelete("t2");

f0_1("x", "G", "Wingdings", 25, Pink, 160, 55, 1, FALSE);

PlaySound("Tick.wav");

G_time_192 = 0;

RefreshRates();

}

se (f0_3("x", "u4") == 1) {

e-mail = FALSO;

ObjectDelete("u2");

f0_1("x", "G", "Wingdings", 25, Pink, 160, 55, 1, FALSE);

PlaySound("Tick.wav");

G_time_192 = 0;

RefreshRates();

}

se (f0_3("x", "r3") == 1) {

alerta = VERDADEIRO;

f0_1("r2", "þ", "Reinos", 14, Vermelho, 55, 65, 1, FALSO);

f0_1("x", "G", "Reinos", 25, Rosa, 160, 55, 1, FALSO);

PlaySound("Tick.wav");

G_time_192 = 0;

RefreshRates();

}

se (f0_3("x", "t3") == 1) {

som = VERDADEIRO;

f0_1("t2", "þ", "Wingdings", 14, Vermelho, 80, 65, 1, FALSO);

f0_1("x", "G", "Reinos", 25, Rosa, 160, 55, 1, FALSO);

PlaySound("Tick.wav");

G_time_192 = 0;

RefreshRates();

}

se (f0_3("x", "u3") == 1) {

e-mail = VERDADEIRO;

f0_1("u2", "þ", "Reinos", 14, Vermelho, 105, 65, 1, FALSO);

f0_1("x", "G", "Reinos", 25, Rosa, 160, 55, 1, FALSO);

PlaySound("Tick.wav");

G_time_192 = 0;

RefreshRates();

}

para (int index_8 = 0; index_8 < 100; index_8++) {

se (G_ibuf_108 < 1000.0) {

TimeBar=Time;

Ls_0 = "COMPRAR";

intervalo;

}

se (G_ibuf_112 < 1000.0) {

TimeBar=Time;

Ls_0 = "SELL";

intervalo;

}

}

if (Ls_0 == "BUY" && ObjectDescription("Signal1") != "BUY") {

f0_0("BUY",TimeBar);

f0_1("Signal1", "BUY", "Wingdings 3", 30, White, 80, 32, 1, FALSE);

}

if (Ls_0 == "SELL" && ObjectDescription("Signal1") != "SELL") {

f0_0("SELL",TimeBar);

f0_1("Signal1", "SELL", "Wingdings 3", 30, Branco, 80, 25, 1, FALSO);

}

f0_1("r1", "Profit", "Arial", 10, Lime, 50, 80, 1, FALSE);

f0_1("Pr", DoubleToStr(f0_4(), 0), "Arial", 13, Yellow, 50, 35, 1, FALSE);

if (Time[0] == G_time_192) return (0);

G_time_192 = Tempo[0];

int Li_12 = Barras - IndicatorCounted();

if (IndicatorCounted() > 0) Li_12++;

for (int bars_16 = Barras; bars_16 > 0; bars_16--) {

if (bars_16 <= HistoriBar) {

iatr_20 = iATR(NULL, 0, 100, 0);

Ld_28 = Close - iATR(NULL, 0, PeriodIndikator, bars_16) * Fator;

Ld_36 = Fechar + iATR(NULL, 0, PeriodIndikator, barras_16) * Fator;

if (Ld_28 > Gd_156 && Gi_180 == 1) Gd_156 = Ld_28;

if (Ld_36 < Gd_148 && Gi_180 === 2) Gd_148 = Ld_36;

if (Gd_156 != 0,0 && Gi_180 === 1) Gd_unused_124 = Gd_156;

if (Gd_148 != 1000.0 && Gi_180 == 2) Gd_unused_132 = Gd_148;

if (Fechar < Gd_156 && Gi_180 == 1) {

Gi_180 = 2;

if (bars_16 < HistoriBar / 2.0) G_ibuf_112 = Alto + iatr_20;

Gd_156 = 0;

}

if (Fechar > Gd_148 && Gi_180 == 2) {

Gi_180 = 1;

if (bars_16 < HistoriBar / 2.0) G_ibuf_108 = Baixa - iatr_20;

Gd_148 = 1000;

}

}

}

retorno (0);

}

// 52D46093050F38C27267BCE42543EF60

int deinit() {

 
wolfsch:
Oi, Mladen, vejo que você é um desses programadores úteis, então posso perguntar se você poderia fazer uma EA com o indicador adicionado. Este não está repintando e fornece bons sinais surpreendentes!

wolfsch

Devo decepcioná-lo, mas esse indicador está usando o indicador T3 limpo e o indicador Snake. Agora, o T3 não pinta de novo. Mas "cobra" é tma centrado e recalcula o que faz desse indicador um tipo de recálculo (repintura)

PS: na verdade, esse é um indicador renomeado "combinação T3 TMA" que foi então renomeado para indicador "uni cross". Mais informações sobre ele você pode encontrar aqui : https://www.mql5.com/en/forum/general

 
emmany4:
Olá pessoal, pls ajudam a olhar para este código, o que pode ser feito para torná-lo alerta e mostrar as setas na vela atual.

Obrigado de antemão

// B83A886A5C437CCD9AC15473FD6F1788

void f0_2(string As_0) {

if (IsTesting() == FALSE && IsOptimization() == FALSE && IsVisualMode() == FALSE) SendMail(WindowExpertName(), As_0);

}

// A8CFDE6331BD59EB2AC96F8911C4B666

void f0_1(string A_name_0, string A_text_8, string A_fontname_16, int A_fontsize_24, cor A_color_28, int A_y_32, int A_x_36, int A_corner_40, int A_bool_44) {

ObjectCreate(A_name_0, OBJ_LABEL, 0, 0, 0, 0);

ObjectSetText(A_name_0, A_text_8, A_fontsize_24, A_fontname_16, A_color_28);

ObjectSet(A_name_0, OBJPROP_CORNER, A_corner_40);

ObjectSet(A_name_0, OBJPROP_XDISTANCE, A_x_36);

ObjectSet(A_name_0, OBJPROP_YDISTANCE, A_y_32);

ObjectSet(A_name_0, OBJPROP_BACK, A_bool_44);

}

// 085FEA7ABDC5D904FE69A3081EFD7398

void f0_0(string As_0, int GetBar) {

if (IsTesting() == FALSE && IsOptimization() == FALSE && IsVisualMode() == FALSE) {

se (som) PlaySound("News.wav");

if (alerta) Alerta("Novo sinal " + As_0+ " @ Symbol: "Símbolo()+" & Período: M "+Periodo()+" & Tempo: "+TimeToString(GetBar,TIME_MINUTES|TIME_SECONDS))

if (email) f0_2("Novo sinal " + As_0+ " @ Symbol: "+Symbol()+" & Período: M "+Periodo()+" & Tempo: "+TimeToString(GetBar,TIME_MINUTES|TIME_SECONDS)));

}

}

// BE8F80182E0C983916DA7338C2C1C040

int f0_3(string A_name_0, string A_name_8) {

se (ObjectFind(A_name_0) == -1) retornar (0);

if (ObjectFind(A_nome_8) == -1) retorna (0);

if (ObjectGet(A_name_0, OBJPROP_XDISTANCE) > ObjectGet(A_name_8, OBJPROP_XDISTANCE) - 10.0 && ObjectGet(A_name_0, OBJPROP_XDISTANCE) < ObjectGet(A_name_8, OBJPROP_XDISTANCE) +

10.0) {

if (ObjectGet(A_name_0, OBJPROP_YDISTANCE) > ObjectGet(A_name_8, OBJPROP_YDISTANCE) - 10.0 && ObjectGet(A_name_0, OBJPROP_YDISTANCE) < ObjectGet(A_name_8, OBJPROP_YDISTANCE) +

10,0) retorno (1);

}

retorno (0);

}

// E4DB2306E8CC4DEB5830201DE61935CA

duplo f0_4() {

duplo Ld_ret_0 = 0;

para (int pos_8 = 0; pos_8 < OrdersTotal(); pos_8++) {

if (OrderSelect(pos_8, SELECT_BY_POS, MODE_TRADES) == VERDADEIRO)

se (OrderSymbol() == Symbol()) Ld_ret_0 += OrderProfit();

}

retorno (Ld_ret_0);

}

// EA2B2676C28C0DB26D39331A336C6B92

int start() {

fio Ls_0;

duplo iatr_20;

duplo Ld_28;

duplo Ld_36;

int TimeBar=0;

if (f0_3("x", "r4") == 1) {

alerta = FALSO;

ObjectDelete("r2");

f0_1("x", "G", "Wingdings", 25, Pink, 160, 55, 1, FALSE);

PlaySound("Tick.wav");

G_time_192 = 0;

RefreshRates();

}

se (f0_3("x", "t4") == 1) {

som = FALSO;

ObjectDelete("t2");

f0_1("x", "G", "Wingdings", 25, Pink, 160, 55, 1, FALSE);

PlaySound("Tick.wav");

G_time_192 = 0;

RefreshRates();

}

se (f0_3("x", "u4") == 1) {

e-mail = FALSO;

ObjectDelete("u2");

f0_1("x", "G", "Wingdings", 25, Pink, 160, 55, 1, FALSE);

PlaySound("Tick.wav");

G_time_192 = 0;

RefreshRates();

}

se (f0_3("x", "r3") == 1) {

alerta = VERDADEIRO;

f0_1("r2", "þ", "Reinos", 14, Vermelho, 55, 65, 1, FALSO);

f0_1("x", "G", "Reinos", 25, Rosa, 160, 55, 1, FALSO);

PlaySound("Tick.wav");

G_time_192 = 0;

RefreshRates();

}

se (f0_3("x", "t3") == 1) {

som = VERDADEIRO;

f0_1("t2", "þ", "Wingdings", 14, Vermelho, 80, 65, 1, FALSO);

f0_1("x", "G", "Reinos", 25, Rosa, 160, 55, 1, FALSO);

PlaySound("Tick.wav");

G_time_192 = 0;

RefreshRates();

}

se (f0_3("x", "u3") == 1) {

e-mail = VERDADEIRO;

f0_1("u2", "þ", "Reinos", 14, Vermelho, 105, 65, 1, FALSO);

f0_1("x", "G", "Reinos", 25, Rosa, 160, 55, 1, FALSO);

PlaySound("Tick.wav");

G_time_192 = 0;

RefreshRates();

}

para (int index_8 = 0; index_8 < 100; index_8++) {

se (G_ibuf_108 < 1000.0) {

TimeBar=Time;

Ls_0 = "COMPRAR";

intervalo;

}

se (G_ibuf_112 < 1000.0) {

TimeBar=Time;

Ls_0 = "SELL";

intervalo;

}

}

if (Ls_0 == "BUY" && ObjectDescription("Signal1") != "BUY") {

f0_0("BUY",TimeBar);

f0_1("Signal1", "BUY", "Wingdings 3", 30, White, 80, 32, 1, FALSE);

}

if (Ls_0 == "SELL" && ObjectDescription("Signal1") != "SELL") {

f0_0("SELL",TimeBar);

f0_1("Signal1", "SELL", "Wingdings 3", 30, Branco, 80, 25, 1, FALSO);

}

f0_1("r1", "Profit", "Arial", 10, Lime, 50, 80, 1, FALSE);

f0_1("Pr", DoubleToStr(f0_4(), 0), "Arial", 13, Yellow, 50, 35, 1, FALSE);

if (Time[0] == G_time_192) return (0);

G_time_192 = Tempo[0];

int Li_12 = Barras - IndicatorCounted();

if (IndicatorCounted() > 0) Li_12++;

for (int bars_16 = Barras; bars_16 > 0; bars_16--) {

if (bars_16 <= HistoriBar) {

iatr_20 = iATR(NULL, 0, 100, 0);

Ld_28 = Close - iATR(NULL, 0, PeriodIndikator, bars_16) * Fator;

Ld_36 = Fechar + iATR(NULL, 0, PeriodIndikator, barras_16) * Fator;

if (Ld_28 > Gd_156 && Gi_180 == 1) Gd_156 = Ld_28;

if (Ld_36 < Gd_148 && Gi_180 === 2) Gd_148 = Ld_36;

if (Gd_156 != 0,0 && Gi_180 === 1) Gd_unused_124 = Gd_156;

if (Gd_148 != 1000.0 && Gi_180 == 2) Gd_unused_132 = Gd_148;

if (Fechar < Gd_156 && Gi_180 == 1) {

Gi_180 = 2;

if (bars_16 < HistoriBar / 2.0) G_ibuf_112 = Alto + iatr_20;

Gd_156 = 0;

}

if (Fechar > Gd_148 && Gi_180 == 2) {

Gi_180 = 1;

if (bars_16 < HistoriBar / 2.0) G_ibuf_108 = Baixa - iatr_20;

Gd_148 = 1000;

}

}

}

retorno (0);

}

// 52D46093050F38C27267BCE42543EF60

int deinit() {

Olá Emmany4, se você encontrar o código original para essa EA provavelmente poderá adicionar ou corrigir as setas e alertas para compra e venda, mas essa versão está descompilada.

 
mrtools:
Olá Emmany4, se você encontrar o código original para essa EA provavelmente poderá adicionar ou corrigir as setas e alertas para compra e venda, mas essa versão está descompilada.

Tanto quanto vejo, trata-se de um código descompilado incompleto de alguma super variação de tendência (aquele que usa atr, não a versão cci). Nada mais. De qualquer forma, esse código como está, não pode funcionar (faltam grandes partes dele).