Download MetaTrader 5

Errors that occur when working with symbols which have insufficient quote history

To add comments, please log in or register
Winsor Hoang
5060
Winsor Hoang  

Per this article on MQL4 https://www.mql5.com/en/articles/2555

Errors that occur when working with symbols which have insufficient quote history

If an expert or indicator is launched on a chart with insufficient history, then there are two possibilities:

  1. the program checks for availability of the required history in all the required depth. If there are less bars than required, the program requests the missing data and completes its operation before the next tick arrives. This path is the most correct and it helps to avoid a lot of mistakes, such as array out of range or zero divide;
How do I implement the solution above? Any help is greatly appreciated. 

The checks a trading robot must pass before publication in the Market
The checks a trading robot must pass before publication in the Market
  • 2016.08.01
  • MetaQuotes Software Corp.
  • www.mql5.com
Before any product is published in the Market, it must undergo compulsory preliminary checks in order to ensure a uniform quality standard. This article considers the most frequent errors made by developers in their technical indicators and trading robots. An also shows how to self-test a product before sending it to the Market.
Carl Schreiber
7289
Carl Schreiber  

Within an EA you can use while( !IsStopped() && not_here(..) ) sleep(500).

As sleep does not work within an EA you just can do directly within OnCalculate(){ ..  if( not_here(..) ) return(0)‌;..

This way you 'wait' until you have all your datas and you start with the first tick hereafter.

Alain Verleyen
Moderator
33290
Alain Verleyen  

Forum on trading, automated trading systems and testing trading strategies

PositionsTotal()

Alain Verleyen, 2017.03.07 08:16

Why people who are selling products on the Market want to get free help on the forum ?


Winsor Hoang
5060
Winsor Hoang  
Carl Schreiber:

Within an EA you can use while( not_here(..) ) sleep(500).

As sleep does not work within an indicator you just can do directly within OnCalculate(){ ..  if( not_here(..) ) return(0)‌;..

This way you 'wait' until you have all your datas and you start with the first tick hereafter.


Thanks Carl,

‌‌Greatly appreciated. 

To add comments, please log in or register