results for ES confirmed: the strategy is loosing lots of money. Other situation for the NQ: optimized from Jan. 2010 to Apr 2010 and backtested from Mai 2010 to June 2010 we have the following results: Trades: 160 Net Profit: 2807 Profit Factor: 1.21 Max DD. 3839 (on May 6 when the stock markets stalled, but recovered to the state before May 6)
On Jun 9, 1:37 pm, Eugene Kononov <[email protected]> wrote: > I tested this on a larger data set (Dec 2009 to June 2010), and it turned > out a loss of $8000. > > On Wed, Jun 9, 2010 at 6:02 AM, bluemaster <[email protected]> wrote: > > I tested combined profit taker and loss stop Eugene strategy and made > > money on all 4 instrument > > DAX,ES,SPI and EUR. > > I wish I know hot to add extra priceSMA indicator maybe some one can > > help :-) > > > here you are : > > > ------------------------------------------------------------------------------------------------------------- > > > package com.jbooktrader.strategy; > > > import com.jbooktrader.indicator.velocity.*; > > import com.jbooktrader.platform.indicator.*; > > import com.jbooktrader.platform.model.*; > > import com.jbooktrader.platform.optimizer.*; > > import com.jbooktrader.strategy.base.*; > > > /** > > * > > */ > > public class ProfitTakerLossStopper extends StrategyES { > > > // Technical indicators > > private final Indicator balanceVelocityInd; > > > // Strategy parameters names > > private static final String SLOW_PERIOD = "SlowPeriod"; > > private static final String ENTRY = "Entry"; > > private static final String TARGET = "Target"; > > private static final String STOP = "Stop"; > > > // Strategy parameters values > > private final int entry, target, stop; > > > public ProfitTakerLossStopper(StrategyParams optimizationParams) > > throws JBookTraderException { > > super(optimizationParams); > > > entry = getParam(ENTRY); > > target = getParam(TARGET); > > stop = getParam(STOP); > > balanceVelocityInd = new BalanceVelocity(30, > > getParam(SLOW_PERIOD)); > > addIndicator(balanceVelocityInd); > > } > > > /** > > * Adds parameters to strategy. Each parameter must have 5 values: > > name: > > * identifier min, max, step: range for optimizer value: used in > > backtesting > > * and trading > > */ > > �...@override > > public void setParams() { > > addParam(SLOW_PERIOD, 100, 4000, 100, 3400); > > addParam(ENTRY, 10, 30, 1, 15); > > addParam(TARGET, 1, 20, 1, 5); > > addParam(STOP, 1, 10, 1, 7); > > } > > > /** > > * Framework invokes this method when a new snapshot of the limit > > order book > > * is taken and the technical indicators are recalculated. This is > > where the > > * strategy itself (i.e., its entry and exit conditions) should be > > defined. > > */ > > �...@override > > public void onBookSnapshot() { > > double balanceVelocity = balanceVelocityInd.getValue(); > > int currentPosition = getPositionManager().getPosition(); > > double priceDiff = getPositionManager().getAvgFillPrice() - > > getMarketBook().getSnapshot().getPrice(); > > double profit = 0; > > if (currentPosition > 0) { > > profit = -priceDiff; > > } else if (currentPosition < 0) { > > profit = priceDiff; > > } > > > if (profit > target) { > > setPosition(0); > > } else { > > if (balanceVelocity >= entry) { > > setPosition(1); > > } else if (balanceVelocity <= -entry) { > > setPosition(-1); > > /* Stop Loss */ > > double loss = 0; > > if (currentPosition > 0) { > > loss = priceDiff; > > } else if (currentPosition < 0) { > > loss = -priceDiff; > > } > > > if (loss > stop) { > > setPosition(0); > > } else { > > if (balanceVelocity >= entry) { > > setPosition(1); > > } else if (balanceVelocity <= > > -entry) { > > setPosition(-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]<jbooktrader%[email protected]> > > . > > For more options, visit this group at > >http://groups.google.com/group/jbooktrader?hl=en. -- 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.
