Whoops sorry, some Friday dyslexia slipping in.
Here is the same code but this time the names have the letters in the correct
order - "ohlc" not "olhc".
plot_ohlc=: 3 : 0
''plot_ohlc y
:
hl=. 1 2{y
oc=. 0 3{y
ntics=. {:$hl
oc=. ,|:oc
oc=. (2#i.ntics);oc
pd 'reset'
pd 'xticpos ',": i.ntics
pd x
pd 'type line'
pd oc
pd 'type hilo'
pd 'color red'
pd hl
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
)
Note 'examples'
plot_ohlc data
'color red;pensize 2' plot_ohlc data
'xlabel Feb Mar Apr May Jun' plot_ohlc data
)
---Sherlock, Ric wrote:
> ---Tom wrote:
> > Does anybody know if plot can do OHLC (open/high/low/close) style
> > charting? I see it can do high/low, but not OHLC.
>
> Not out of the box, but you can pretty easily make a custom
> plot to do the job.
> This one is a start but could be improved.
>
> plot_olhc=: 3 : 0
> ...
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm