Skip to content

Instantly share code, notes, and snippets.

@currencysecrets
Last active February 28, 2021 20:52
Show Gist options
  • Save currencysecrets/a3028b16626d8540821a to your computer and use it in GitHub Desktop.
Save currencysecrets/a3028b16626d8540821a to your computer and use it in GitHub Desktop.
Handy Array Utility functions for MetaTrader 4
void flushArray( int& arr[] ) {
ArrayInitialize( arr, 0 );
ArrayResize( arr, 0 );
}
// append new element to end of int array
void intArrayPush( int& arr[], int elem ) {
int size = ArraySize( arr );
ArrayResize( arr, size + 1 );
arr[ size ] = elem;
}
// remove last element of int array
void intArrayPop( int& arr[] ) {
int size = ArraySize( arr );
ArrayResize( arr, size - 1 );
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment