---Sherlock, Ric wrote:
> I had come to the same conclusion re geometrically drawn
> shapes. Symbols for the marker plot type are drawn
> geometrically, so I defined two new markers "lineleft" and
> "lineright" in jzplot & used a marker rather than an symbol
> plot type. That resulted in a nice, clean, accurate result
> although does not yet differentiate open>close or open<close
> using colour as Devon wished.

Now with different colour for open>close & close<open.

Copy the plot_ohlc script below into a new temp script.
Load it.
Then try the examples in the Note.

================= Start plot_ohlc.ijs ================
Note 'Examples'
  NB. Get data
  load 'csv'
  fn=. jpath '~system\examples\data\dm0396.txt'
  data=: |: 0". >1 2 3 4{"1 readcsv fn
  NB. Plot data
  plot_ohlc _50{."1 data
  'pensize 2;markersize 2' plot_ohlc _5{."1 data
  plot_ohlc _100{."1 data
)

load 'plot'

isimark_lineleft_jzplot_=: 4 : 0
s=. rndint 4 1 * x
p=. (y -"1 s) ,"1 s
gpbuf ,gpcount 2031 ,"1 p
)

isimark_lineright_jzplot_=: 4 : 0
s=. rndint 4 1 * x
p=. (y -"1 s * 0 1) ,"1 s
gpbuf ,gpcount 2031 ,"1 p
)

MarkerNames_jzplot_=: MarkerNames_jzplot_,'lineleft';'lineright'

plot_ohlc=: 3 : 0
 ''plot_ohlc y
:
 hl=. 1 2{y
 oc=. 0 3{y
 xs=. i.{:$y
 msk=. (0 > -/) oc
 updwn=. #"1 ; [EMAIL PROTECTED] #"1 ] NB. box up & down series
 pd 'reset'
 pd 'pensize 1' NB.default
 pd 'markersize 1' NB.default
 pd x
 pd 'type marker'
 pd 'markers lineleft,lineright'
 opts=. 'color blue';'color red'
 pd &> opts ,. <"1 (msk updwn xs),. msk updwn oc
 pd 'type hilo'
 pd &> opts ,. <"1 (msk updwn xs),. msk updwn hl
 pd 'show'
)

=================End plot_ohlc.ijs================
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to