omissamf: Eu gostaria de modificar este código
- Então o que o impede. Aprenda a codificá-lo ou pagar a alguém. Nós não vamos codificá-lo para você. Estamos dispostos a lhe AJUDAR quando você postar sua tentativa (usando SRC) e a natureza de seu problema.
- Você já tentou
BarStart = Time[0]; Sleep(3000); RefreshRates();
Olá WHRoeder , obrigado pela resposta. Peço desculpas por meu comportamento, mas não foi minha intenção ofender e desrespeitar a ninguém. Tentei o dia todo mudar o código para conseguir isso, mas não consegui. Eles são o início do estudo MQL4 . Peço novamente desculpas aos administradores . Saudações , Massimo
Olá WHRoeder, eu tentei, mas não funciona!! Eu tentei de todas as maneiras, mas não entendo onde estou errado!!
De qualquer forma, obrigado por tudo, Massimo.
Olá GunRai, eu lhe envio o código completo, então eu explicarei. Não pude atrasar a confirmação das condições de abertura da vela (como está fazendo agora), mas após 3 segundos, até mesmo a sugestão do WHRoeder. Eu não consigo entender onde estou errado !!!
Obrigado, Max.
//+------------------------------------------------------------------+ //| RSI 70-30.mq4 | //| Massimo | //| https://www.mql5.com | //+------------------------------------------------------------------+ #property copyright "Massimo" #property link "https://www.mql5.com" #property version "1.00" #include <stdlib.mqh> #include <stderror.mqh> //--- indicator settings #property indicator_chart_window #property indicator_buffers 2 #property indicator_type1 DRAW_ARROW #property indicator_width1 1 #property indicator_color1 0xFFAA00 #property indicator_label1 "Buy" #property indicator_type2 DRAW_ARROW #property indicator_width2 1 #property indicator_color2 0x0000FF #property indicator_label2 "Sell" static datetime BarStart=0; //--- indicator buffers double Buffer1[]; double Buffer2[]; datetime time_alert; //used when sending alert extern bool Audible_Alerts = true; double myPoint; //initialized in OnInit void myAlert(string type, string message) { if(type == "print") Print(message); else if(type == "error") { Print(type+" | RSI 30-70 @ "+Symbol()+","+Period()+" | "+message); } else if(type == "order") { } else if(type == "modify") { } else if(type == "indicator") { if(Audible_Alerts) Alert(type+" | RSI 30-70 @ "+Symbol()+","+Period()+" | "+message); } } //+------------------------------------------------------------------+ //| Custom indicator initialization function | //+------------------------------------------------------------------+ int OnInit() { IndicatorBuffers(2); SetIndexBuffer(0, Buffer1); SetIndexEmptyValue(0, 0); SetIndexArrow(0, 241); SetIndexBuffer(1, Buffer2); SetIndexEmptyValue(1, 0); SetIndexArrow(1, 242); //initialize myPoint myPoint = Point(); if(Digits() == 5 || Digits() == 3) { myPoint *= 10; } return(INIT_SUCCEEDED); } //_____________________________________________ //_____________________________________________ int start(){ if (BarStart !=Time[0]) { BarStart = Time[0]; Sleep(3000); RefreshRates(); //this code don't work // //Indicator Buffer 1 if(iRSI(NULL, PERIOD_CURRENT, 2, PRICE_CLOSE, 0) < 30 ) { Buffer1[0] = Low[0] - iATR(NULL, PERIOD_CURRENT, 14, 0); //Set indicator value at Candlestick Low - Average True Range if(0 == 0 && Time[0] != time_alert) { myAlert("indicator", "Buy"); time_alert = Time[0]; } //Instant alert, only once per bar } else { Buffer1[0] = 0; } //Indicator Buffer 2 if(iRSI(NULL, PERIOD_CURRENT, 2, PRICE_CLOSE, 0) > 70 ) { Buffer2[0] = High[0] + iATR(NULL, PERIOD_CURRENT, 14, 0); //Set indicator value at Candlestick High + Average True Range if(0 == 0 && Time[0] != time_alert) { myAlert("indicator", "Sell"); time_alert = Time[0]; } //Instant alert, only once per bar } else { Buffer2[0] = 0; } } return(0); } //+------------------------------------------------------------------+
Você está correto; você está executando um indicador. | int start(){ if (BarStart !=Time[0]) { BarStart = Time[0]; Sleep(3000); RefreshRates(); //this code don't work |
Tente isto | #define MAX_DATETIME D'3000.12.31 23:59:59' // 32,535,215,999 #define MIN_DATETIME D'1970.01.01 00:00:00' // Zero. int start(){ static datetime alertTime = MAX_DATETIME; if(TimeCurrent() > alertTime){ alertTime = MAX_DATETIME; Alert(...); } if (BarStart !=Time[0]) { BarStart = Time[0]; : if(condition) alertTime = TimeCurrent() + 3; // Delay |
WHRoeder:
Obrigado, agora eu estudo o código que você me postou e depois o informo.Você está correto; você está executando um indicador. | |
Tente isto |
Por enquanto, infinitos agradecimentos, Massimo.
WHRoeder:
WHRoeder Olá, eu tentei mudar o código com suas instruções. Tentei várias maneiras e é isso que você envia , não tem erros, mas o atraso de cerca de cinco segundos só tem som de alerta, enquanto as setas continuam aparecendo exatamente na abertura da vela.Você está correto; você está executando um indicador. | |
y thi |
Olá e obrigado, Massimo.
#define MAX_DATETIME D'3000.12.31 23:59:59' // 32,535,215,999 #define MIN_DATETIME D'1970.01.01 00:00:00' // Zero. int start(){ static datetime alertTime = MAX_DATETIME; if (TimeCurrent() > alertTime) { alertTime = MAX_DATETIME; Alert(“ ATTENTION!!!!); } if (BarStart !=Time[0]) { BarStart = Time[0]; // //Indicator Buffer 1 if(iRSI(NULL, PERIOD_CURRENT, 2, PRICE_CLOSE, 0) < 30 ) { alertTime = TimeCurrent() + 3; Buffer1[0] = Low[0] - iATR(NULL, PERIOD_CURRENT, 14, 0); } else { Buffer1[0] = 0; } //Indicator Buffer 2 if(iRSI(NULL, PERIOD_CURRENT, 2, PRICE_CLOSE, 0) > 70 ) { alertTime = TimeCurrent() + 3; Buffer2[0] = High[0] + iATR(NULL, PERIOD_CURRENT, 14, 0); } else { Buffer2[0] = 0; } } return(0); } //+------------------------------------------------------------------+
omissamf: só há som de alerta,
- Não faço a menor idéia do que você quis dizer.
Alert(“ ATTENTION!!!!); }
Código de tentativa/pós-post que compila.
WHRoeder:
Coloco ATENÇÃO !!! porque é o que aparece em alerta sonoro / visual, mas estou tentando, com sua ajuda, atrasar o início da Seta alguns segundos. Neste caso. Atenção !!! Ela aparecerá após 5 segundos, enquanto as Setas aparecem apenas abram a vela.- Não faço a menor idéia do que você quis dizer.
- Código de tentativa/pós-post que compila.
Obrigado por tudo, Massimo.
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
Gostaria de modificar este código para que o alerta, em vez de aparecer na abertura da vela, detecte as condições após alguns segundos.
Obrigado por tudo, Massimo.