Index: branches/HeuristicLab.Problems.DataAnalysis.Trading/HeuristicLab.Problems.DataAnalysis.Trading/3.4/Calculators/OnlineProfitCalculator.cs
===================================================================
--- branches/HeuristicLab.Problems.DataAnalysis.Trading/HeuristicLab.Problems.DataAnalysis.Trading/3.4/Calculators/OnlineProfitCalculator.cs	(revision 9743)
+++ branches/HeuristicLab.Problems.DataAnalysis.Trading/HeuristicLab.Problems.DataAnalysis.Trading/3.4/Calculators/OnlineProfitCalculator.cs	(revision 9744)
@@ -22,4 +22,5 @@
 using System;
 using System.Collections.Generic;
+using System.Linq;
 using HeuristicLab.Common;
 
@@ -28,5 +29,5 @@
 
     private int p;
-    private double transactionCost;
+    private readonly double transactionCost;
     private int c;
     private double sum;
@@ -63,6 +64,8 @@
         } else if (p == 0 && signal.IsAlmost(1)) {
           p = 1;
+          iterationReturn = -transactionCost;
         } else if (p == 0 && signal.IsAlmost(-1)) {
           p = -1;
+          iterationReturn = -transactionCost;
         } else if (p == 1 && signal.IsAlmost(1)) {
           iterationReturn = actualReturn;
@@ -89,7 +92,13 @@
 
     public static double Calculate(IEnumerable<double> returns, IEnumerable<double> signals, double transactionCost, out OnlineCalculatorError errorState) {
+      errorState = OnlineCalculatorError.None;
+      return GetProfits(returns, signals, transactionCost).Sum();
+    }
+
+    public static IEnumerable<double> GetProfits(IEnumerable<double> returns, IEnumerable<double> signals, double transactionCost) {
+      var calc = new OnlineProfitCalculator(transactionCost);
+
       IEnumerator<double> returnsEnumerator = returns.GetEnumerator();
       IEnumerator<double> signalsEnumerator = signals.GetEnumerator();
-      OnlineProfitCalculator calculator = new OnlineProfitCalculator(transactionCost);
 
       // always move forward both enumerators (do not use short-circuit evaluation!)
@@ -97,5 +106,10 @@
         double signal = signalsEnumerator.Current;
         double @return = returnsEnumerator.Current;
-        calculator.Add(@return, signal);
+
+        double prevTotalProfit = calc.Profit;
+        calc.Add(@return, signal);
+        double curTotalProfit = calc.Profit;
+
+        yield return curTotalProfit - prevTotalProfit;
       }
 
@@ -103,7 +117,4 @@
       if (returnsEnumerator.MoveNext() || signalsEnumerator.MoveNext()) {
         throw new ArgumentException("Number of elements in first and second enumeration doesn't match.");
-      } else {
-        errorState = calculator.ErrorState;
-        return calculator.Profit;
       }
     }
Index: branches/HeuristicLab.Problems.DataAnalysis.Trading/HeuristicLab.Problems.DataAnalysis.Trading/3.4/Calculators/OnlineSharpeRatioCalculator.cs
===================================================================
--- branches/HeuristicLab.Problems.DataAnalysis.Trading/HeuristicLab.Problems.DataAnalysis.Trading/3.4/Calculators/OnlineSharpeRatioCalculator.cs	(revision 9743)
+++ branches/HeuristicLab.Problems.DataAnalysis.Trading/HeuristicLab.Problems.DataAnalysis.Trading/3.4/Calculators/OnlineSharpeRatioCalculator.cs	(revision 9744)
@@ -22,13 +22,11 @@
 using System;
 using System.Collections.Generic;
