Please teach me, why this code bellow give the result not correct?
I don't known, why D1 == D2 but LastValue(D1) != LastValue(D2)?
if (BeginZoom != "")
{
dn = DateNum();
dt = DateTime();
be = 1190424;
en = be + 1;
newbar = (dn != Ref(dn, -1)) AND (dn == be OR dn == en);
D1 = ValueWhen(newbar, dt, 0);
D2 = ValueWhen(newbar, dt, 1);
sD1 = DateTimeToStr(LastValue(D1), 3);
sD2 = DateTimeToStr(LastValue(D2), 3);
PopupWindow ("" + NumToStr(D1) + " | " + sD1 + "\n" + NumToStr(D2) + " | " + sD2, "");
AB = CreateObject("Broker.Application");
AW = AB.ActiveWindow;
AW.ZoomToRange(sD1, sD2);
}
Could you specifically write your intention in words?
I wanna ZoomToRange() of a day in Intraday chart. Example day 24/04/2019 (1190424). It mean show all bars (tick) since the market opened until the market closed.
Did you go through this KB Article?
How to browse charts in selected date range
Also found a solution shared by fxshrat:
There is no native chart date range selector (similar to analysis "From-to" date selector) to pin point date.
Either use Range markers or AFL+OLE (ZoomToRange , see sample code below)
ParamDate of AB version 6.20 has got additional feature of returning datetime format.
/// code works for native EOD bars as well as daily bars created out of intraday data
/// @link https://forum.amibroker.com/t/chart-set-timeframe-from-1-1-2018-till-now/10534/2
/// sample code by fxshrat@gmail.com
Version(6.20);…
And if that's the sole intention, then why not simply use Bar Replay window?
1 Like
Thank you for helping me!