Time frame question

 

Forgive me, I am new, I've been using mt4 for a while. I coded a way to make calculations on custom time frames, by loading the current price of an instrument into an array. So this way, I at 10:15 for example, I can calculate stuff with an hourly perspective, but between 9:16 and 10:15, and get an hourly reading of the exact last hour relative to now.

Is there a built in provision for this kind of trickery in mt5 (or mt4 for that matter)?

 
jepper:

Forgive me, I am new, I've been using mt4 for a while. I coded a way to make calculations on custom time frames, by loading the current price of an instrument into an array. So this way, I at 10:15 for example, I can calculate stuff with an hourly perspective, but between 9:16 and 10:15, and get an hourly reading of the exact last hour relative to now.

Is there a built in provision for this kind of trickery in mt5 (or mt4 for that matter)?

I think it depends on where you're going to use it.

 
jepper: Forgive me, I am new, I've been using mt4 for a while. I coded a way to make calculations on custom time frames, by loading the current price of an instrument into an array. So this way, I at 10:15 for example, I can calculate stuff with an hourly perspective, but between 9:16 and 10:15, and get an hourly reading of the exact last hour relative to now. Is there a built in provision for this kind of trickery in mt5 (or mt4 for that matter)?

An alternative, on MT4 is to create/build an Offline Chart of bars according to your non-standard specifications, and then attach whatever indicator you wish to use on it. That is how they make charts for Constant Range Bars, Constant Volume Bars, Renko, Point & Figure, 3-Line Break, etc.

However, if you don't need to visualise it or add indicators to it, then the way you are doing it is just fine and probably more efficient. You also can't back-test on Offline Charts, so you are probably better to continue to use the method you have described.

You can however, generate the Offline Chart from your EA at the same time it trades, just as a monitoring or debugging tool if you wish.

PS! By the way, the equivalent functionality on MT5 is to use Custom Symbols.

 
Thanks for your replies, It appears MqlRates and copyRates are useful for the shifting of array data. I'm currently doing this in for loops... So now I need to figure out how to apply this to my next project.
Reason: