How to adjust array element position?

 

Hello everyone, I have an array like this:

TempArray[3]={1,4,3};

How can I adjust the position to {3,4,1}? 

thank you.

 
Wai Shing Ng:

Hello everyone, I have an array like this:

TempArray[3]={1,4,3};

How can I adjust the position to {3,4,1}? 

thank you.

use the extra variable: tmp

tmp=TempArray[0];
TempArray[0]=TempArray[2];
TempArray[2]=tmp;
 
Documentation on MQL5: Array Functions / ArrayReverse
Documentation on MQL5: Array Functions / ArrayReverse
  • www.mql5.com
ArrayReverse - Array Functions - MQL5 Reference - Reference on algorithmic/automated trading language for MetaTrader 5
 
Wai Shing Ng: TempArray[3]={1,4,3};

How can I adjust the position to {3,4,1}? 

ArraySetAsSeries(TempArray, !ArrayGetAsSeries(TempArray) );
Reason: