Hello. I write a multi-time frame expert. I need help writing an interesting function, otherwise I’m completely confused. In General, there is an array with daily data ForLastSignalType_D1[] and an array with hourly data ForLastSignalType_H1[] they contain the values 0 1 2 3 4 5 6, respectively, in a mismatch (something like a candle type). Each cell of the array corresponds to the number of the candle on the chart. You need to fulfill a difficult condition. Check the day array from 0 to the number of bars on the daily chart, and as soon as we find a cell with the value 6(for example 25-th cell), then it check the whether after it is closer to 0, the cell with the value 3 (for example 22-th cell), if there is something in the time array from the cell with the number (22*24) looking for is there a cell with a value of 6, and whether this cell to the 0 cell with the value 3. If there is presuem number of cells in the time array with the value 3 to the variable Checker_D1_Bear and continue to search. If at least one condition from the series is not met, then we start looking for the value 6 in the daily array and re-check the lower conditions. I will be glad of any help, thank you in advance.. I tried this, but it wasn’t the right coat.. I’ve already broken my whole brain..

` if (Checker_D1_Bear == 0)`

{

for (int ibear=0; ibear1; ibear++)

{

if (ForLastSignalType_D1[ibear] == 6)

{

Print(ibear);

for (int ybear=ibear; ybear>0; ybear--)

{

if (ForLastSignalType_D1[ybear] == 3)

{

for (int zbear=ybear*24; zbear>0; zbear--)

{

if (ForLastSignalType_H1[zbear] == 6)

{

for (int xbear=zbear; xbear>0; xbear--)

{

if (ForLastSignalType_H1[xbear] == 3)

{

Checker_D1_Bear=xbear;

}

}

}

}

}

}

}

}

}

## pozitif

There are so many nested loops of the same type, it is easier to make the array search a separate function.

`template <typename T>`

int SearchByArray(const T value, const T &arr[])

{

//---

for(int i=0;i<ArraySize(arr);i++)

if(arr[i]==value)return(i);

//---

return(-1);

}

## reloaded699999

I would help, but I think You’re being too clever … if I specifically said about the conditions of the stratum… I’d help make it…

First : “…immediately in it we check whether there is a cell closer to 0 after it with the value 3 (for example, the 22nd cell), … ” this is in com.. in it?? in the daytime bar “inside” that is, on the hour TM or what??

Secondly, “… the daily chart, and as soon as we find a cell with a value of 6(for example, the 25th cell), we immediately check whether there is a cell with a value of 3 (for example, the 22nd cell) closer to 0 after it … ” – is it not easier to immediately look for 3 and then 6?? and why only these two numbers??

the variety in the markets tends to infinity.. i.e. each bar is almost unique…

I’d make it a lot easier if I knew what You wanted at all)))

## denisvanslyer

behind these 6-kami lies another magic 🙂