거래 로봇을 무료로 다운로드 하는 법을 시청해보세요
당사를 Facebook에서 찾아주십시오!
당사 팬 페이지에 가입하십시오
스크립트가 흥미로우신가요?
그렇다면 링크 to it -
하셔서 다른 이들이 평가할 수 있도록 해보세요
스크립트가 마음에 드시나요? MetaTrader 5 터미널에서 시도해보십시오
지표

The "New bar" event handler for the indicators - MetaTrader 5용 지표

조회수:
10843
평가:
(22)
게시됨:
2011.01.20 15:22
업데이트됨:
2016.11.22 07:32
\MQL5\Include\
이 코드를 기반으로 한 로봇이나 지표가 필요하신가요? 프리랜스로 주문하세요 프리랜스로 이동

The idea of this approach is described in the "New Bar" Event Handler article. The example of its use in the Expert Advisors is presented in the article. Here you will find the solution for the indicators. Idea is the same: it will allow to perform recalculations only when the new bar has appeared. It's a convenient alternative to the direct use of the OnCalculate() function.

Here is the simple indicator, it prints a line when the new bar has appeared:

//+------------------------------------------------------------------+
//|                                            OnNewBarCalculate.mq5 |
//|                                            Copyright 2010, Lizar |
//|                                                    Lizar@mail.ru |
//+------------------------------------------------------------------+
#property copyright "Copyright 2010, Lizar"
#property link      "Lizar@mail.ru"
#property version   "1.00"
#property indicator_chart_window

#include <OnNewBarCalculate.mqh> // here is the secret of call of OnNewBarCalculate() function
//+------------------------------------------------------------------+
//| New bar event handler for the indicator                          |
//+------------------------------------------------------------------+
int OnNewBarCalculate(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[])
  {
//--- here you can write the code, similar to OnCalculate();
//--- but this function will be called only if a new bar has appeared (not at every tick)

   PrintFormat("New bar: %s",TimeToString(TimeCurrent(),TIME_SECONDS));
//--- return value of prev_calculated for next call
   return(rates_total);
  }

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

MQL5 Wizard - Trade Signals Based on Reversal Candlestick Patterns MQL5 Wizard - Trade Signals Based on Reversal Candlestick Patterns

Trade signals based on reversal candlestick patterns is considered. The code of the Expert Advisor based on this strategy can be generated automatically using the MQL5 Wizard.

sChartsSynchroScroll_v2 sChartsSynchroScroll_v2

New version of the sChartsSynchroScroll script.

Export Indicator's Values Export Indicator's Values

This script exports indicator's values to CSV file.

Synchronized Charts Synchronized Charts

This Expert Advisor performs the synchronization of charts.