거래 로봇을 무료로 다운로드 하는 법을 시청해보세요
당사를 Telegram에서 찾아주십시오!
당사 팬 페이지에 가입하십시오
스크립트가 흥미로우신가요?
그렇다면 링크 to it -
하셔서 다른 이들이 평가할 수 있도록 해보세요
스크립트가 마음에 드시나요? MetaTrader 5 터미널에서 시도해보십시오
조회수:
6626
평가:
(31)
게시됨:
2018.01.22 09:42
\MQL5\Indicators\fxsaber\
Ping.mq5 (7.45 KB) 조회
\MQL5\Include\
TypeToBytes.mqh (19.12 KB) 조회
이 코드를 기반으로 한 로봇이나 지표가 필요하신가요? 프리랜스로 주문하세요 프리랜스로 이동

An important parameter in trading is the relevance of the current price. It depends on a lot of factors, one of the most popular being the network ping between the terminal and the trade server.

However, another parameter is often ignored: the so-called "internal terminal ping", which is an additional lag of quotes inside the terminal (the platform). Even if the network ping is zero, this lag can be significant.

Two variants of indicator visualization

The indicator shows the dynamics of change in this parameter, which is calculated as follows:

#include <TypeToBytes.mqh> // https://www.mql5.com/en/code/16280

// Getting a fresh tick with the value of the internal quote lag (in milliseconds)
bool SymbolInfoTick( const string &Symb, MqlTick &Tick, double &Ping )
{
  static const bool IsTester = (MQLInfoInteger(MQL_TESTER) || MQLInfoInteger(MQL_OPTIMIZATION));
  
  static MqlTick PrevTick = {0};
  static ulong PrevTime = 0;
  
  const ulong NowTime = IsTester ? 0 : GetMicrosecondCount();
  const bool Res = SymbolInfoTick(Symb, Tick);
  
  if ((!IsTester) && Res)
  {
    if (_R(Tick) != PrevTick)
    {
      Ping = PrevTime ? MathAbs(Tick.time_msc - PrevTick.time_msc - (NowTime - PrevTime) / 1e3) : 0;
      
      PrevTime = NowTime;
      PrevTick = Tick;
    }
    else
      Ping = 0;
  }

  return(Res);
}

The above screenshot shows that the calculated value is far from small (a clean terminal with one chart), and the pursuit of zero ping can be deceiving in trading and some types of analysis in MetaTrader 5.


Features

  • The time lag of quotes is calculated in milliseconds;
  • The indicator consumes minimum computing resources of the terminal;
  • When the indicator is reset (after changing the TF, symbol, etc.) the accumulated data are lost (no database is maintained);
  • After removing the indicator, its comment stays on the chart;
  • It is not possible to create a similar indicator for MetaTrader 4, since tick data with the ms precision are not available;
  • SymbolInfoTick in indicators requires some "warm-up" in the form of a few first Calculate events;
  • The indicator can be used as a template for real-time visualization of any values, you only need to replace one line;
  • A library is required for indicator calculation, which is used for comparing MqlTick structures when calculating the lag:

    #include <TypeToBytes.mqh> // https://www.mql5.com/en/code/16280
  • The indicator has two display types depending on the following line:

    #define HISTOGRAM_VIEW // Comment the line to change the indicator view from histogram to candlesticks

The current indicator shows the price lag (ping), connected with the Calculate event. Actually, there are a lot of factors that have a significant impact on ping, so the appropriateness of using any indicators in trading systems and analysis may seem doubtful. Of course, the NewTick event is less sensitive to negative influences, but its ping is also considerable (if measured in an Expert Advisor), which can sometimes minimize the importance of some speed characteristics of the platform.

MetaQuotes Ltd에서 러시아어로 번역함.
원본 코드: https://www.mql5.com/ru/code/19422

Candle_row Candle_row

The indicator sets indexes for candlesticks in the price movement direction.

RSI Eraser RSI Eraser

The Expert Advisor is based on the iRSI (Relative Strength Index, RSI) indicator signals.

Exp_Stopreversal_Tm Exp_Stopreversal_Tm

The Expert Advisor is based on the signals of the Stopreversal indicator and is provided with the possibility to set a strict trading time interval.

Daniella Daniella

A semaphore signal indicator using Average True Range.