Skip to content

Commit ad7c201

Browse files
author
Kevin
committed
Lots of changes
1 parent b2bcc98 commit ad7c201

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

48 files changed

+286
-189
lines changed

.classpath

+1-6
Original file line numberDiff line numberDiff line change
@@ -30,23 +30,18 @@
3030
<classpathentry kind="lib" path="lib/ta-lib-0.4.0.jar"/>
3131
<classpathentry kind="lib" path="lib/cloning-1.9.0.jar"/>
3232
<classpathentry kind="lib" path="lib/objenesis-1.2.jar"/>
33-
<classpathentry kind="lib" path="lib/REngine.jar"/>
3433
<classpathentry kind="lib" path="lib/Rserve.jar"/>
3534
<classpathentry kind="lib" path="lib/Rsession.jar"/>
3635
<classpathentry kind="lib" path="lib/jcommon-1.0.20.jar"/>
3736
<classpathentry kind="lib" path="lib/jfreechart-1.0.14.jar"/>
3837
<classpathentry kind="lib" path="lib/uncommons-maths-1.2.1.jar"/>
3938
<classpathentry kind="lib" path="lib/watchmaker-framework-0.7.1.jar" sourcepath="lib/watchmaker-framework-0.7.1-src.jar"/>
40-
<classpathentry kind="lib" path="lib/JRI.jar">
41-
<attributes>
42-
<attribute name="javadoc_location" value="file:/C:/Users/Kevin/Downloads/rJava_0.9-5/rJava/javadoc/"/>
43-
</attributes>
44-
</classpathentry>
4539
<classpathentry kind="lib" path="lib/JRIEngine.jar">
4640
<attributes>
4741
<attribute name="javadoc_location" value="file:/C:/Users/Kevin/Downloads/rJava_0.9-5/rJava/javadoc/"/>
4842
</attributes>
4943
</classpathentry>
5044
<classpathentry combineaccessrules="false" kind="src" path="/encog-core"/>
45+
<classpathentry kind="lib" path="lib/JRI.jar"/>
5146
<classpathentry kind="output" path="bin"/>
5247
</classpath>

bin/.gitignore

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
/com
1+
/com/

lib/JRI.jar

-39.5 KB
Binary file not shown.

lib/JRIEngine.jar

292 Bytes
Binary file not shown.

lib/REngine.jar

-31.6 KB
Binary file not shown.

