Download MetaTrader 5
To add comments, please log in or register
Register as a seller and start making profit!
Bert
28
Bert 2016.04.12 09:42 

Hi,

I'm facing the following problem:

I'm creating a multiple-timeframe indicator
In the weekly I found a high at a specified weekly_time bar
Now I want to plot this High on the correct place in the Daily-chart
So I want to search in the daily-chart between the found weekly starttime-endtime (=endtime == starttime nextbar) to the found weekly-high.
And finally plot in the daily chart at the correct place an arrow or something....

I have an array created with:

MqlRates weekly_rates[];
MqlRates daily_rates[];
...
...
ArrayCopyRates(weekly_rates,NULL,10080);
ArraySetAsSeries(weekly_rates,true);
ArrayCopyRates(daily_rates,NULL,1440);
ArraySetAsSeries(daily_rates,true);

Now I found the indexes of a found high-bar in the weekly and want to transform this to the daily-chart rates. (I'm creating a multiple chart indicator)

So I now found a time-span for the high (openingbar) and the next opening bar. Between both times we must search the exact time for the high in the daily-chart.

I thought I could use ArrayBSearch for searching the starttime...end endtime (getting back the id's in the daily_rates array and afterwarts search the high in the daily_rates array where I can then plot that high in the daily-

Unfortunately I can't address the weekly_rates[].time array correctly in the ArrayBSearch.

starttestlowid=ArrayBsearch(daily_rates.time, starttime, WHOLE_ARRAY,0,MODE_DESCEND);

or

starttestlowid=ArrayBsearch(daily_rates[...].time, starttime, WHOLE_ARRAY,0,MODE_DESCEND);

or

starttestlowid=ArrayBsearch(daily_rates[], starttime, WHOLE_ARRAY,0,MODE_DESCEND);

or

......??

All the version I tried incorrect ...In the documentation I can't see how I can address it at a correct way :(

whroeder1
13619
whroeder1 2016.04.12 11:35  
bertje: So I want to search in the daily-chart between the found weekly starttime-endtime (=endtime == starttime nextbar) to the found weekly-high.
  1. No where in the doc will you find you can select a specific field, do you can't use BSearch.
  2. Use iBarShift to find the weekly bar. Use iHigh to find the weekly bar high. Done.
Bert
28
Bert 2016.04.12 21:51  

Thanks again I fixed it!

With iBarshift I find the bars in the daily, from there I have a range for searching the high/low with iLowest.

whroeder1
13619
whroeder1 2016.04.13 01:09  
bertje: With iBarshift I find the bars in the daily, from there ...
What is the second argument of iBarShift?
/
To add comments, please log in or register