Here is another pass that deals with up blue and
down read. It's ugly but I wanted to see if I
could do it this way.

http://www.pixentral.com/show.php?picture=1sN42SYyKtAKR2uue9kp0OUinIXeUA

load'plot'
up   =: ,@:(2&#@<://.&>/)
down =: ,@:(2&#@> //.&>/)

tics =: (2 # [: i. [: {: [: $ {) ; [: , @: |: {

OC =: 1 : '[EMAIL PROTECTED] ([                  ;/@:(#"1)  >@]) ]'
HL =: 1 : '[EMAIL PROTECTED] ([ (<"2@:|:"2)@(_2&(]\)@(#"1)) >@]) ['

hl =: 1 : '1 2&(tics u HL  0 3&[EMAIL PROTECTED])y'
oc =: 1 : '0 3&(     u OC     @tics  )y'


plot_ohlc=: 3 : 0
 ''plot_ohlc y
:
 pd 'reset'
 pd 'xticpos ',": i.ntics
  pd x
 pd 'type hilo'
 pd 'color blue'
 pd  up hl y
 pd 'type point'
 pd 'pensize 3'
 pd 'markers plus'
 pd  up oc y
 pd 'type hilo'
 pd 'pensize 1'
 pd 'color red'
 pd  down hl y
 pd 'type point'
 pd 'pensize 3'
 pd 'markers plus'
 pd  down oc y
 pd 'show'
)

data=: 0".> <;._2 ] 0 : 0
71.93 72.99 73.32 71.89 73.86
  72    73  73.6  72.2  74.3
 71.5 72.25  73.2  71.8  73.2
 71.7  72.3  73.5    72    74
)

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

Reply via email to