MQL5 - Language of trade strategies built-in the MetaTrader 5 client terminal

Automated Trading Language Documentation

Composite High/Low Momentum Blau_HLM Indicator
Composite High/Low Momentum Blau_HLM
Author: abolk
Screenshot
GBPUSDx, M15
Real
How to Make a Trading Robot in No Time How to Make a Trading Robot in No Time AIIV GBPUSD Active Index Inflection Values GBPUSDAIIV GBPUSD Active Index Inflection Values GBPUSD Try product
AIIV GBPUSD Active Index Inflection Values GBPUSD
Author: Aktiniy
Subscribe to signal
SignalHedge
113.79%, 53 397.89 USD

At

Gets the element from the given position in the array.

long  At(
   int  pos      // Position
   ) const

Parameters

pos

[in]  Position of the desired element in the array.

Return Value

The value of the element in case of success, LONG_MAX if there was an attempt to get an element of not existing positions (the last error ERR_OUT_OF_RANGE).

Note

Of course, LONG_MAX may be a valid value of an array element, so having a value, always check the last error code.

Example:

//--- example for CArrayLong::At(int)
#include <Arrays\ArrayLong.mqh>
//---
void OnStart()
  {
   CArrayLong *array=new CArrayLong;
   //---
   if(array==NULL)
     {
      printf("Object create error");
      return;
     }
   //--- add arrays elements
   //--- . . .
   for(int i=0;i<array.Total();i++)
     {
      long result=array.At(i);
      if(result==LONG_MAX && GetLastError()==ERR_OUT_OF_RANGE)
        {
         //--- Error reading from the array
         printf("Get element error");
         delete array;
         return;
        }
      //--- use element
      //--- . . .
     }
   //--- delete array
   delete array;
  }


Updated: 2010.02.22