Help on Multi Dimensional Array

 

Greetings to the members of Forum

I am trying to capture RANGE IN / OUT periods for Three Time Frames. Looking forward how I can create, fill and get information from a MultiDimensional Array for this purpose.

Example of array, if possible at all

arrayRange [timeFrame] [InBarTime] [OutBarTime]

 
Anil Varma: arrayRange [timeFrame] [InBarTime] [OutBarTime]

The first two should be indexes the last a value. You don't have multiple Outs for each In. (whatever those are.)

More likely, you want to convert a timeFrame (enumeration) to an index, and have an array of struct.

struct Data {datetime in, out;}
Data array[21];
int tf = to_tf(_Period);
array[tf].in=Time[0];

Because the enumerations are not sequential, you can not increment/decrement them to get the next larger/smaller one.
          Why are MT5 ENUM_TIMEFRAMES strange? - General - MQL5 programming forum - Page 2 #11 2020.06.21

 
William Roeder:

The first two should be indexes the last a value. You don't have multiple Outs for each In. (whatever those are.)

More likely, you want to convert a timeFrame (enumeration) to an index, and have an array of struct.

Because the enumerations are not sequential, you can not increment/decrement them to get the next larger/smaller one.
          Why are MT5 ENUM_TIMEFRAMES strange? - General - MQL5 programming forum - Page 2 #11 2020.06.21

Thanks William, seems including timeframe becomes bit tricky.

How about to have different array for each timeFrame as Range_TF0 [] [], Range_TF1 [] [] and so on.

datetime Range [1] [1] where first dimension is barRangeIN and second dimension is barRangeOUT

when Range IN condition satisfied, I fill up barOpenIN value, the other remains NULL (or blank) as below:-

if(aBB_BandWidth_TF0[1] = aBB_BandWidth_TF0[indexTF0_Min])

Range_TF0[0] = iTime(_Symbol,TF0,indexTF0_Min); ... here how do I leave second dimension blank?

I am able to capture datetime of barRangeIN with one dimensional array. Need help to use second dimension for RangeOUT bar datetime.

when Range OUT condition satisfied, I fill up barRangeIN as NULL/BLANK and barRangeOUT as it open datetime;

This is for the first time I am trying to attempt a complicated code (at least for newbie like me).

the breakout strategy I am trying is:-

1) to look if prices are in Range (IN != NULL && OUT = NULL);

2) to look WHEN prices start move away from Trading Range, which could be on a different bar(s) than RangeIN;

.....

Any suggestions to simply the code will be highly appreciated.