java - JFreeChart: how to set the duration/period of a candle? -
is possible set duration/period of single ohlcitem on candlestickchart?
what i'm trying achieve possibility of merging 2 candles 1 ohlcitem. problem can set point in time on x axis candle should drawn, while merged candle should take space of 2 merged candles.
is there way achieve this? screenshot better explains i'm aiming at:
currently i'm merging candles following code, replaces 1 of items @ item's millisecond:
private static ohlcitem getmergeditem(int i, ohlcitem clickeditem, ohlcitem neighbouritem) { double high; double low; if(clickeditem.getlowvalue() >= neighbouritem.getlowvalue()) { low = neighbouritem.getlowvalue(); } else { low = clickeditem.getlowvalue(); } if(clickeditem.gethighvalue() >= neighbouritem.gethighvalue()) { high = clickeditem.gethighvalue(); } else { high = neighbouritem.gethighvalue(); } if(i == 1) { return new ohlcitem(clickeditem.getperiod(), neighbouritem.getopenvalue(), high, low, clickeditem.getclosevalue()); } else { return new ohlcitem(neighbouritem.getperiod(), clickeditem.getopenvalue(), high, low, neighbouritem.getclosevalue()); } }
Comments
Post a Comment