-using HeuristicLab.Common;
 
 namespace HeuristicLab.Problems.DataAnalysis.Trading {
   public class OnlineSharpeRatioCalculator : IOnlineCalculator {
 
-    private int p;
-    private double transactionCost;
-    private int c;
     private OnlineMeanAndVarianceCalculator meanAndVarianceCalculator;
+    private OnlineProfitCalculator profitCalculator;
+
     public double SharpeRatio {
       get {
@@ -40,6 +38,6 @@
 
     public OnlineSharpeRatioCalculator(double transactionCost) {
-      this.transactionCost = transactionCost;
       this.meanAndVarianceCalculator = new OnlineMeanAndVarianceCalculator();
+      this.profitCalculator = new OnlineProfitCalculator(transactionCost);
       Reset();
     }
@@ -48,5 +46,5 @@
     public OnlineCalculatorError ErrorState {
       get {
-        return meanAndVarianceCalculator.MeanErrorState | meanAndVarianceCalculator.VarianceErrorState;
+        return meanAndVarianceCalculator.MeanErrorState | meanAndVarianceCalculator.VarianceErrorState | profitCalculator.ErrorState;
       }
     }
@@ -55,41 +53,14 @@
     }
     public void Reset() {
-      p = 0;
-      c = 0;
+      profitCalculator.Reset();
       meanAndVarianceCalculator.Reset();
     }
 
     public void Add(double actualReturn, double signal) {
-      double iterationReturn = 0.0;
-      if (c == 0) {
-        p = (int)signal;
-        iterationReturn = 0;
-        c++;
-      } else {
-        if (p == 0 && signal.IsAlmost(0)) {
-        } else if (p == 0 && signal.IsAlmost(1)) {
-          p = 1;
-        } else if (p == 0 && signal.IsAlmost(-1)) {
-          p = -1;
-        } else if (p == 1 && signal.IsAlmost(1)) {
-          iterationReturn = actualReturn;
-        } else if (p == 1 && signal.IsAlmost(0)) {
-          iterationReturn = actualReturn - transactionCost;
-          p = 0;
-        } else if (p == 1 && signal.IsAlmost(-1)) {
-          iterationReturn = actualReturn - transactionCost;
-          p = -1;
-        } else if (p == -1 && signal.IsAlmost(-1)) {
-          iterationReturn = -actualReturn;
-        } else if (p == -1 && signal.IsAlmost(0)) {
-          iterationReturn = -actualReturn - transactionCost;
-          p = 0;
-        } else if (p == -1 && signal.IsAlmost(1)) {
-          iterationReturn = -actualReturn - transactionCost;
-          p = 1;
-        }
-        c++;
-      }
-      meanAndVarianceCalculator.Add(iterationReturn);
+      double prevTotalProfit = profitCalculator.Profit;
+      profitCalculator.Add(actualReturn, signal);
+      double curTotalProfit = profitCalculator.Profit;
+
+      meanAndVarianceCalculator.Add(curTotalProfit - prevTotalProfit);
     }
     #endregion
Index: branches/HeuristicLab.Problems.DataAnalysis.Trading/HeuristicLab.Problems.DataAnalysis.Trading/3.4/HeuristicLab.Problems.DataAnalysis.Trading-3.4.csproj
===================================================================
--- branches/HeuristicLab.Problems.DataAnalysis.Trading/HeuristicLab.Problems.DataAnalysis.Trading/3.4/HeuristicLab.Problems.DataAnalysis.Trading-3.4.csproj	(revision 9743)
+++ branches/HeuristicLab.Problems.DataAnalysis.Trading/HeuristicLab.Problems.DataAnalysis.Trading/3.4/HeuristicLab.Problems.DataAnalysis.Trading-3.4.csproj	(revision 9744)
@@ -161,5 +161,4 @@
     <Compile Include="Calculators\OnlineProfitCalculator.cs" />
     <Compile Include="HeuristicLabProblemsDataAnalysisTradingPlugin.cs" />
-    <Compile Include="Interfaces\ITradingEnsembleModel.cs" />
     <Compile Include="Interfaces\ITradingModel.cs" />
     <Compile Include="Interfaces\ITradingProblem.cs" />
@@ -171,4 +170,5 @@
     <Compile Include="Symbolic\Interfaces\ISymbolicTradingSingleObjectiveEvaluator.cs" />
     <Compile Include="Symbolic\Interfaces\ISymbolicTradingSolution.cs" />
+    <Compile Include="Symbolic\SingleObjective\ProfitEvaluator.cs" />
     <Compile Include="Symbolic\SingleObjective\SymbolicTradingSingleObjectiveEvaluator.cs" />
     <Compile Include="Symbolic\SingleObjective\SymbolicTradingSingleObjectiveProblem.cs" />
@@ -184,5 +184,4 @@
       <DependentUpon>SymbolicTradingSolutionView.cs</DependentUpon>
     </Compile>
-    <Compile Include="TradingEnsembleModel.cs" />
     <Compile Include="TradingProblem.cs" />
     <Compile Include="TradingProblemData.cs" />
Index: branches/HeuristicLab.Problems.DataAnalysis.Trading/HeuristicLab.Problems.DataAnalysis.Trading/3.4/Interfaces/ITradingEnsembleModel.cs
===================================================================
--- branches/HeuristicLab.Problems.DataAnalysis.Trading/HeuristicLab.Problems.DataAnalysis.Trading/3.4/Interfaces/ITradingEnsembleModel.cs	(revision 9743)
+++ 	(revision )
@@ -1,28 +1,0 @@
-﻿#region License Information
-/* HeuristicLab
- * Copyright (C) 2002-2013 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
- *
- * This file is part of HeuristicLab.
- *
- * HeuristicLab is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * HeuristicLab is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with HeuristicLab. If not, see <http://www.gnu.org/licenses/>.
- */
-#endregion
-
-using System.Collections.Generic;
-namespace HeuristicLab.Problems.DataAnalysis.Trading {
-  public interface ITradingEnsembleModel : ITradingModel {
-    IEnumerable<ITradingModel> Models { get; }
-    IEnumerable<IEnumerable<double>> GetSignalVectors(Dataset dataset, IEnumerable<int> rows);
-  }
-}
Index: branches/HeuristicLab.Problems.DataAnalysis.Trading/HeuristicLab.Problems.DataAnalysis.Trading/3.4/Symbolic/SingleObjective/ProfitEvaluator.cs
===================================================================
--- branches/HeuristicLab.Problems.DataAnalysis.Trading/HeuristicLab.Problems.DataAnalysis.Trading/3.4/Symbolic/SingleObjective/ProfitEvaluator.cs	(revision 9744)
+++ branches/HeuristicLab.Problems.DataAnalysis.Trading/HeuristicLab.Problems.DataAnalysis.Trading/3.4/Symbolic/SingleObjective/ProfitEvaluator.cs	(revision 9744)
@@ -0,0 +1,80 @@
+﻿#region License Information
+/* HeuristicLab
+ * Copyright (C) 2002-2013 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
+ *
+ * This file is part of HeuristicLab.
+ *
+ * HeuristicLab is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * HeuristicLab is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with HeuristicLab. If not, see <http://www.gnu.org/licenses/>.
+ */
+#endregion
+
+using System.Collections.Generic;
+using System.Linq;
+using HeuristicLab.Common;
+using HeuristicLab.Core;
+using HeuristicLab.Data;
+using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding;
+using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
+using HeuristicLab.Problems.DataAnalysis.Trading;
+
+namespace HeuristicLab.Problems.DataAnalysis.Symbolic.Trading {
+  [Item("Profit Evaluator", "")]
+  [StorableClass]
+  public class ProfitEvaluator : SymbolicTradingSingleObjectiveEvaluator {
+    [StorableConstructor]
+    protected ProfitEvaluator(bool deserializing) : base(deserializing) { }
+    protected ProfitEvaluator(ProfitEvaluator original, Cloner cloner)
+      : base(original, cloner) {
+    }
+    public ProfitEvaluator()
+      : base() {
+    }
+
+    public override IDeepCloneable Clone(Cloner cloner) {
+      return new ProfitEvaluator(this, cloner);
+    }
+
+    public override bool Maximization { get { return true; } }
+
+    public override IOperation Apply() {
+      var solution = SymbolicExpressionTreeParameter.ActualValue;
+      IEnumerable<int> rows = GenerateRowsToEvaluate();
+
+      double quality = Calculate(SymbolicDataAnalysisTreeInterpreterParameter.ActualValue, solution, ProblemDataParameter.ActualValue, rows);
+      QualityParameter.ActualValue = new DoubleValue(quality);
+
+      return base.Apply();
+    }
+
+    public static double Calculate(ISymbolicDataAnalysisExpressionTreeInterpreter interpreter, ISymbolicExpressionTree solution, ITradingProblemData problemData, IEnumerable<int> rows) {
+      IEnumerable<double> signals = GetSignals(interpreter, solution, problemData.Dataset, rows);
+      IEnumerable<double> returns = problemData.Dataset.GetDoubleValues(problemData.PriceVariable, rows);
+      OnlineCalculatorError errorState;
+      double profit = OnlineProfitCalculator.Calculate(returns, signals, problemData.TransactionCosts, out errorState);
+      if (errorState != OnlineCalculatorError.None) return 0.0;
+      else return profit;
+    }
+
+    private static IEnumerable<double> GetSignals(ISymbolicDataAnalysisExpressionTreeInterpreter interpreter, ISymbolicExpressionTree solution, Dataset dataset, IEnumerable<int> rows) {
+      return SymbolicTradingModel.GetSignals(interpreter.GetSymbolicExpressionTreeValues(solution, dataset, rows));
+    }
+
+    public override double Evaluate(IExecutionContext context, ISymbolicExpressionTree tree, ITradingProblemData problemData, IEnumerable<int> rows) {
+      SymbolicDataAnalysisTreeInterpreterParameter.ExecutionContext = context;
+      double profit = Calculate(SymbolicDataAnalysisTreeInterpreterParameter.ActualValue, tree, problemData, rows);
+      SymbolicDataAnalysisTreeInterpreterParameter.ExecutionContext = null;
+      return profit;
+    }
+  }
+}
Index: branches/HeuristicLab.Problems.DataAnalysis.Trading/HeuristicLab.Problems.DataAnalysis.Trading/3.4/Symbolic/SingleObjective/SymbolicTradingSingleObjectiveSharpeRatioEvaluator.cs
===================================================================
--- branches/HeuristicLab.Problems.DataAnalysis.Trading/HeuristicLab.Problems.DataAnalysis.Trading/3.4/Symbolic/SingleObjective/SymbolicTradingSingleObjectiveSharpeRatioEvaluator.cs	(revision 9743)
+++ branches/HeuristicLab.Problems.DataAnalysis.Trading/HeuristicLab.Problems.DataAnalysis.Trading/3.4/Symbolic/SingleObjective/SymbolicTradingSingleObjectiveSharpeRatioEvaluator.cs	(revision 9744)
@@ -68,15 +68,11 @@
 
     private static IEnumerable<double> GetSignals(ISymbolicDataAnalysisExpressionTreeInterpreter interpreter, ISymbolicExpressionTree solution, Dataset dataset, IEnumerable<int> rows) {
-      return from x in interpreter.GetSymbolicExpressionTreeValues(solution, dataset, rows)
-             select x > 0.5 ? 1.0 : x < 0.5 ? -1.0 : 0.0;
+      return SymbolicTradingModel.GetSignals(interpreter.GetSymbolicExpressionTreeValues(solution, dataset, rows));
     }
 
     public override double Evaluate(IExecutionContext context, ISymbolicExpressionTree tree, ITradingProblemData problemData, IEnumerable<int> rows) {
       SymbolicDataAnalysisTreeInterpreterParameter.ExecutionContext = context;
-
       double sharpRatio = Calculate(SymbolicDataAnalysisTreeInterpreterParameter.ActualValue, tree, problemData, rows);
-
       SymbolicDataAnalysisTreeInterpreterParameter.ExecutionContext = null;
-
       return sharpRatio;
     }
Index: branches/HeuristicLab.Problems.DataAnalysis.Trading/HeuristicLab.Problems.DataAnalysis.Trading/3.4/Symbolic/SymbolicTradingModel.cs
===================================================================
--- branches/HeuristicLab.Problems.DataAnalysis.Trading/HeuristicLab.Problems.DataAnalysis.Trading/3.4/Symbolic/SymbolicTradingModel.cs	(revision 9743)
+++ branches/HeuristicLab.Problems.DataAnalysis.Trading/HeuristicLab.Problems.DataAnalysis.Trading/3.4/Symbolic/SymbolicTradingModel.cs	(revision 9744)
@@ -49,6 +49,26 @@
       ISymbolicDataAnalysisExpressionTreeInterpreter interpreter = Interpreter;
       ISymbolicExpressionTree tree = SymbolicExpressionTree;
-      return from x in interpreter.GetSymbolicExpressionTreeValues(tree, dataset, rows)
-             select x > 0.66 ? 1.0 : x < 0.33 ? -1.0 : 0.0;
+      return GetSignals(interpreter.GetSymbolicExpressionTreeValues(tree, dataset, rows));
+    }
+
+    // Transforms an enumerable of real values to an enumerable of trading signals (buy(1) / hold(0) / sell(-1))
+    public static IEnumerable<double> GetSignals(IEnumerable<double> xs) {
+      // two iterations over xs
+      // 1) determine min / max to calculate the mid-range value
+      // 2) range is split into three thirds
+      double max = double.NegativeInfinity;
+      double min = double.PositiveInfinity;
+      foreach (var x in xs) {
+        if (x > max) max = x;
+        if (x < min) min = x;
+      }
+      if (double.IsInfinity(max) || double.IsNaN(max) || double.IsInfinity(min) || double.IsNaN(min))
+        return xs.Select(x => 0.0);
+
+      double range = (max - min);
+      double midRange = range / 2.0 + min;
+      double offset = range / 6.0;
+      return from x in xs
+             select x > midRange + offset ? 1.0 : x < midRange - offset ? -1.0 : 0.0;
     }
   }
Index: branches/HeuristicLab.Problems.DataAnalysis.Trading/HeuristicLab.Problems.DataAnalysis.Trading/3.4/Symbolic/SymbolicTradingSolution.cs
===================================================================
--- branches/HeuristicLab.Problems.DataAnalysis.Trading/HeuristicLab.Problems.DataAnalysis.Trading/3.4/Symbolic/SymbolicTradingSolution.cs	(revision 9743)
+++ branches/HeuristicLab.Problems.DataAnalysis.Trading/HeuristicLab.Problems.DataAnalysis.Trading/3.4/Symbolic/SymbolicTradingSolution.cs	(revision 9744)
@@ -32,5 +32,8 @@
   /// </summary>
   [StorableClass]
-  [Item(Name = "SymbolicTradingSolution", Description = "Represents a symbolic trading solution (model + data) and attributes of the solution like accuracy and complexity.")]
+  [Item(Name = "SymbolicTradingSolution",
+    Description =
+      "Represents a symbolic trading solution (model + data) and attributes of the solution like accuracy and complexity."
+    )]
   public sealed class SymbolicTradingSolution : TradingSolution, ISymbolicTradingSolution {
     private const string ModelLengthResultName = "Model Length";
@@ -41,7 +44,9 @@
       set { base.Model = value; }
     }
+
     ISymbolicDataAnalysisModel ISymbolicDataAnalysisSolution.Model {
       get { return (ISymbolicDataAnalysisModel)base.Model; }
     }
+
     public int ModelLength {
       get { return ((IntValue)this[ModelLengthResultName].Value).Value; }
@@ -55,8 +60,12 @@
 
     [StorableConstructor]
-    private SymbolicTradingSolution(bool deserializing) : base(deserializing) { }
+    private SymbolicTradingSolution(bool deserializing)
+      : base(deserializing) {
+    }
+
     private SymbolicTradingSolution(SymbolicTradingSolution original, Cloner cloner)
       : base(original, cloner) {
     }
+
     public SymbolicTradingSolution(ISymbolicTradingModel model, ITradingProblemData problemData)
       : base(model, problemData) {
@@ -75,5 +84,10 @@
     }
 
-    private new void RecalculateResults() {
+    protected override void RecalculateResults() {
+      base.RecalculateResults();
+      CalculateResults();
+    }
+
+    private void CalculateResults() {
       ModelLength = Model.SymbolicExpressionTree.Length;
       ModelDepth = Model.SymbolicExpressionTree.Depth;
Index: branches/HeuristicLab.Problems.DataAnalysis.Trading/HeuristicLab.Problems.DataAnalysis.Trading/3.4/TradingEnsembleModel.cs
===================================================================
--- branches/HeuristicLab.Problems.DataAnalysis.Trading/HeuristicLab.Problems.DataAnalysis.Trading/3.4/TradingEnsembleModel.cs	(revision 9743)
+++ 	(revision )
@@ -1,81 +1,0 @@
-#region License Information
-/* HeuristicLab
- * Copyright (C) 2002-2013 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
- *
- * This file is part of HeuristicLab.
- *
- * HeuristicLab is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * HeuristicLab is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with HeuristicLab. If not, see <http://www.gnu.org/licenses/>.
- */
-#endregion
-
-using System.Collections.Generic;
-using System.Linq;
-using HeuristicLab.Common;
-using HeuristicLab.Core;
-using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
-
-namespace HeuristicLab.Problems.DataAnalysis.Trading {
-  /// <summary>
-  /// Represents trading solutions that contain an ensemble of multiple trading models
-  /// </summary>
-  [StorableClass]
-  [Item("TradingEnsembleModel", "A trading model that contains an ensemble of multiple trading models")]
-  public class TradingEnsembleModel : NamedItem, ITradingEnsembleModel {
-
-    [Storable]
-    private List<ITradingModel> models;
-    public IEnumerable<ITradingModel> Models {
-      get { return new List<ITradingModel>(models); }
-    }
-    [StorableConstructor]
-    protected TradingEnsembleModel(bool deserializing) : base(deserializing) { }
-    protected TradingEnsembleModel(TradingEnsembleModel original, Cloner cloner)
-      : base(original, cloner) {
-      this.models = original.Models.Select(m => cloner.Clone(m)).ToList();
-    }
-    public TradingEnsembleModel(IEnumerable<ITradingModel> models)
-      : base() {
-      this.name = ItemName;
-      this.description = ItemDescription;
-      this.models = new List<ITradingModel>(models);
-    }
-
-    public override IDeepCloneable Clone(Cloner cloner) {
-      return new TradingEnsembleModel(this, cloner);
-    }
-
-    #region ITradingEnsembleModel Members
-
-    public IEnumerable<IEnumerable<double>> GetSignalVectors(Dataset dataset, IEnumerable<int> rows) {
-      var signalEnumerators = (from model in models
-                               select model.GetSignals(dataset, rows).GetEnumerator())
-                                       .ToList();
-
-      while (signalEnumerators.All(en => en.MoveNext())) {
-        yield return from enumerator in signalEnumerators
-                     select enumerator.Current;
-      }
-    }
-
-    #endregion
-
-    #region ITradingModel Members
-
-    public IEnumerable<double> GetSignals(Dataset dataset, IEnumerable<int> rows) {
-      throw new System.NotImplementedException();
-    }
-
-    #endregion
-  }
-}
Index: branches/HeuristicLab.Problems.DataAnalysis.Trading/HeuristicLab.Problems.DataAnalysis.Trading/3.4/TradingProblemData.cs
===================================================================
--- branches/HeuristicLab.Problems.DataAnalysis.Trading/HeuristicLab.Problems.DataAnalysis.Trading/3.4/TradingProblemData.cs	(revision 9743)
+++ branches/HeuristicLab.Problems.DataAnalysis.Trading/HeuristicLab.Problems.DataAnalysis.Trading/3.4/TradingProblemData.cs	(revision 9744)
@@ -37,5 +37,5 @@
 
     #region default data
-    private static double[,] audInUsd = new double[,] {
+    private static double[,] audInUsdDiff = new double[,] {
     { 0.0000},
     { 0.0003},
@@ -1589,5 +1589,5 @@
 
     static TradingProblemData() {
-      defaultDataset = new Dataset(new string[] { "AUD" }, audInUsd);
+      defaultDataset = new Dataset(new string[] { "AUD" }, audInUsdDiff);
       defaultDataset.Name = "AUD in USD";
       defaultDataset.Description = "Price of Australian dollar in US dollar.";
@@ -1630,5 +1630,5 @@
       : base(dataset, allowedInputVariables) {
       var variables = InputVariables.Select(x => x.AsReadOnly()).ToList();
-      Parameters.Add(new ConstrainedValueParameter<StringValue>(PriceVariableParameterName, new ItemSet<StringValue>(variables), variables.Where(x => x.Value == targetVariable).First()));
+      Parameters.Add(new ConstrainedValueParameter<StringValue>(PriceVariableParameterName, new ItemSet<StringValue>(variables), variables.First(x => x.Value == targetVariable)));
       Parameters.Add(new FixedValueParameter<DoubleValue>(TransactionCostsParameterName, "The absolute cost of on buy/sell transaction (assumed to be constant and independent of transaction volume)", new DoubleValue(0.0002)));
       RegisterParameterEvents();
@@ -1646,21 +1646,4 @@
       OnChanged();
     }
-
-    
-
-
-    //#region Import from file
-    //public static TradingProblemData ImportFromFile(string fileName) {
-    //  TableFileParser csvFileParser = new TableFileParser();
-    //  csvFileParser.Parse(fileName);
-
-    //  Dataset dataset = new Dataset(csvFileParser.VariableNames, csvFileParser.Values);
-    //  dataset.Name = Path.GetFileName(fileName);
-
-    //  TradingProblemData problemData = new TradingProblemData(dataset, dataset.VariableNames.Skip(1), dataset.VariableNames.First());
-    //  problemData.Name = "Data imported from " + Path.GetFileName(fileName);
-    //  return problemData;
-    //}
-    //#endregion
   }
 }
Index: branches/HeuristicLab.Problems.DataAnalysis.Trading/HeuristicLab.Problems.DataAnalysis.Trading/3.4/TradingSolution.cs
===================================================================
--- branches/HeuristicLab.Problems.DataAnalysis.Trading/HeuristicLab.Problems.DataAnalysis.Trading/3.4/TradingSolution.cs	(revision 9743)
+++ branches/HeuristicLab.Problems.DataAnalysis.Trading/HeuristicLab.Problems.DataAnalysis.Trading/3.4/TradingSolution.cs	(revision 9744)
@@ -78,6 +78,4 @@
       Add(new Result(TrainingProfitResultName, "Profit of the model on the training partition", new DoubleValue()));
       Add(new Result(TestProfitResultName, "Profit of the model on the test partition", new DoubleValue()));
-
-      RecalculateResults();
     }
 
@@ -94,4 +92,8 @@
 
     protected override void RecalculateResults() {
+      CalculateTradingResults();
+    }
+
+    protected void CalculateTradingResults() {
       double[] trainingSignals = TrainingSignals.ToArray(); // cache values
       IEnumerable<double> trainingReturns = ProblemData.Dataset.GetDoubleValues(ProblemData.PriceVariable, ProblemData.TrainingIndices);
Index: branches/HeuristicLab.Problems.DataAnalysis.Trading/HeuristicLab.Problems.DataAnalysis.Trading/3.4/Views/TradingSolutionLineChartView.cs
===================================================================
--- branches/HeuristicLab.Problems.DataAnalysis.Trading/HeuristicLab.Problems.DataAnalysis.Trading/3.4/Views/TradingSolutionLineChartView.cs	(revision 9743)
+++ branches/HeuristicLab.Problems.DataAnalysis.Trading/HeuristicLab.Problems.DataAnalysis.Trading/3.4/Views/TradingSolutionLineChartView.cs	(revision 9744)
@@ -25,7 +25,5 @@
 using System.Windows.Forms;
 using System.Windows.Forms.DataVisualization.Charting;
-using HeuristicLab.Common;
 using HeuristicLab.MainForm;
-using HeuristicLab.MainForm.WindowsForms;
 using HeuristicLab.Problems.DataAnalysis.Views;
 
@@ -61,10 +59,4 @@
       this.chart.Series.Clear();
       if (Content != null) {
-        //this.chart.Series.Add(PRICEVARIABLE_SERIES_NAME);
-        //this.chart.Series[PRICEVARIABLE_SERIES_NAME].LegendText = Content.ProblemData.PriceVariable;
-        //this.chart.Series[PRICEVARIABLE_SERIES_NAME].ChartType = SeriesChartType.FastLine;
-        //this.chart.Series[PRICEVARIABLE_SERIES_NAME].Points.DataBindY(Content.ProblemData.Dataset.GetVariableValues(Content.ProblemData.PriceVariable));
-
-
         this.chart.Series.Add(SIGNALS_SERIES_NAME);
         this.chart.Series[SIGNALS_SERIES_NAME].LegendText = SIGNALS_SERIES_NAME;
@@ -80,5 +72,5 @@
         this.chart.Series[PRICEVARIABLE_SERIES_NAME].Tag = Content;
 
-        IEnumerable<double> profit = GetProfits(Content.ProblemData.Dataset.GetDoubleValues(Content.ProblemData.PriceVariable), Content.Signals, Content.ProblemData.TransactionCosts);
+        IEnumerable<double> profit = OnlineProfitCalculator.GetProfits(Content.ProblemData.Dataset.GetDoubleValues(Content.ProblemData.PriceVariable), Content.Signals, Content.ProblemData.TransactionCosts);
         IEnumerable<double> accumulatedProfits = GetAccumulatedPrices(profit);
         this.chart.Series.Add(ASSET_SERIES_NAME);
@@ -89,41 +81,4 @@
 
         this.UpdateStripLines();
-
-        // UpdateCursorInterval();
-      }
-    }
-
-    private IEnumerable<double> GetProfits(IEnumerable<double> returns, IEnumerable<double> signals, double transactionCost) {
-      int p = (int)signals.First();
-      yield return 0.0;
-      foreach (var signalReturn in returns.Skip(1).Zip(signals.Skip(1), (r, s) => new { Return = r, Signal = s })) {
-        double iterationReturn = 0;
-        double signal = signalReturn.Signal;
-        double actualReturn = signalReturn.Return;
-        if (p == 0 && signal.IsAlmost(0)) {
-        } else if (p == 0 && signal.IsAlmost(1)) {
-          iterationReturn = 0;
-          p = 1;
-        } else if (p == 0 && signal.IsAlmost(-1)) {
-          iterationReturn = 0;
-          p = -1;
-        } else if (p == 1 && signal.IsAlmost(1)) {
-          iterationReturn = actualReturn;
-        } else if (p == 1 && signal.IsAlmost(0)) {
-          iterationReturn = actualReturn - transactionCost;
-          p = 0;
-        } else if (p == 1 && signal.IsAlmost(-1)) {
-          iterationReturn = actualReturn - transactionCost;
-          p = -1;
-        } else if (p == -1 && signal.IsAlmost(-1)) {
-          iterationReturn = -actualReturn;
-        } else if (p == -1 && signal.IsAlmost(0)) {
-          iterationReturn = -actualReturn - transactionCost;
-          p = 0;
-        } else if (p == -1 && signal.IsAlmost(1)) {
-          iterationReturn = -actualReturn - transactionCost;
-          p = 1;
-        }
-        yield return iterationReturn;
       }
     }
@@ -136,15 +91,4 @@
       }
     }
-
-    //private void UpdateCursorInterval() {
-    //  var estimatedValues = this.chart.Series[SIGNALS_SERIES_NAME].Points.Select(x => x.YValues[0]).DefaultIfEmpty(1.0);
-    //  var targetValues = this.chart.Series[PRICEVARIABLE_SERIES_NAME].Points.Select(x => x.YValues[0]).DefaultIfEmpty(1.0);
-    //  double estimatedValuesRange = estimatedValues.Max() - estimatedValues.Min();
-    //  double targetValuesRange = targetValues.Max() - targetValues.Min();
-    //  double interestingValuesRange = Math.Min(Math.Max(targetValuesRange, 1.0), Math.Max(estimatedValuesRange, 1.0));
-    //  double digits = (int)Math.Log10(interestingValuesRange) - 3;
-    //  double yZoomInterval = Math.Max(Math.Pow(10, digits), 10E-5);
-    //  this.chart.ChartAreas[0].CursorY.Interval = yZoomInterval;
-    //}
 
     #region events
