the May 6 data was recorded live from JBT in forward testing mode on this day.
I agree to remove them from the data set since this should have been a once a year/decade situation - hopefully. If not removed it would perhaps endanger the quality of optimisation results. perhaps we can comment the data out with #, as far as I know JBT is skipping these lines when reading the data files. those guys who want to play with May 6 have these data available On Jun 9, 9:09 pm, Keith <[email protected]> wrote: > I am testing the code as-is this morning, needed to add 3 more } to > make Eclipse happy. > > Some observations: > > ES was crashing for the past half an hour: > > 1. The stop loss does not appear to work - the long position was > maintained. > 2. As it crashes, the depth balance and indicators continue to be > positive, is this the expected behavior? > > On Jun 9, 3: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]. For more options, visit this group at http://groups.google.com/group/jbooktrader?hl=en.
