Any rookie question, so as not to clutter up the forum. Professionals, don't pass by. Nowhere without you - 6. - page 857

 
ikatsko:

Hello! Where can I get (where is) the tick history of quotes? And, most importantly, how to refer to each tick in mql?

Maybe it will help. The method allows to get the history of quotes, by ticks

http://tradelikeapro.ru/kak-poluchit-kachestvo-modelirovaniya-99/

 
Top2n:

It might help. The method allows you to get the history of quotes, by tick

http://tradelikeapro.ru/kak-poluchit-kachestvo-modelirovaniya-99/

Good link. Thank you! But there is a second question: how to use MQL to refer to each selected tick?
 
ikatsko:
Nice link. Thank you! But there is a second question: how to use MQL to address each selected tick?

By means of MQL. Try it, compile it as an EA and put it on a chart, and look for the "Record" file in the files

//+------------------------------------------------------------------+
//|                                                ЗаписьBid_Ask.mq4 |
//|                        Copyright 2014, MetaQuotes Software Corp. |
//|                                              https://www.mql5.com |
//+------------------------------------------------------------------+
#property copyright "Copyright 2014, MetaQuotes Software Corp."
#property link      "https://www.mql5.com"
#property version   "1.00"
#property strict
//+------------------------------------------------------------------+
//| Expert initialization function                                   |
//+------------------------------------------------------------------+
int OnInit()
  {
//---
   
//---
   return(INIT_SUCCEEDED);
  }
//+------------------------------------------------------------------+
//| Expert deinitialization function                                 |
//+------------------------------------------------------------------+
void OnDeinit(const int reason)
  {
//---
   
  }
//+------------------------------------------------------------------+
//| Expert tick function                                             |
//+------------------------------------------------------------------+
void OnTick()
  {
Запись();
   
  }
//+------------------------------------------------------------------+
void Запись()
{
  int handle;
  string st=TimeToStr(TimeCurrent(), TIME_DATE);
  string filename = st+" Запись.csv"; // Формируем имя файла
  handle = FileOpen(filename,FILE_CSV|FILE_READ | FILE_WRITE,';');
  if(handle < 1)
  {
    Print("Не удалось создать файл. Ошибка #", GetLastError());
    return;
    //FileClose(handle);
  }
  
  FileWrite(handle,                   
            " Время ",
            " Bid ",
            " Ask ",
            " Volume "
            ); // заголовок
  FileSeek(handle, 0, SEEK_END);
  FileWrite(handle,
            TimeToStr(TimeCurrent(),TIME_MINUTES|TIME_SECONDS),
            Bid,
            Ask,
            Volume[0]
            );
 
  FileClose(handle);
  return;
}

Good luck.

 
r772ra:

By means of MQL. Try it, compile it as an EA and put it on a chart, and look for the "Record" file in the files

Good luck.

Thank you and good luck! I understand that this procedure will write the current ticks to the file. Yes?
 
ikatsko:
Thanks to you too! I understand that this procedure will write the current ticks to the file. Yes?

Yes. Bid b Ask, and alsoVolume. WhenVolume == 1, there is an arrival time of 1 tick of a new bar.









 
r772ra:

Yes. Bid b Ask, and alsoVolume. WhenVolume == 1, there is an arrival time of 1 tick of a new bar.










I would like to have an array analogous to the array of bars, so I could address, for example, consecutively to each tick, obviously, we are talking about history. I feel that I will have to form such an array manually (by myself) from existing values of quotes in the history. And after that one will be able to address elements of that array

 

Hello! I am taking apart the SMA indicator. I can't figure it out:

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[])
  {
//--- check for bars count
   if(rates_total<InpMAPeriod-1 || InpMAPeriod<2)
      return(0);
//--- counting from 0 to rates_total
   ArraySetAsSeries(ExtLineBuffer,false); //  если не объявлять то по умолчанию разве не стоит тоже самое?
   ArraySetAsSeries(close,false);
//--- first calculation or number of bars was changed

//+------------------------------------------------------------------+
//|   simple moving average                                          |
//+------------------------------------------------------------------+
void CalculateSimpleMA(int rates_total,int prev_calculated,const double &price[])
  {
   int i,limit;
//--- first calculation or number of bars was changed
   if(prev_calculated==0)
   
     {
      limit=InpMAPeriod;
      //--- calculate first visible value
      double firstValue=0;
      for(i=0; i<limit; i++)
         firstValue+=price[i];
      firstValue/=InpMAPeriod;
      ExtLineBuffer[limit-1]=firstValue;          Не чего не пойму, записываем в массив где limit =периоду(например 15-1),
     }
   else
      limit=prev_calculated-1;                       После первого запуска пусть будет равен Limit = 256 - 1;
//--- main loop
   for(i=limit; i<rates_total && !IsStopped(); i++)
      ExtLineBuffer[i]=ExtLineBuffer[i-1]+(price[i]-price[i-InpMAPeriod])/InpMAPeriod;  Тогда ExtLineBuffer[i-1]=0 т.к. ExtLineBuffer[256-1]=0 так получается, объясните пожалуйста эту строчку.
                                                                                                       Заранее благодарю
//---
  }
Если надо вставить (High[i+j]+Low[i+j])*0.5; то есть применить Median Price (HL/2)  Куда лучше подставить?
 

When optimizing in the tester, the following message often pops up in the log

"2015.03.05 11:04:55.924 Memory handler: cannot allocate 343699140 bytes of memory"

Please advise which memory can not be detected by the terminal? How can it be fixed?

 

Hello! Please look at the code below, creation of "Arrow" object on the signal, arrows are not drawn in the tester, although the log passes, and also in the log on startup in the tester writes an error TestGenerator: unmatched data error (volume limit 412 at 2014.10.13 17:10 exceeded),

And during testing it gives out an error "Checking USDJPYm,M5 arrow: Error in object creation: code #4200" - but I guess this is normal, because at first the program finds that the object was created, and after deleting it, creates it again. In general, I would be grateful for your comments to the questions.

Do not judge strictly as written.

//+------------------------------------------------------------------+
//| SignalOpenOrderBuy SendMail                                      |
//+------------------------------------------------------------------+
if (PLO0>S0 && PLO1<=S1 && PLO2<S2 && Time[0] > SignalTime)
{
SignalTime = TimeCurrent();
bool SignalBuy = ObjectCreate(0,"ArrowBay",OBJ_ARROW_BUY,0,0,Bid,SignalTime);
Print("Стрелка Buy установлена");
ObjectSetInteger(0,"ArrowBay",OBJPROP_COLOR,clrGreen);
if(!SignalBuy)
Print("Ошибка создания объекта: code #",GetLastError());
ResetLastError();
ObjectDelete(0,"ArrowBay");
RefreshRates();
SignalBuy = ObjectCreate(0,"ArrowBay",OBJ_ARROW_BUY,0,0,Bid,SignalTime);
ObjectSetInteger(0,"ArrowBay",OBJPROP_COLOR,clrGreen);
if(!SignalBuy)
Print("Ошибка создания объекта: code #",GetLastError());
else
Print("Стрелка Buy установлена");
}


 

Good afternoon.

The indicator in the window shows up to 5 decimal places.

When using it in an Expert Advisor through iCustom(Symbol(), PERIOD_M1, "MACD",12, 26, SignalSMA, 0, 0) it shows up to 4 decimal places (set by the Print command).

How do I get 5 digits in the board?