forex trading accountssThe maximum numforextradingaccountsregisterr of dimensions of an array forextradingaccountstype four dimensions each dimension is indexed to be coded from 0to dimension-1 In fact, the first dimensional array of 50s i……" />
  • EA programming tutorials are a complete list of array functions

    read:2023/2/24 18:46:13


    Wai_Hui_BangWaiHuiBang.com A set of functions that use cashback forexgforagoodliving.com">forex trading accountss The maximum numforextradingaccountsregisterr of dimensions of an array forextradingaccountstype four dimensions each dimension is indexed to be coded from 0 to dimension-1 In fact, the first dimensional array of 50 s is called when the first array is displayed as [0], the last array is displayed for [49] using these functions (except those that change quantitative and qualitative arrays) to be able to predefine the time series Time[], Open[], High[], Low[], Close[], Volume[] ArrayBsearch& nbsp; ArrayCopy  ArrayCopyRates  ArrayCopySeries  ArrayDimension  ArrayGetAsSeries& nbsp; ArrayInitialize  ArrayIsSeries  ArrayMaximum  ArrayMinimum  ArrayRange & nbsp;ArrayResize  ArraySetAsSeries  ArraySize  ArraySort  int ArrayBsearch(  double array[], double value, void count, void start, void direction) If no event is found, the value is returned to the first dimensional array or the nearest one This function cannot be used on character-based or continuous numeric arrays (except for continuous arrays with open columns) Note: Binary lookup is only able to store number storage numeric arrays using ArraySort() Function Parameter:array[]  -  Need the array to be searched.   value  -  the value to be searched  count  -  the number of searches, the default is to search all arrays.   start  -  The start point of the search, the default is to start at the beginning.   direction -  direction of search: MODE_ASCEND order search, MODE_DESCEND reverse order search.    Example:  datetime daytimes[];    int     shift=10, dayshift;   // All Time[] arrays are arranged in the back form   ArrayCopySeries(daytimes,MODE_TIME,Symbol(), PERIOD_D1);   if(Time[shift]>=daytimes[0]) dayshift=0;   else       {       dayshift=ArrayBsearch(daytimes,Time[shift],WHOLE_ARRAY,0,MODE_DESCEND);      ;    if(Period()<PERIOD_D1) dayshift++;       }    Print( TimeToStr(Time[shift]), corresponds to ,dayshift, day bar opened at ,           nbsp;     TimeToStr(daytimes[dayshift]));    ArrayCopy  int ArrayCopy(  void dest[], object source[], void start_dest, void start_source, void count) copies an array to another array only double[], int[], datetime[], color[], and bool[] these types of arrays can be copied return the total number of copied elements parametric:dest[]    nbsp;-  target_array   source[]  -   source_array    start_dest  -   Start_dest  -  from the first few bits of the target array to write to, default is 0   start_source  -  read from the first few bits of the source array, default is 0   count  -  ; read how many bits of the array the default value is WHOLE_ARRAY constant   example:  double array1[][6];   double  array2[10][6];    // array2 is filled with the same data   ArrayCopyRates(array1);   ArrayCopy( array2,array1,0,0,60);   // Now the first 10 columns of array2 are from history (the first 10 columns include index [Bars-1])   ArrayCopy(array2,array1, 0,Bars*6-60,60);    // now the last 10 columns of array2 are from history (the last 10 columns include index[0])    ArrayCopyRatesint  ArrayCopyRates( void dest_array[], void symbol, void timeframe) copies a section of the trend on the data to a two-dimensional array and returns the total number of columns copied, if it is -1 means failure The second dimension of the array has only six items are:0 - time,  1 - opening price,  2 - minimum price,  3 - maximum price,  nbsp; 4 - closing price,  5 - volume.    If the data (currency pair name/different from the current time period) rejects other charts, the corresponding chart in this case can not be opened within the client, the data will naturally reject the server this situation, error ERR_HISTORY_WILL_UPDATED  nbsp;(4066 - Refused to refresh historical data) will be placed into the last_error variable and will be rejected again (see the example ArrayCopySeries()).   Note: This array is typically used to pass data through to DLL functions For data arrays memory is not really allocated and no copy is really performed When the array is accessed, it will change direction Parameter:dest_array[]  -  Double target array on a two-dimensional array   symbol  -  currency pair name  timeframe  -  time period.  Can be any value that lists the time period   Example:  double array1[][6];   ArrayCopyRates(array1,EURUSD,  PERIOD_H1);   Print(current column ,TimeToStr(array1[0][0]),opening price, array1[0][1]); ArrayCopySeries int  ArrayCopySeries( void array[], int series_index, void symbol, void timeframe) copies a series of trend data to array.  For data arrays memory is not really allocated, no real copy is performed when the array is accessed, will change direction within the client indicator prohibit the array as array subscript allocation this case, the array is really copied If data is copied from different currency pairs/time period charts, data may be lacking this case, error  nbsp;ERR_HISTORY_WILL_UPDATED (4066 - Refused to refresh historical data) will be placed in the last_error variable and replication will be reattempted within a determined time period Note: If series_index is MODE_TIME, then the first parameter must be a date-type array parameter:array[]  -  target first-dimensional numeric array  series_index  -& nbsp; the continuous array identifier must be a continuous array list identifier which values  symbol  -   the current currency pair name  timeframe  -   chart time period can be list any value of the time period   example:datetime daytimes[]; int      shift=10, dayshift,error; //---- thisTime[] array is arranged behind the command ArrayCopySeries(daytimes,MODE_TIME,Symbol(),PERIOD_D1); error= GetLastError(); if(error==4066)   {   //---- make more than two accept read-only   for(int i=0;i <2; i++)     {     Sleep(5000);          ;  ArrayCopySeries(daytimes,MODE_TIME,Symbol(),PERIOD_D1);        //---- Check but the previous daily column time       datetime last_day=daytimes[0];          if(Year() ==TimeYear(last_day) && Month()==TimeMonth(last_day) && Day()==TimeDay(last_day)) break;& nbsp;    }  if(Time[shift]>=daytimes[0]) dayshift=0; else     ;{    dayshift=ArrayBsearch(daytimes,Time[shift],WHOLE_ARRAY,0,MODE_DESCEND);   if(Period()<PERIOD _D1) dayshift++;   } Print(TimeToStr(Time[shift]), accordingly ,dayshift, day bar opened& nbsp;at , TimeToStr(daytimes[dayshift]));    ArrayDimension int ArrayDimension( object  ;array[]) returns the multi-dimensional parameter of the array:array[]  -  The array to be returned Example:int num_array[10][5]; int dim_size; dim_ size=ArrayDimension(num_array); // dim_size=2     ArrayGetAsSeries bool ArrayGetAsSeries(& nbsp;object array[]) returns TRUE if the array has an array of organized sequences (whether sorted from the end to the beginning), otherwise it returns FALSE Parameter:array[]  -   Need to check the array    Example:  if(ArrayGetAsSeries(array1)==true)      Print(array1 is indexed as a continuous index);    else      Print(array1 indexed normally (left to right));     ArrayInitialize int ArrayInitialize(  void array[], double value) to initialize the array, return the number of initialized array items Note: The init() function in the client indicator is not recommended to use to initialize the buffer, in this function automatically initialize the null value will automatically allocate and buffer reallocation parameters: array[]  nbsp; -  Need to initialize the array  value  -   The value of the new array item    Example:   //---- initialization All arrays with 2.1   double myarray[10];   ArrayInitialize(myarray,2.1);      ArrayIsSeries bool ArrayIsSeries( object array[]) if the check array is continuous (Time[],Open[],Close[],High[],Low[], or  Volume[]), return TRUE, otherwise return FALSE Parameter:array[]  -  Array to be checked Example:  if(ArrayIsSeries(array1)== false)     ArrayInitialize(array1,0);   else     {   & nbsp;    Print(consecutive arrays cannot be initialized!) ;       return(-1);       }        ArrayMaximum& nbsp;int ArrayMaximum( double array[], void count, void start) find out the positioning of the maximum value in the array function in the array to return the maximum position parameter: array[]  -  search the array of numbers  count  -  search the number of items in the array  start  - & nbsp;the start index of the search   example:double num_array[15]={4,1,6,3,9,4,1,6,3,9,4,1,6,3,9,4,1,6,3,9}; int      maxValueIdx=ArrayMaximum(num_array); Print(maximum = , num_array[maxValueIdx]); ArrayMinimum int  ArrayMinimum( double array[], void count, void start)find out the positioning of the minimum value in the array function in the array returns the minimum value position parameter:array[] & nbsp;-  search array of numbers  count  -  the number of items in the search array  start  -  the start index of the search  ;  Example: double num_array[15]={4,1,6,3,9,4,1,6,3,9,4,1,6,3,9}; int     minValueidx= ArrayMinimum(num_array); Print(minimum = , num_array[minValueIdx]);    ArrayRangeint  ArrayRange( object array[], int range_index) takes the number of items in the specified dimension in the array index based on zero, the size of the dimension should be greater than the maximum index of 1 point parameter:array[]  -   the array to be checked  range_index  -  the specified number of dimensions    example:int     dim_ size; double num_array[10,10,10]; dim_size=ArrayRange(num_array, 1);     ArrayResize  int ArrayResize( void array[], int new_size) set the size of the first dimension if successfully executed, after resetting to return the full number contained if the array is not reset, return -1 Note: After the function completes execution If the array is leveled within the function and the reset will remain unchanged after the function is called again, some arrays will differ from the indicated array parameters:array[]  -  The array that needs to be reset  new_size  -  ; The new size of the array in the first dimension    Example:double array1[][4]; int    element_count=ArrayResize( array1, 20); // new size - 80     ArraySetAsSeries bool ArraySetAsSeries(  void array[], bool set) set the index array as series array if the set parameter value is TRUE, the array will be indexed array 0 bit value is the last value of its FALSE value set a standard index command this function returns the previous state parameter: array[]   -  need to set the array  set  -  index array command   example:double macd_buffer[300]; double  nbsp;signal_buffer[300]; int     i,limit=ArraySize(macd_buffer); ArraySetAsSeries(macd_buffer,true);& nbsp; for(i=0; i<limit; i++)   macd_buffer=iMA(NULL,0,12,0,MODE_EMA,PRICE_CLOSE,i)-iMA(NULL,0,26, 0,MODE_EMA,PRICE_CLOSE,i);    for(i=0; i<limit; i++)   signal_buffer=iMAOnArray( macd_buffer,limit,9,0,MODE_SMA,i);     ArraySize int ArraySize( object array[]) returns the number of items in the array  nbsp;For the first dimensional array, use the ArraySize function to return the ArrayRange(array,0) parameter:array[]  -  any type of array example:int count=ArraySize( array1); for(int i=0; i<count; i++)   {   // some calculation.    }    ArraySort int ArraySort( void array[], void count,  void start, void sort_dir) to sort the array, the series array can not ArraySort () use for sorting parameters:array[]  -  array being sorted  count   -  how many array items to sort  start  -   the start of the sort  sort_dir  -   sort_dir,  MODE_ASCEND order,  MODE_DESCEND reverse order   example:  double num_array[5]={4,1,6,3,9} ;   // the new array contains the values 4,1,6,3,9   ArraySort(num_array);   // be arranged new array 1,3,4,6,9    nbsp; ArraySort(num_array,WHOLE_ARRAY,0,MODE_DESCEND);   // Be arranged new array 9,6,4,3,1__WaiHuiBang.com