Learning and writing together in MQL5 - page 45

 
Dimka-novitsek:
The computer is very slow...

no, it's not a comp :)

Output yu (GBPUSD,H1) array out of range in 'Output yu.mq5' (4873,19)- words not clear...

You've accessed an array element, while the array size is smaller than the index number of the element you've accessed.

It's like when you have the array arr[10] and want to get an item arr[11]. But there are only 10 elements.

This is what you're told about.

and you even gave the line number where the error is 4873 out of your 5000 lines :)

 
Thank you!!!
 
I tried to provide all the arrays, there are 11 of them, with an appropriate condition. But please tell me, how does the same error here occur? И
double      ATR[];                // массив для индикатора iATR
//---- handles for indicators
int         ATR_handle;           // указатель на индикатор iATR


..................................................
..................................................

///////////////////////////////////////////////////////////////////////////////////////////////  
double iStdDevf(        string symbol, int timeframe, int ma_period, int ma_shift, ENUM_MA_METHOD ma_method,  ENUM_APPLIED_PRICE applied_price, int shift){
     SymbolSelect(
  symbol,       // имя символа
  true      // включить или выключить
   );
 StdDev_handle= iStdDev(
               symbol,            // имя символа
       periodd(timeframe),            // период
                   ma_period,         // период усреднения
                 ma_shift,          // смещение индикатора по горизонтали
         ma_method,         // тип сглаживания
    applied_price      // тип цены или handle
   );   
  
   if(StdDev_handle==INVALID_HANDLE)     
     {
     return (0.0);}                     //Если массив не был создан, то 0          
      
    CopyBuffer(StdDev_handle,0,0,100,ATR);
    if(shift>99)return(0);
    ArraySetAsSeries(ATR,true);         // Установим порядок расположения массива от 0 к 100
    return( StdDev[shift]); }           //Вывод ризультата
///////////////////////////////////////////////////////////////////////////////////////////////  

The function asks for a parameter-known to be an integer, one hundred percent non-negative, and checks inside the function that it does not exceed 99. [shift-it is the same number-it refers to an element of the array StdDev number shift. So, it's not about the number? Would it be correct to declare it asdouble ATR[100]; ? п.p. The error is the line number and the character is exactly shift

2012.09.29 20:56:26 Output yu (GBPUSD,H1) array out of range in 'Output yu.mq5' (4886,19)

There is no way it can access the wrong array element, right?

 
Dimka-novitsek:
I tried to provide all the arrays, there are 11 of them, with an appropriate condition. But please tell me, how does the same error here occur? И

The function asks for a parameter-known to be an integer, one hundred percent non-negative, and checks inside the function that it does not exceed 99. [shift-it is the same number-it refers to an element of the array StdDev number shift. So, it's not about the number? Would it be correct to declare it asdouble ATR[100]; ? п.p. The error is the line number and the character is exactly shift

2012.09.29 20:56:26 Output yu (GBPUSD,H1) array out of range in 'Output yu.mq5' (4886,19)

There is no way it can access the wrong array element, right?


StdDev
What is it? Where is it declared? What is its size?
 
Thank you all, really! Yesterday was a nightmare, now I'm sorting it out again and it's clearer. That's all for now.
 
You know, everything seemed to work properly, and it drew everything, even things I hadn't seen before! And in connection with this question - please tell me, does the program terminate its work prematurely with the arrival of a new tick?
 
Dimka-novitsek: and with the arrival of a new tick, does the programme terminate prematurely?
See Reference Manual, search word: NewTick
 

Форум по трейдингу, автоматическим торговым системам и тестированию торговых стратегий

Изучаем и пишем вместе на MQL5

Yedelkin , 2011.04.30 08:47

Вопрос

ENUM_DEAL_ENTRY

 

Идентификатор

Описание

DEAL_ENTRY_IN

Вход в рынок

DEAL_ENTRY_OUT

Выход из рынка

DEAL_ENTRY_INOUT

Разворот

DEAL_ENTRY_STATE

Признак статусной записи

Что такое " статусная запись", и когда может потребоваться (необходимо использовать) признак этой записи?
Urain:
Status entry is entry of funds into the account, for example in any account the first line is balance, this is the status entry.

That doesn't seem to be true.


void OnStart()
  {
//---
   if(HistorySelect(0,TimeCurrent()))
     {
      int total=HistoryDealsTotal();
      for(int i=0;i<total;i++)
        {
         ulong ticket=HistoryDealGetTicket(i);
         ENUM_DEAL_ENTRY deal_entry=(ENUM_DEAL_ENTRY) HistoryDealGetInteger(ticket,DEAL_ENTRY);
         printf("Deal ticket#%u entry=%s",ticket,EnumToString(deal_entry));
        }
     }
  }

Returns:

2014.08.27 19:15:42.163 Deal_Entry_State (AUDUSD,D1) Deal ticket#3879156 entry=DEAL_ENTRY_IN

Who knows what is the DEAL_ENTRY_STATE ?

 
angevoyageur:

This does not seem to be true.

Logically, if balace has direction DEAL_ENTRY_IN, then why isn't in in the "Direction"/Direction column?!

as for example for buy, which in this case also has direction DEAL_ENTRY_IN

 
A100:

Logically, if balace has direction DEAL_ENTRY_IN, then why isn't in in the "Direction"/Direction column?!

as it is specified for example for buy, which in this case also has DEAL_ENTRY_IN direction

   if(HistorySelect(0,TimeCurrent()))
     {
      int total=HistoryDealsTotal();
      for(int i=0;i<total;i++)
        {
         ulong ticket=HistoryDealGetTicket(i);
         ENUM_DEAL_ENTRY deal_entry=(ENUM_DEAL_ENTRY) HistoryDealGetInteger(ticket,DEAL_ENTRY);
         ENUM_DEAL_TYPE  deal_type=(ENUM_DEAL_TYPE) HistoryDealGetInteger(ticket,DEAL_TYPE);
         printf("Deal ticket#%u type=%s entry=%s",ticket,EnumToString(deal_type),EnumToString(deal_entry));
        }
     }


2014.08.28 13:25:44.007 Deal_Entry_State (AUDUSD,H8) Deal ticket#3892717 type=DEAL_TYPE_BUY entry=DEAL_ENTRY_OUT

2014.08.28 13:25:44.007 Deal_Entry_State (AUDUSD,H8) Deal ticket#3892714 type=DEAL_TYPE_SELL entry=DEAL_ENTRY_IN

2014.08.28 13:25:44.007 Deal_Entry_State (AUDUSD,H8) Deal ticket#3879156 type=DEAL_TYPE_BALANCE entry=DEAL_ENTRY_IN

Question remains, what is DEAL_ENTRY_STATE ? Question remains, what isDEAL_ENTRY_STATE?