Also notice that there is a built in volume charting capability.. maybe
something worth looking into?

On Wed, Jun 8, 2011 at 7:23 PM, Judson Wilson <[email protected]>wrote:

> On Wed, Jun 8, 2011 at 6:44 PM, nonlinear <[email protected]>wrote:
>
>> Judson, if you find time and motivation, perhaps you could do something
>> about the other mildly annoying chart problem. Look at the attached chart.
>> Notice how the "buy" and the "sell" annotations are positioned? It looks odd
>> because the annotations are not on the price line. The chart is in fact
>> totally correct, but because the price resolution is 5 minute OHLC bars and
>> the executions are plotted with a 1-second resolution, they seem to exist as
>> independent entities. I think the right way to handle it is to "snap" the
>> "buy/sell" annotations to the corresponding price bar.
>>
>> What do you guys think?
>>
>
> In my opinion, the "correct" thing to do would be to make the width of the
> bars such that there is very little gap between them.  Then the bubble would
> appear to occur somewhere in the middle of the bar.  This might be terribly
> ugly, though.
>
> Actually, here is a quick implementation for that effect.  Note it is
> HORRIBLY SLOW because JFreeChart is a turd, performance wise, in general,
> but this auto-width calculation method for the candles re-computes the width
> for each individual bar, by sifting through the dataset and looking for the
> smallest bar spacing (again, it does this calculation for every bar).  This
> could be implemented by hand because we already know the bar width, which
> would be much much faster.
>
> Anyways, here is the replacement chunk of code, which can easily be tweaked
> to look a little bit better.  You must zoom in substantially to see the
> effect:
>
>     private void createChart() {
>         CandlestickRenderer candleRenderer = new CandlestickRenderer(-1);
>         candleRenderer.setDrawVolume(false);
>
> candleRenderer.setAutoWidthMethod(CandlestickRenderer.WIDTHMETHOD_SMALLEST);
>         candleRenderer.setAutoWidthGap(0.0);
>         candleRenderer.setAutoWidthFactor(1.0);
>         candleRenderer.setUpPaint(Color.GREEN);
>         candleRenderer.setDownPaint(Color.RED);
>         candleRenderer.setSeriesPaint(0, new Color(250, 240, 150));
>         candleRenderer.setBaseStroke(new BasicStroke(1));
>

-- 
You received this message because you are subscribed to the Google Groups 
"JBookTrader" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/jbooktrader?hl=en.

Reply via email to