Jim Dean![]() Sage ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 3433 Joined: 3/13/2006 Location: L'ville, GA ![]() | The attached code is an example that helps illustrate and explain several things that are outside of Nirvana's current documentation ... since it uses some native Visual Basic functions. Don't let that scare you away. This example illustrates two very useful things for use with intraday plotting: 1. How to limit your plot to a particular day 2. How to PricePlot a series of separate segments of intraday bars within that day, WITHOUT those segments being connected to one another, OR to a comparable time-segment from the prior day. The function allows you to input all-zeros to specify that the plots are to occur for the CURRENT day ... and it automatically compensates for plots that you might be doing on Saturday or Sunday ... in that case, it plots the previous Friday. It also allows you to specify a particular YYYY MM DD during which the plot should be done. It also (and this is sorta cool) allows you to do the plot on a specified number of weekdays BEFORE the current day. If you span a weekend or two (or whatever) in the process, it automatically compensates for the Sat & Sun's in the calendar that are not trading days. That is, you input the number of TRADING days ago. There's one gotcha ... I did not build in the (messy) code that would be needed to auto-skip any trading holidays that occur M-F ... you need to input one extra day-ago for any of those. The example arbitrarily draws some lines above and below the price bars to show how they can be turned "on" and "off". The trick is to name each segment differently. This is ALL you have to do if you are working with daily bars ... but with intraday bars, you ALSO need the extra code to isolate what day you want to plot. This could be readily expanded to permit plotting over a range of calendar days. Theoretically, any trading holidays that are known ahead of time could be hard-coded as well. CAVEATS: The arbitrary choice of plotting five separated segments per day to illustrate this procedure IS based on a 390-minute day. There are situations where a trading-day's intraday-data might have MORE OR LESS than 390 minutes ... it could include pre- and post-market data; futures/forex is different; partial-holidays are different. However, none of these issues relate to the two main things illustrated by this code: 1. How to focus plotting (or calcs) on a particular day, and 2. How to plotprice individual segments within a day I hope this code is helpful to many people ... the programming of intraday stuff is sort of trick-sey, as Gollum would say ... [Edited by Jim Dean on 3/28/2015 7:22 AM] ![]() ![]() ![]() |