--Oleg Kobchenko wrote:
> There is also filled/hollow candlesticks charts.
>
> http://stockcharts.com/school/doku.php?id=chart_school:chart_analysis:what_are_charts
>

I thought these would be quite easy to implement by combining a hilo plot and a 
floating bar plot, but ran in to a couple of issues.

 A) The way the horizontal position of the bars and the hilo lines are 
calculated doesn't seem to be compatible so the bars are not centred on the 
lines except for the middle datapoint. There may be a way to force these to 
overlap?

 B) The floating bar plot type forces the y range to include 0 which means that 
small changes in values a long way from 0 don't show up well. Manually 
specifying the yrange, (eg. yrange 60 80) only affects the max value not the 
minimum.

   plot_candlestick data
   'yrange 60 80' plot_candlestick data
   'yrange 0 10' plot_candlestick data-65

plot_candlestick=: 3 : 0
 ''plot_candlestick y
:
 hl=. 1 2{y
 oc=. 0 3{y
 oc=. (<./ , (] (|@:*"1) 0&> ,: 0&<)@:-/) oc
 ntics=. {:$hl
 pd 'reset'
 pd 'xticpos ',": i.ntics
 pd 'pensize 2'
 pd x
 pd 'color blue'
 pd 'type hilo'
 pd hl
 pd 'color white,blue'
 pd 'barwidth 0.2'
 pd 'type fbar'
 pd oc
 pd 'show'
)
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to