|
From: Thies <tg...@us...> - 2007-08-08 21:48:46
|
Update of /cvsroot/tail/Tail/src/java/net/sf/tail/flow In directory sc8-pr-cvs10.sourceforge.net:/tmp/cvs-serv10088/src/java/net/sf/tail/flow Modified Files: CashFlow.java Log Message: MaximumDrawDown e CashFlow acertados para utilizar o getBegin() e getEnd() do timeSeries Index: CashFlow.java =================================================================== RCS file: /cvsroot/tail/Tail/src/java/net/sf/tail/flow/CashFlow.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** CashFlow.java 21 Jul 2007 15:13:46 -0000 1.2 --- CashFlow.java 8 Aug 2007 21:48:47 -0000 1.3 *************** *** 22,31 **** public double getValue(int index) { ! increaseLength(index); ! if(values.get(index) != null) ! return values.get(index); ! if(index == 0) { values.add(0, 1d); --- 22,32 ---- public double getValue(int index) { ! int indexValue = index - timeSeries.getBegin(); ! increaseLength(indexValue); ! if(values.get(indexValue) != null) ! return values.get(indexValue); ! if(index == timeSeries.getBegin()) { values.add(0, 1d); *************** *** 36,41 **** if(trade == null) { ! values.add(index, getValue(index - 1)); ! return values.get(index); } else --- 37,42 ---- if(trade == null) { ! values.add(indexValue, getValue(index - 1)); ! return values.get(indexValue); } else *************** *** 44,48 **** Double value = getValue(trade.getEntry().getIndex()) * profit; ! values.add(index, value); return value; } --- 45,49 ---- Double value = getValue(trade.getEntry().getIndex()) * profit; ! values.add(indexValue, value); return value; } *************** *** 69,75 **** --- 70,83 ---- } } + // for (int i = 0; i < timeSeries.getSize(); i++) { + // while (trades.get(i).getExit().getIndex() >= i) { + // if(trades.get(i).getEntry().getIndex() <= i) + // return trades.get(i); + // } + // } return null; } + private void increaseLength(int index) { if (values.size() <= index) { |