FORTS Please help - page 7

 
Keep hiding the code?
 
barabashkakvn:
Keep hiding the code?

Do you even read the posts?

Mikalas2015.03.26 18:56RU

You shouted and called me a Chukchi, but the problem is not solved!

//+------------------------------------------------------------------+
//|                                                         Test.mq5 |
//|                        Copyright 2014, MetaQuotes Software Corp. |
//|                                              http://www.mql5.com |
//+------------------------------------------------------------------+
#property copyright "Copyright 2014, MetaQuotes Software Corp."
#property link      "http://www.mql5.com"
#property version   "1.00"
#property indicator_separate_window
#property indicator_buffers 1
#property indicator_plots   1
//
bool is_failed = false;
datetime start_time;
datetime end_time;
int mix_bars, rts_bars, si_bars;
//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int OnInit()
  {
    start_time = StringToTime( "2015.03.17" );
    end_time = TimeCurrent();
//--- indicator buffers mapping
  mix_bars = GetBars( "MIX-6.15" , PERIOD_CURRENT, start_time, end_time ); 
  if ( mix_bars < 1 )
  {
    is_failed = true;
    Print( "Init failed. MIX-6.15 ");
  }
  rts_bars = GetBars( "RTS-6.15" , PERIOD_CURRENT, start_time, end_time ); 
  if ( rts_bars < 1 )
  {
    is_failed = true;
    Print( "Init failed. RTS-6.15 ");
  }
  si_bars = GetBars( "Si-6.15" , PERIOD_CURRENT, start_time, end_time ); 
  if ( si_bars < 1 )
  {
    is_failed = true;
    Print( "Init failed. Si-6.15 ");
  }
//---
   return(INIT_SUCCEEDED);
  }
//+------------------------------------------------------------------+
//| Custom indicator Get bars function                               |
//+------------------------------------------------------------------+
int GetBars( string symbol, ENUM_TIMEFRAMES period, const datetime start_date, const datetime end_date )
{
  if ( !SymbolInfoInteger( symbol, SYMBOL_SELECT ) )
  {
    ResetLastError();
//---    
    if ( GetLastError() != ERR_MARKET_UNKNOWN_SYMBOL )
    {
      SymbolSelect( symbol, true );
    }
    else
    {
      Print( "GetBars: Неизвестный символ - ", symbol );
      return( 0 );
    }    
  }
//---  
  if ( MQL5InfoInteger( MQL5_PROGRAM_TYPE ) == PROGRAM_INDICATOR && Period() == period && Symbol() == symbol )
  {
    Print( "GetBars: Не пройдена проверка типа программы!" );
    return( 0 );
  }  
//---
  if ( SymbolIsSynchronized( symbol ) )
  {
    return( Bars( symbol, period, start_date, end_date ) );
  }
  else
  {
    long first_date = 0;
    datetime times[1];
//---    
    if ( SeriesInfoInteger( symbol, PERIOD_M1, SERIES_TERMINAL_FIRSTDATE, first_date ) )
    {
      if ( first_date > 0 )
      {
//--- force timeseries build
        CopyTime( symbol, period, datetime( first_date ) + PeriodSeconds( period ), 1, times );
//--- check date
        if ( SeriesInfoInteger( symbol, period, SERIES_FIRSTDATE, first_date ) )
//---        
        if ( first_date > 0 && first_date <= long( start_date ) )
        {
          return( Bars( symbol, period, start_date, end_date ) );
        } 
      }
    }
    Print( "Необходима загрузка истории с сервера!");
  }       
//---  
  return( 0 );
}  
//+------------------------------------------------------------------+
//| 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[])
  {
//---
   if ( is_failed )
   {
     Print( "Sorry! Get Bars failed." );
   }
   else Print( "Bingo! We done.");
//--- return value of prev_calculated for next call
   return(rates_total);
  }

I haven't written the history download yet, but the data is in the terminal, and it's NOT coming out of it the first time!

2015.03.26 20:49:01.641 Test (MIX-6.15,M1)      Необходима загрузка истории с сервера!
2015.03.26 20:49:01.641 Test (MIX-6.15,M1)      Init failed. RTS-6.15 
2015.03.26 20:49:01.641 Test (MIX-6.15,M1)      Необходима загрузка истории с сервера!
2015.03.26 20:49:01.641 Test (MIX-6.15,M1)      Init failed. Si-6.15 
2015.03.26 20:49:01.641 Test (MIX-6.15,M1)      Sorry! Get Bars failed. 

into pocket|edit|delete

 

Can someone please explain:

Why the function with SERIES_TERMINAL_FIRSTDATE identifier, when there is data

in the terminal returns FALSE?

SeriesInfoInteger( symbol, PERIOD_M1, SERIES_TERMINAL_FIRSTDATE, first_date )
 
Mikalas:

Can someone please explain:

Why the function with SERIES_TERMINAL_FIRSTDATE identifier, when there is data

in the terminal returns FALSE?

5 sec. I'll throw in some links...
 
MigVRN:
5 sec. I'll throw in some links...

From Data Access Organisation Help --> Example script for downloading history:

Если мы успешно прошли все проверки, то сделаем последнюю попытку обойтись без обращения к торговому серверу. Сначала узнаем начальную дату, для которой доступны минутные данные в формате HCC.
Запросим это значение функцией SeriesInfoInteger() с модификатором SERIES_TERMINAL_FIRSTDATE и опять сравним со значением параметра start_date.

   if(SeriesInfoInteger(symbol,PERIOD_M1,SERIES_TERMINAL_FIRSTDATE,first_date))
     {
      //--- there is loaded data to build timeseries
      if(first_date>0)
        {
         //--- force timeseries build
         CopyTime(symbol,period,first_date+PeriodSeconds(period),1,times);
         //--- check date
         if(SeriesInfoInteger(symbol,period,SERIES_FIRSTDATE,first_date))
            if(first_date>0 && first_date<=start_date) return(2);
        }
     }
 
 
MigVRN:

Everything happens exactly as it says in the documentation. :)

Sketched an indicator and an Expert Advisor for checking + the result on the video.

1) First I cast it to the chart of the Expert Advisor that has the OnTick function inside it that works for 20 seconds.

The result is that the chart continues working and displays everything as it should be. The chart also works as expected.

2) Then we apply to the chart the indicator that has theOnCalculate function for 20 seconds.

The result - the chat hangs. At the same time the next chat with the same symbol that has a different period is also suspended. Glass continues to work as it should. After the function has worked everything goes back to normal.

3) The video does not show it - but if you cast an indicator on one chat (set 60 sec), and an EA on the other - the EA does not start working until the indicator malfunctions on another chat!

Attached the video separately - it's slowing down in my browser.

No shit, where is the multithreading gone ?!

Until the indicator works, the ticks don't reach the EA!

 
Serj_Che:

Where the hell did the multithreading go?!

Until the indicator works, the ticks don't reach the EA!

The ticks don't get to the ticker, they just don't show up on the chart.
 
Serj_Che:

Where the hell did the multithreading go?!

Until the indicator works, the ticks don't reach the EA!

It's always been like this.

Mikalas:
Bids are getting to the cup, it just doesn't show up on the chart.

The EA's ticks don't work. And everything else on the chat. I have not checked timer and custom events.

Mikalas:

Help Data access organization --> Example of script for loading history:

Also from help.

...The service files in HCC format act as a source of data to build the price data for requested timeframes in HC format. The data in the HC format are timeseries, which are maximally prepared for quick access. They are created only at requests of a chart or mql5-program in the volume not exceeding the "Max bars in charts" parameter, and are saved for further use in files with the hc extension.

To save resources, the data on the timeframe are loaded and stored in the RAM only when required. In case of long absence of requests the data are unloaded from the RAM saving them into a file. Data for each timeframe are prepared independently from the ready data for other timeframes. The rules for data preparation and availability are the same for all timeframes. I.e., despite the fact that the unit of data storage in the HCC format is a minute bar, the availability of data in the HCC format does not mean the availability and accessibility of the HC format data for the M1 timeframe in the same volume.

 
Mikalas:

Can someone please explain:

Why the function with SERIES_TERMINAL_FIRSTDATE identifier, when there is data

in the terminal returns FALSE?

Because it is the FIRST time it accesses this particular series.
 
Mikalas:

From Data Access Organisation Help --> Example script for downloading history:

Here we go. You are on the right track. To check how exactly the terminal works, rather than how you imagine it, a simple algorithm for checking.

  • Open one "MIX-6.15 M1" chart in the terminal. On the chart is the indicator from the first post.
  • Open "Open Data Catalog" from the terminal.
  • Looking for history on the symbol "MIX-6.15" in this way ...\Terminal\D0*******CF37AD**55**0E51F**75\bases\Open-Demo\history
  • Unload terminal.
  • Delete folder "MIX-6.15".
  • Boot up terminal. We see error. A little joke on the chart - change the timeframe several times. For example, change M1 and M5 several times. The error disappears. It means that data of another timeframe (different from the one that is requested in the code) has been prepared. If you do not want to change timeframes manually - you must prepare data yourself.
  • Reload the terminal - no error.
  • If it is not clear, then repeat the experiment.
Reason: