I recently discovered this useful "bar replay" feature. My data is in hourly bars. I would like to set the step interval to 4 hours or 2 hours. However, the option available are hourly, daily, weekly ...
Is it possible to somehow step through using 2 or 4 hourly bars?
If you like it and is enough for your purposes, you should define your "custom" bar intervals in the Preferences ("Intraday" tab), apply it to your chart an then execute the proposed formula.
@beppe@thankyou18 - the quote is irrelevant to the question. Question was about "step interval" (the amount of time bar replay goes between steps) not stepping speed (how fast steps are taken). Computer speed has nothing to do with step size (interval).
One has to keep in mind that Bar Replay plays back ENTIRE DATABASE (ALL SYMBOLS) at once. I.e. ALL symbols data are played, not just single selected chart.
Therefore step size can be chosen from some "human friendly" units, i.e. minutes, hours, days. And units are stepped one by one (not two at once). It is not "limitation" of any kind. It is well-thought design decision (to make replay time stepping in "human-friendly" units).
But... Bar replay step size is totally independent from chart interval. So you can just select 2-hour interval for your CHART. And bar replay would replay your 2-hour chart (using two hourly steps per single candle).
On a side note: Custom codes are discouraged. Why? Because they can't do what Bar Replay does. Bar Replays makes future data (past 'playback time') UNAVAILABLE. For example if you use say LastValue(MACD()) you will get the value of the bar at 'playback time'. No matter what function you try you won't be able to get data from any symbol past 'playback time'. Custom formulas don't give you that guarantee.
Of course I agree with you Tomasz (for the reasons quoted above). I discourage anybody to perform any tests using my code. It should be rather treated as a simple tool (or a gadget ) allowing to quickly and automatically scroll the chart on demand (i.e. quicker than the native solution - like 20-30 1-second bars per second). This code by default makes use of 1 future bar.
Step = 1;
SetBarsRequired( MinBars, Step );
Actually it originates from another thread ( Alert driven Bar Replay ) in which I was trying to help Herman ( @Beaver ) but I've failed and in the end we both agreed, that custom solutions can not replace built-in Bar Replay:
@Tomasz, thanks for joining the thread and explaining to us why it is a lot better to stick to the built-in Bar-Replay.
And bar replay would replay your 2-hour chart (using two hourly steps per single candle).
My original answer was simply pointing to a formula that allows the OP to "simulate" (with all the limitations of the case) the bar replay using a single step per displayed candle, that I perceived - may be wrongly - like the OP's goal.
(The speed replay factor is something that I did not consider since, if needed, the user can set it as per the in-built tool; the quote was from @thankyou18).
Thanks again for making us fully aware of the issues and limitations of a custom solution for this task.
@Milosz and @Tomasz, selecting custom chart interval(like 2h, 4h) solved my problem. There's only a small inconvenience of clicking the mouse multiple times since each step is hourly.
@beppe, Sorry about the quote which was wrongly attributed to you. I copied and pasted the content from another thread. When I realised the mistake and wanted to correct it, I could not because edits are not allowed because the post has passed certain time window for edit.