{"id":722,"date":"2014-11-18T16:27:31","date_gmt":"2014-11-18T21:27:31","guid":{"rendered":"http:\/\/www.amibroker.com\/kb\/?p=722"},"modified":"2014-12-04T08:29:17","modified_gmt":"2014-12-04T13:29:17","slug":"how-to-plot-daily-high-and-low-on-intraday-chart","status":"publish","type":"post","link":"https:\/\/www.amibroker.com\/wordpress\/kb\/2014\/11\/18\/how-to-plot-daily-high-and-low-on-intraday-chart\/","title":{"rendered":"How to plot daily High and Low on intraday chart"},"content":{"rendered":"

The AFL offers a set of time-frame functions which allow to use multiple intervals within a single formula (the topic is explained in details in the following tutorial chapter: http:\/\/www.amibroker.com\/guide\/h_timeframe.html<\/a>)<\/p>

In situations, where we do not need to calculate any indicators based on higher interval data, but rather just read OHLC, V or OI arrays – TimeFrameGetPrice<\/a><\/strong> is the most convenient function to use.<\/p>

To plot daily High and Low levels we just need to read the respective arrays calling: TimeFrameGetPrice(“H”, inDaily ) – the first argument specifies the array we want to read, the second argument defines the interval we are reading data from. As with any other TimeFrame functions – we can only read data from higher intervals, so it is possible to read daily data when we work with 1-minute quotes, but not the other way round.<\/p>

Here is a sample formula which draws daily high and low in the intraday chart:<\/p>Plot<\/span>( <\/span>Close<\/span>, <\/span>"Close"<\/span>, <\/span>colorDefault<\/span>, <\/span>styleBar <\/span>);
<\/span>Plot<\/span>( <\/span>TimeFrameGetPrice<\/span>(<\/span>"H"<\/span>, <\/span>inDaily <\/span>), <\/span>"day high"<\/span>, <\/span>colorGreen<\/span>, <\/span>styleStaircase <\/span>| <\/span>styleThick<\/span>);
<\/span>Plot<\/span>( <\/span>TimeFrameGetPrice<\/span>(<\/span>"L"<\/span>, <\/span>inDaily <\/span>), <\/span>"day low"<\/span>, <\/span>colorRed<\/span>, <\/span>styleStaircase <\/span>| <\/span>styleThick<\/span>)<\/code>

TimeFrameGetPrice<\/strong>() functions allow also to easily shift the reading by N-bars of the higher interval if we specify that in 3rd argument of the function, so calling TimeFrameGetPrice<\/strong>( “H”, inDaily, -1 ) will return the high of previous day.<\/p>

The following code draws high \/ low of previous day on top of the intraday chart:<\/p>Plot<\/span>( <\/span>Close<\/span>, <\/span>"Close"<\/span>, <\/span>colorDefault<\/span>, <\/span>styleBar <\/span>);
<\/span>hlstyle <\/span>= <\/span>styleStaircase <\/span>| <\/span>styleThick<\/span>;
<\/span>Plot<\/span>( <\/span>TimeFrameGetPrice<\/span>( <\/span>"H"<\/span>, <\/span>inDaily<\/span>, -<\/span>1 <\/span>), <\/span>"Prev High"<\/span>, <\/span>colorGreen<\/span>, <\/span>hlstyle <\/span>);
<\/span>Plot<\/span>( <\/span>TimeFrameGetPrice<\/span>( <\/span>"L"<\/span>, <\/span>inDaily<\/span>, -<\/span>1 <\/span>), <\/span>"Prev Low"<\/span>, <\/span>colorRed<\/span>, <\/span>hlstyle <\/span>)<\/code>

\"Daily<\/p>","protected":false},"excerpt":{"rendered":"

The AFL offers a set of time-frame functions which allow to use multiple intervals within a single formula (the topic is explained in details in the following tutorial chapter: http:\/\/www.amibroker.com\/guide\/h_timeframe.html)In situations, where we do not need to calculate any indicators based on higher interval data, but rather just read OHLC, V or OI arrays – […]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[3],"tags":[53,55,32],"_links":{"self":[{"href":"https:\/\/www.amibroker.com\/wordpress\/kb\/wp-json\/wp\/v2\/posts\/722"}],"collection":[{"href":"https:\/\/www.amibroker.com\/wordpress\/kb\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.amibroker.com\/wordpress\/kb\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.amibroker.com\/wordpress\/kb\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.amibroker.com\/wordpress\/kb\/wp-json\/wp\/v2\/comments?post=722"}],"version-history":[{"count":2,"href":"https:\/\/www.amibroker.com\/wordpress\/kb\/wp-json\/wp\/v2\/posts\/722\/revisions"}],"predecessor-version":[{"id":729,"href":"https:\/\/www.amibroker.com\/wordpress\/kb\/wp-json\/wp\/v2\/posts\/722\/revisions\/729"}],"wp:attachment":[{"href":"https:\/\/www.amibroker.com\/wordpress\/kb\/wp-json\/wp\/v2\/media?parent=722"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.amibroker.com\/wordpress\/kb\/wp-json\/wp\/v2\/categories?post=722"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.amibroker.com\/wordpress\/kb\/wp-json\/wp\/v2\/tags?post=722"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}