延缓警报几秒钟

 
大家好。
我想 修改这 代码 使 警报 不是 蜡烛 开盘时 出现,而是 几秒钟 检测 条件

谢谢你做的一切 马西莫


int start(){
if (BarStart !=Time[0]) 
{
  BarStart = Time[0]; 

  //Indicator Buffer 1
     
       if ( iRSI(NULL, PERIOD_CURRENT, 2, PRICE_CLOSE, 0+1) > 70
      
      
      )
        {
         Buffer1[0] = Low[0] - iATR(NULL, PERIOD_CURRENT, 14, 0); //Set indicator value at Candlestick Low - Average True Range
        }
      else
        {
         Buffer1[0] = 0;
        }
      //Indicator Buffer 2
    
      && iRSI(NULL, PERIOD_CURRENT, 2, PRICE_CLOSE, 0) < 30
     
      )
        {
         Buffer2[0] = High[0] + iATR(NULL, PERIOD_CURRENT, 14, 0); //Set indicator value at Candlestick High + Average True Range
        }
      else
        {
         Buffer2[0] = 0;
        }
     }
   return(0);
  }
 
omissamf: 我想 修改这个 代码
  1. 那么,是什么阻止了你呢?学会 编码,或者付钱给 别人。我们不打算为你编码。当你发布你 尝试(使用SRC)和 问题的性质时,我们愿意帮助你。
  2. 你是否尝试过
      BarStart = Time[0]; 
      Sleep(3000); RefreshRates();

 
你好,WHRoeder,谢谢你的回答。我为我的行为道歉,但我的目的不是要冒犯和不尊重任何人。我整天都在试图改变代码来实现这一点,但我没有成功。他们是研究MQL4的开始。我要求再次向管理员道歉。问候,Massimo
 

你好,WHRoeder,我试过了,但没有 用!!!我尝试了所有的方法,但不明白我错在哪里!!!。

总之,感谢你所做的一切,Massimo。

 
我在你的代码中没有看到一个警报
 
你好GunRai 我把 完整的代码 发给你 所以 我解释一下 我不能 延迟 确认 蜡烛 打开条件 因为它 现在正在做 但在3 ,甚至 WHRoeder 建议 我不 明白 在哪里 错了!!!!!。

谢谢 马克斯


//+------------------------------------------------------------------+
//|                                                    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);
  }
//+------------------------------------------------------------------+
 
你是正确的,你正在运行一个指标。
int start(){
if (BarStart !=Time[0]) 
{
  BarStart = Time[0]; 
   Sleep(3000); RefreshRates(); //this code don't work
试试这个
#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:
你是正确的,你正在运行一个指标。
试试这个

谢谢 现在 我研究一下 你发给 我的 代码 ,然后 让你知道
现在 无限的感谢 Massimo
 
WHRoeder:
你是正确的;你正在运行一个指标。
y thi

WHRoeder 你好 我试着 你的指示改变代码 我尝试了 各种 方法 这是你 发送的 是你 没有错误 但延迟 五秒钟 ,只有 sull'alert的 声音 箭头 不断出现 准确的 蜡烛的 开放

你好谢谢你 马西莫

#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: 只有 sull'alert声音
  1. 不知道你是什么意思。
  2. Alert( ATTENTION!!!!); }
    试着/贴出能编译的 代码。
 
WHRoeder:
  1. 不知道你是什么意思。
  2. 试着/贴出能编译的 代码。
我把 ATTENTION !!!因为它是 声音 / 视觉 警报 出现的 但我正在 尝试, 在你的帮助下延迟 发作 几秒钟 在这种情况下。 注意 !!!它将 在5 出现 ,而 箭头 在刚打开 蜡烛 出现
谢谢你所做的一切 马西莫