src/com/autoStock/algorithm/AlgorithmTest.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ public void endOfFeed(Symbol symbol) {
107107
}
108108
if (algorithmMode.displayTable) {
109109
Co.println("--> " + symbol.symbolName);
110-
new TableController().displayTable(AsciiTables.algorithm, tableForAlgorithm.getDisplayRows());
110+
new TableController().displayTable(tableForAlgorithm.INCLUDE_SIGNALS ? AsciiTables.algorithm : AsciiTables.algorithm_no_signals, tableForAlgorithm.getDisplayRows());
111111
}
112112
if (algorithmListener != null) {
113113
algorithmListener.endOfAlgorithm();

src/com/autoStock/algorithm/external/AlgorithmCondition.java

+16-9
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,17 @@
33
import java.util.ArrayList;
44
import java.util.Date;
55

6+
import com.autoStock.Co;
67
import com.autoStock.algorithm.AlgorithmBase;
78
import com.autoStock.position.PositionGovernorResponseStatus;
9+
import com.autoStock.position.PositionHistory;
10+
import com.autoStock.position.PositionHistory.ProfitOrLoss;
811
import com.autoStock.signal.SignalDefinitions.SignalPointType;
912
import com.autoStock.signal.SignalPoint;
1013
import com.autoStock.strategy.StrategyOptions;
1114
import com.autoStock.strategy.StrategyResponse;
1215
import com.autoStock.tools.DateTools;
16+
import com.autoStock.tools.ListTools;
1317
import com.autoStock.trading.types.Position;
1418
import com.autoStock.types.Exchange;
1519
import com.autoStock.types.QuoteSlice;
@@ -180,21 +184,24 @@ public boolean requestExitOnDate(Date date, Exchange exchange){
180184
return false;
181185
}
182186

183-
public boolean requestExitAfterLossDate(Date date, Position position, ArrayList<StrategyResponse> listOfStrategyResponse){
184-
if (strategyOptions.maxPositionLossTime == 0){
185-
return false;
186-
}
187+
public boolean requestExitAfterTimeInLoss(Date date, Position position, ArrayList<StrategyResponse> listOfStrategyResponse){
188+
if (strategyOptions.maxPositionTimeAtLoss.value == 0){return false;}
187189

188-
if (((date.getTime() - position.getPositionHistory().dateOfCreation.getTime()) / 60 / 1000) > strategyOptions.maxPositionLossTime && position.getPositionProfitLossAfterComission(true) <= 0){
190+
//Co.println("--> A: " + ListTools.getLast(position.getPositionHistory().listOfPositionHistory).date + ", " + position.getPositionHistory().getTimeIn(ProfitOrLoss.loss).asSeconds());
191+
//Co.println("--> B: " + ListTools.getLast(position.getPositionHistory().listOfPositionHistory).date + ", " + position.getPositionHistory().getTimeIn(ProfitOrLoss.profit).asSeconds());
192+
193+
if (position.getPositionHistory().getTimeIn(ProfitOrLoss.loss).asSeconds() >= strategyOptions.maxPositionTimeAtLoss.value * 60){
189194
return true;
190195
}
191196

192197
return false;
193198
}
194199

195-
public boolean requestExitAfterProfitHold(QuoteSlice quoteSlice, Position position){
196-
if (position.getCurrentPercentGainLoss(true) >= strategyOptions.maxPositionProfitTimeMinYield.value){
197-
if (((quoteSlice.dateTime.getTime() - position.getPositionHistory().dateOfCreation.getTime()) / 60 / 1000) >= strategyOptions.maxPositionProfitTime.value){
200+
public boolean requestExitAfterTimeInProfit(QuoteSlice quoteSlice, Position position){
201+
if (strategyOptions.maxPositionTimeAtLoss.value == 0){return false;}
202+
203+
if (position.getPositionHistory().getTimeIn(ProfitOrLoss.profit).asSeconds() >= strategyOptions.maxPositionTimeAtProfit.value * 60){
204+
if (position.getCurrentPercentGainLoss(true) >= strategyOptions.minPositionTimeAtProfitYield.value){
198205
return true;
199206
}
200207
}
@@ -255,7 +262,7 @@ public boolean stopFromProfitDrawdown(Position position) {
255262
// Co.print("--> Max Profit was: " + new DecimalFormat("#.00").format(MathTools.round(position.getPositionHistory().getMaxPercentProfitLoss())));
256263

257264
double profitDrawdown = position.getPositionProfitDrawdown();
258-
double positionMaxProfitPercent = position.getPositionHistory().getMaxPercentProfitLoss();
265+
double positionMaxProfitPercent = position.getPositionHistory().getMaxPercentProfitLoss().profitLossPercent;
259266

260267
// Co.println("--> Drawdown is: " + positionMaxProfitPercent + ", " + new DecimalFormat("#.00").format(profitDrawdown));
261268
// Co.println("--> Current profit is: " + new DecimalFormat("#.00").format(MathTools.round(position.getCurrentPercentGainLoss(true))) + "\n");

src/com/autoStock/backtest/BacktestEvaluation.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -198,7 +198,7 @@ public String getSingleLine(){
198198
String string = new DecimalFormat("#.00").format(getScore()) + "[%" + new DecimalFormat("#.00").format(percentYield) + "] ";
199199

200200
for (Pair<Date, Double> pair : listOfDailyYield){
201-
string += " " + new SimpleDateFormat("dd/MM/yyyy").format(pair.first) + " -> %" + new DecimalFormat("#.00").format(pair.second);
201+
string += " " + new SimpleDateFormat("dd/MM/yyyy").format(pair.first) + " -> %" + new DecimalFormat("#.00").format(pair.second) + "\n";
202202
}
203203

204204
return string;

src/com/autoStock/backtest/BacktestPredictFuture.java

+40-43
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
package com.autoStock.backtest;
55

66
import java.util.ArrayList;
7+
import java.util.Arrays;
78
import java.util.List;
89

910
import org.encog.engine.network.activation.ActivationFunction;
@@ -34,6 +35,7 @@
3435
import com.autoStock.database.DatabaseQuery;
3536
import com.autoStock.finance.SecurityTypeHelper.SecurityType;
3637
import com.autoStock.generated.basicDefinitions.TableDefinitions.DbStockHistoricalPrice;
38+
import com.autoStock.internal.ApplicationStates;
3739
import com.autoStock.tools.ArrayTools;
3840
import com.autoStock.tools.DateTools;
3941
import com.autoStock.tools.ListTools;
@@ -50,12 +52,13 @@
5052
*
5153
*/
5254
public class BacktestPredictFuture {
53-
private static final int POINT_SIZE = 4;
55+
private static final int INPUT_POINT_SIZE = 4;
5456
private static final int INPUT_POINTS = 10;
57+
private static final int OUTPUT_POINT_SIZE = 4;
5558
private static final int OUTPUT_POINTS = 1;
56-
private static final int IDEAL_OFFSET = 0;
57-
private static final int INPUT_NEURONS = INPUT_POINTS * POINT_SIZE;
58-
private static final int OUTPUT_NEURONS = OUTPUT_POINTS * POINT_SIZE;
59+
private static final int IDEAL_OFFSET = 8;
60+
private static final int INPUT_NEURONS = INPUT_POINTS * INPUT_POINT_SIZE;
61+
private static final int OUTPUT_NEURONS = OUTPUT_POINTS * OUTPUT_POINT_SIZE;
5962
private ActivationFunction activationFunction = new ActivationTANH();
6063
private ArrayList<PredictionResult> listOfPredictionResult = new ArrayList<PredictionResult>();
6164

@@ -70,61 +73,51 @@ public PredictionResult(int countCorrect, int countIncorrect) {
7073
}
7174

7275
public void run(){
73-
HistoricalData historicalDataIS = new HistoricalData(new Exchange("NYSE"), new Symbol("MS", SecurityType.type_stock), DateTools.getDateFromString("09/08/2014"), DateTools.getDateFromString("09/11/2014"), Resolution.min);
76+
// Load the data
77+
HistoricalData historicalDataIS = new HistoricalData(new Exchange("NYSE"), new Symbol("MS", SecurityType.type_stock), DateTools.getDateFromString("09/08/2014"), DateTools.getDateFromString("09/08/2014"), Resolution.min);
7478
historicalDataIS.setStartAndEndDatesToExchange();
7579
ArrayList<DbStockHistoricalPrice> listOfResultsIS = (ArrayList<DbStockHistoricalPrice>) new DatabaseQuery().getQueryResults(BasicQueries.basic_historical_price_range, new QueryArg(QueryArgs.symbol, historicalDataIS.symbol.symbolName), new QueryArg(QueryArgs.exchange, new Exchange("NYSE").exchangeName), new QueryArg(QueryArgs.resolution, Resolution.min.asMinutes()), new QueryArg(QueryArgs.startDate, DateTools.getSqlDate(historicalDataIS.startDate)), new QueryArg(QueryArgs.endDate, DateTools.getSqlDate(historicalDataIS.endDate)));
7680

77-
HistoricalData historicalDataOS = new HistoricalData(new Exchange("NYSE"), new Symbol("MS", SecurityType.type_stock), DateTools.getDateFromString("09/12/2014"), DateTools.getDateFromString("09/12/2014"), Resolution.min);
81+
HistoricalData historicalDataOS = new HistoricalData(new Exchange("NYSE"), new Symbol("MS", SecurityType.type_stock), DateTools.getDateFromString("09/08/2014"), DateTools.getDateFromString("09/08/2014"), Resolution.min);
7882
historicalDataOS.setStartAndEndDatesToExchange();
7983
ArrayList<DbStockHistoricalPrice> listOfResultsOS = (ArrayList<DbStockHistoricalPrice>) new DatabaseQuery().getQueryResults(BasicQueries.basic_historical_price_range, new QueryArg(QueryArgs.symbol, historicalDataOS.symbol.symbolName), new QueryArg(QueryArgs.exchange, new Exchange("NYSE").exchangeName), new QueryArg(QueryArgs.resolution, Resolution.min.asMinutes()), new QueryArg(QueryArgs.startDate, DateTools.getSqlDate(historicalDataOS.startDate)), new QueryArg(QueryArgs.endDate, DateTools.getSqlDate(historicalDataOS.endDate)));
8084

8185
Co.println("--> Size: " + listOfResultsIS.size() + ", " + listOfResultsOS.size());
8286

8387
BasicMLDataSet dataSet = new BasicMLDataSet();
8488

85-
int sequence = 0;
86-
89+
// Build the input & ideal lists as % deltas
8790
ArrayList<Double> percentChangeWindow = new ArrayList<Double>();
8891
ArrayList<Pair<DbStockHistoricalPrice, MLData>> priceIdealList = new ArrayList<>();
8992

9093
for (DbStockHistoricalPrice slice : listOfResultsIS){
91-
Co.println("--> Slice: (" + sequence + ")" + slice.dateTime + ", " + slice.priceClose);
92-
MathTools.addPercentChangeList(percentChangeWindow, slice.priceOpen, slice.priceHigh, slice.priceLow, slice.priceClose);
93-
94-
if (sequence != 0 && sequence % INPUT_POINTS == 0){
95-
Co.println("--> Would add slice at: " + sequence);
96-
priceIdealList.add(new Pair<DbStockHistoricalPrice, MLData>(slice, null));
97-
}
98-
99-
Co.println("");
100-
sequence++;
94+
// Co.println("--> Slice: (" + sequence + ")" + slice.dateTime + ", " + slice.priceClose);
95+
MathTools.genPercentChangeList(percentChangeWindow, IDEAL_OFFSET, slice.priceOpen, slice.priceHigh, slice.priceLow, slice.priceClose);
96+
priceIdealList.add(new Pair<DbStockHistoricalPrice, MLData>(slice, new BasicMLData(ArrayTools.getDoubleArray(ListTools.getLast(percentChangeWindow, 4)))));
10197
}
10298

103-
Co.println("--> A: " + percentChangeWindow.size());
104-
percentChangeWindow = ListTools.subList(percentChangeWindow, POINT_SIZE, -1);
105-
Co.println("--> A: " + percentChangeWindow.size() + ", " + priceIdealList.size());
106-
107-
int sequenceAlign = 0;
108-
109-
for (int i=0; i<percentChangeWindow.size() - INPUT_NEURONS; i += INPUT_NEURONS){
99+
//Remove the fist nW as it will be 0
100+
Co.println("--> A1: " + percentChangeWindow.size());
101+
percentChangeWindow = ListTools.subList(percentChangeWindow, INPUT_NEURONS + ((IDEAL_OFFSET -1) * INPUT_POINTS), -1);
102+
priceIdealList = ListTools.subList(priceIdealList, INPUT_POINTS, -1);
103+
Co.println("--> A2: " + percentChangeWindow.size());
104+
Co.println("--> A3 ideal: " + priceIdealList.size());
105+
106+
// Setup MLData accordingly
107+
for (int i=0; i<percentChangeWindow.size() - INPUT_NEURONS - OUTPUT_NEURONS; i++){
110108
MLData input = new BasicMLData(ArrayTools.getDoubleArray(percentChangeWindow.subList(i, i + INPUT_NEURONS)));
111109
MLData ideal = new BasicMLData(ArrayTools.getDoubleArray(percentChangeWindow.subList(i + INPUT_NEURONS, i + INPUT_NEURONS + OUTPUT_NEURONS)));
112110

113111
dataSet.add(input, ideal);
114-
115-
priceIdealList.get(sequenceAlign).second = ideal;
116-
117-
sequenceAlign++;
118-
119-
Co.println("--> B " + sequenceAlign);
120112
}
121113

122-
for (Pair<DbStockHistoricalPrice, MLData> item : priceIdealList){
123-
if (item.second != null){
124-
Co.println("--> Price close, predication: " + item.first.dateTime + ", " + item.first.priceClose + ", " + item.second.getData(3) + " = " + ((item.first.priceClose * (item.second.getData(3)/100)) + item.first.priceClose));
125-
}
126-
}
114+
// for (Pair<DbStockHistoricalPrice, MLData> item : priceIdealList){
115+
// if (item.second != null){
116+
// Co.println("--> Price close, predication: " + item.first.dateTime + ", " + item.first.priceClose + ", " + item.second.getData(3) + " = " + ((item.first.priceClose * (item.second.getData(3)/100)) + item.first.priceClose));
117+
// }
118+
// }
127119

120+
// Train the network
128121
BasicNetwork network = getMLNetwork(INPUT_NEURONS, OUTPUT_NEURONS);
129122
MLTrain train = new ResilientPropagation(network, dataSet);
130123

@@ -133,27 +126,31 @@ public void run(){
133126
System.out.println("" + train.getError() * 1000);
134127
}
135128

136-
for (int i=0; i<percentChangeWindow.size() - INPUT_NEURONS; i += INPUT_NEURONS){
129+
// Test the network
130+
for (int i=0; i<percentChangeWindow.size() - INPUT_NEURONS - OUTPUT_NEURONS; i++){
137131
MLData input = new BasicMLData(ArrayTools.getDoubleArray(percentChangeWindow.subList(i, i + INPUT_NEURONS)));
138-
MLData ideal = new BasicMLData(ArrayTools.getDoubleArray(percentChangeWindow.subList(i + INPUT_NEURONS + IDEAL_OFFSET, i + INPUT_NEURONS + OUTPUT_NEURONS + IDEAL_OFFSET)));
132+
MLData ideal = new BasicMLData(ArrayTools.getDoubleArray(percentChangeWindow.subList(i + INPUT_NEURONS, i + INPUT_NEURONS + OUTPUT_NEURONS)));
139133
MLData computed = network.compute(input);
140134

141135
for (int c=0; c<OUTPUT_POINTS; c++){
142136
Co.println("--> c: " + c);
143-
Co.println("--> Computed, ideal: " + computed.getData(c+0) + " -> " + ideal.getData(c+0));
144-
Co.println("--> Computed, ideal: " + computed.getData(c+1) + " -> " + ideal.getData(c+1));
145-
Co.println("--> Computed, ideal: " + computed.getData(c+2) + " -> " + ideal.getData(c+2));
146-
Co.println("--> Computed, ideal: " + computed.getData(c+3) + " -> " + ideal.getData(c+3));
137+
for (int d=0; d<OUTPUT_POINT_SIZE; d++){
138+
Co.println("--> Computed, ideal: " + computed.getData(c+d) + " -> " + ideal.getData(c+d));
139+
}
147140
}
148141
}
149142
}
150143

144+
public void getPercentChange(ArrayList<Double> percentChangeWindow, int toIndex){
145+
146+
}
147+
151148
public BasicNetwork getMLNetwork(int inputSize, int outputSize){
152149
FeedForwardPattern pattern = new FeedForwardPattern();
153150
pattern.setInputNeurons(inputSize);
154151
pattern.addHiddenLayer(inputSize/2);
155152
pattern.addHiddenLayer(inputSize/3);
156-
pattern.addHiddenLayer(inputSize/4);
153+
pattern.addHiddenLayer(outputSize*2);
157154
pattern.setOutputNeurons(outputSize);
158155
pattern.setActivationFunction(activationFunction);
159156
return (BasicNetwork) pattern.generate();

src/com/autoStock/backtest/BacktestScoreProvider.java

+7-4
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@ public static double getScore(BacktestEvaluation backtestEvaluation, boolean all
1313
double score = 0;
1414

1515
// score = getScoreOnlyYield(backtestEvaluation);
16-
score = getScoreDoDYield(backtestEvaluation);
17-
// score = getScorePerTrans(backtestEvaluation);
16+
// score = getScoreDoDYield(backtestEvaluation);
17+
score = getScorePerTrans(backtestEvaluation);
1818

1919
if (allowNegativeScore){return score;}
2020
else {return score > 0 ? score : 0;}
@@ -27,10 +27,13 @@ private static double getScorePerTrans(BacktestEvaluation backtestEvaluation){
2727

2828
for (Pair<Date, Double> pair : backtestEvaluation.transactionDetails.listOfTransactionYield){
2929
score += pair.second;
30-
if (pair.second < 0){penalty++;}
30+
31+
if (pair.second < 0){
32+
penalty++;
33+
}
3134
}
3235

33-
score /= penalty;
36+
score /= (penalty /2);
3437

3538
return score;
3639
}

src/com/autoStock/backtest/encog/EncogBacktestContainer.java

+11-8
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,8 @@
4747
* @author Kevin Kowalewski
4848
*
4949
*/
50-
public class EncogBacktestContainer implements StrategyOptionsOverride {
50+
public class EncogBacktestContainer {
51+
private static boolean USE_SO_OVERRIDE = false;
5152
public DummyAlgorithm algorithm;
5253
public Symbol symbol;
5354
public Exchange exchange;
@@ -90,11 +91,18 @@ public void runBacktest(){
9091

9192
Co.println("OK!");
9293

93-
trainEncogSignal.execute(BacktestEvaluationReader.getPrecomputedModel(exchange, symbol, this), bestResult);
94+
StrategyOptionsOverride strategyOptionsOverride = new StrategyOptionsOverride() {
95+
@Override
96+
public void override(StrategyOptions strategyOptions) {
97+
98+
}
99+
};
100+
101+
trainEncogSignal.execute(BacktestEvaluationReader.getPrecomputedModel(exchange, symbol, USE_SO_OVERRIDE ? strategyOptionsOverride : null), bestResult);
94102
trainEncogSignal.getTrainer().saveNetwork();
95103

96104
SingleBacktest singleBacktest = new SingleBacktest(historicalData, AlgorithmMode.mode_backtest_single);
97-
singleBacktest.remodel(BacktestEvaluationReader.getPrecomputedModel(exchange, symbol, this));
105+
singleBacktest.remodel(BacktestEvaluationReader.getPrecomputedModel(exchange, symbol, USE_SO_OVERRIDE ? strategyOptionsOverride : null));
98106
singleBacktest.selfPopulateBacktestData();
99107
singleBacktest.runBacktest();
100108
Co.print(new BacktestEvaluationBuilder().buildEvaluation(singleBacktest.backtestContainer).toString());
@@ -107,9 +115,4 @@ public void runBacktest(){
107115
// BacktestEvaluation backtestEvaluationOutOfSample = new BacktestEvaluationBuilder().buildEvaluation(singleBacktest.backtestContainer);
108116
// Co.println("\n\n Out of sample: " + dateOutOfSample + ", " + backtestEvaluationOutOfSample.percentYield);
109117
}
110-
111-
@Override
112-
public void override(StrategyOptions strategyOptions) {
113-
114-
}
115118
}

src/com/autoStock/backtest/encog/TrainEncogBase.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ public TrainEncogBase(CalculateScore calculateScore, String networkName){
2929

3030
public boolean networkExists() {
3131
if (this instanceof TrainEncogNetworkOfBasic){
32-
return encogNetworkProvider.getNeatNetwork(networkName) != null;
32+
return encogNetworkProvider.getBasicNetwork(networkName) != null;
3333
}else if (this instanceof TrainEncogNetworkOfNeat){
3434
return encogNetworkProvider.getNeatNetwork(networkName) != null;
3535
}

src/com/autoStock/backtest/encog/TrainEncogNetworkOfBasic.java

-1
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,6 @@ public void train(int count, double score){
4343
for (int i = 0; i < count; i++) {
4444
train.iteration();
4545
Co.println("--> Training... " + i + ", " + MathTools.round(train.getError()));
46-
4746
bestScore = Math.max(train.getError(), bestScore);
4847
}
4948

src/com/autoStock/backtest/encog/TrainEncogSignal.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
*
1313
*/
1414
public class TrainEncogSignal {
15-
public static final int TRAINING_ITERATIONS = 30;
15+
public static final int TRAINING_ITERATIONS = 10;
1616
private boolean saveNetwork;
1717
private HistoricalData historicalData;
1818
private EncogScoreProvider encogScoreProvider = new EncogScoreProvider();

src/com/autoStock/backtest/watchmaker/WMAdjustmentProvider.java

+3-2
Original file line numberDiff line numberDiff line change
@@ -53,8 +53,9 @@ public ArrayList<AdjustmentBase> getListOfAdjustmentBase(AlgorithmBase algorithm
5353
//Stop Loss & Profit Drawdown
5454
// listOfAdjustmentBase.add(new AdjustmentOfBasicDouble("SO maxStopLossPercent", algorithmBase.strategyBase.strategyOptions.maxStopLossPercent, new IterableOfDouble(-0.25, 0, 0.01)));
5555
// listOfAdjustmentBase.add(new AdjustmentOfBasicDouble("SO maxProfitDrawdownPercent", algorithmBase.strategyBase.strategyOptions.maxProfitDrawdownPercent, new IterableOfDouble(-0.25, 0, 0.01)));
56-
// listOfAdjustmentBase.add(new AdjustmentOfBasicInteger("SO maxProfitTime", algorithmBase.strategyBase.strategyOptions.maxPositionProfitTime, new IterableOfInteger(0, 45, 1)));
57-
// listOfAdjustmentBase.add(new AdjustmentOfBasicDouble("SO maxProfitTimeYield", algorithmBase.strategyBase.strategyOptions.maxPositionProfitTimeMinYield, new IterableOfDouble(0, 1.0, 0.10)));
56+
// listOfAdjustmentBase.add(new AdjustmentOfBasicInteger("SO maxTimeAtProfit", algorithmBase.strategyBase.strategyOptions.maxPositionTimeAtProfit, new IterableOfInteger(0, 45, 1)));
57+
// listOfAdjustmentBase.add(new AdjustmentOfBasicInteger("SO maxTimeAtLoss", algorithmBase.strategyBase.strategyOptions.maxPositionTimeAtProfit, new IterableOfInteger(0, 45, 1)));
58+
// listOfAdjustmentBase.add(new AdjustmentOfBasicDouble("SO minTimeAtProfitYield", algorithmBase.strategyBase.strategyOptions.minPositionTimeAtProfitYield, new IterableOfDouble(0, 1.0, 0.10)));
5859

5960
//Reentry
6061
// listOfAdjustmentBase.add(new AdjustmentOfBasicInteger("SO intervalForReentryMins", algorithmBase.strategyBase.strategyOptions.intervalForReentryMins, new IterableOfInteger(1, 15, 1)));

0 commit comments

Comments
 (0)