Alert Delay

MQL4 스크립트

작업 종료됨

실행 시간 3 분
피고용인의 피드백
Good customer. Thank you for your order!
고객의 피드백
very professional programmer !!!!!

명시

Hi, I wrote this simple code where the alert will appear after 10 seconds after the opening of the bar. I would like to know if you can have 10 real seconds after the end of the bar and not wait for the start of the new bar. (Time [0]).

 

//+------------------------------------------------------------------+
//|                                                  Delay_Alert.mq4 |
//|                        Copyright 2016, MetaQuotes Software Corp. |
//|                                             https://www.mql5.com |
//+------------------------------------------------------------------+


//--- 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"
int CurrentTime;
int extern Period1=2;
 

//--- indicator buffers
double Buffer1[];
double Buffer2[];



//+------------------------------------------------------------------+
//| 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);
   
  
   return(INIT_SUCCEEDED);
  }

//+------------------------------------------------------------------+
//| Custom indicator iteration function                              |
//+------------------------------------------------------------------+
int OnCalculate(const int rates_total,
                const int prev_calculated,
                const datetime& time[],
                const double& open[],
                const double& high[],
                const double& low[],
                const double& close[],
                const long& tick_volume[],
                const long& volume[],
                const int& spread[])
 
  
{
  static datetime BarStart=0;
   static bool check=false;
    if(BarStart!=Time[0])
     {
      BarStart=Time[0];
      check=true;
     }
   if(check && TimeCurrent()>=Time[0]+10)
     {
      check=false;
      //Check Condition
    
  
      //Indicator Buffer 1
      if(iRSI(NULL, PERIOD_CURRENT, Period1, PRICE_CLOSE, 0) < 40
      
      )
        {
         Buffer1[0] = Low[0] - 10* Point();  
        }
      else
        {
         Buffer1[0] = 0;
        }
      //Indicator Buffer 2
      if(iRSI(NULL, PERIOD_CURRENT, Period1, PRICE_CLOSE, 0) > 60
     
      )
        {
         Buffer2[0] = High[0] + 10 * Point(); 
         
        }
      else
        {
         Buffer2[0] = 0;
        }
     }
      
return(0);
}
 //-----------------------------------------------------------------------------------------------------------------------------  
 

 

The indicator will use it for OB 60 seconds, so I want to be very precise. When the server timer is equal to 10 seconds to appear the arrow. In the examples that you sent me, the arrow appears in many cases after 12, 15 seconds, and that's not good.



응답함

1
개발자 1
등급
(41)
프로젝트
72
8%
중재
18
11% / 56%
기한 초과
18
25%
무료
2
개발자 2
등급
(26)
프로젝트
34
29%
중재
0
기한 초과
1
3%
무료
3
개발자 3
등급
(257)
프로젝트
341
58%
중재
7
14% / 71%
기한 초과
9
3%
무료
4
개발자 4
등급
(164)
프로젝트
218
50%
중재
6
17% / 67%
기한 초과
11
5%
무료
5
개발자 5
등급
(170)
프로젝트
228
60%
중재
3
33% / 33%
기한 초과
6
3%
무료
게재됨: 1 코드
6
개발자 6
등급
(106)
프로젝트
314
49%
중재
42
52% / 19%
기한 초과
22
7%
무료
7
개발자 7
등급
(1156)
프로젝트
1462
63%
중재
21
57% / 10%
기한 초과
43
3%
무료
8
개발자 8
등급
(91)
프로젝트
144
38%
중재
67
15% / 48%
기한 초과
55
38%
무료
9
개발자 9
등급
(71)
프로젝트
156
44%
중재
22
41% / 14%
기한 초과
16
10%
무료
게재됨: 10 코드
10
개발자 10
등급
(452)
프로젝트
564
26%
중재
24
42% / 38%
기한 초과
85
15%
작업중
게재됨: 6 코드

프로젝트 정보

예산
10 - 15 USD
기한
에서 2  5 일