How to show ETH and RTH on chart by color?

How can i show ETH and RTH on chart like the picture showed?

Capture

ETH = 21:30 -16:00
RTH = 16:00 - 21:30

Which AFL code i need to learn? or maybe kind enough to share the proper code sample for learning?

Thank you.

see this KB article
http://www.amibroker.com/kb/2015/09/30/positioning-area-plots-behind-the-grid-lines/

It describes is exactly that way.

2 Likes
Plot(C, "Close", colorDefault, styleCandle );

tn = TimeNum();
// ETH = 2130 -16:00
RTH = tn > 160000 AND tn < 213000;
// or >= and <= as suited because your boundary isn't clear (overlapping)

color = IIf( RTH, colorGrey40, colorDarkBlue );
Plot( 1, "", color, styleArea|styleOwnScale,0,1 );
// OR
// Plot( 1, "", color, styleArea|styleOwnScale,0,1,0,-1 );
// the 8th argument specifies z-order

image

1 Like

I can't open amibroker.com from my country...only this forum i can access.

Thank you for the code and your time for answering my question, i just learn about

"RTH = tn > 040000 AND tn < 213000"

for time, coz i thought i need to use datetime. And learning the correct way to use timenum.

Thank you.

Sorry for this i got the wrong time, USA market time in my country 21:30 - 04:00
as for US time is 09:30 - 16:00

i change to : RTH = tn >= 040000 AND tn <= 213000; and it work like a charm. Tnx

1 Like