public void Test() { double profit = 0; int itemCount = _testSet.First().Value.Length; int actionCount = 0; List <int> rsiPeriod = _testSet.Keys.ToList(); for (int i = 0; i < itemCount; i++) { Dictionary <int, SequenceClass> preparedSequence = new(); rsiPeriod.ForEach(rsiPeriod => preparedSequence.Add(rsiPeriod, _testSet[rsiPeriod][i])); List <PredictionStruct> predictions = GetPredictions(preparedSequence); SequenceClass sequence = preparedSequence.FirstOrDefault().Value; actionCount += predictions.Count; predictions.ForEach(prediction => { OrderModel order = new( endPeriodClosePrice: sequence.EndPeriodClosePrice, order: prediction.LimitOrder, firstLow: sequence.FirstPeriodLowPrice, firstHigh: sequence.FirstPeriodHighPrice, lowestPrice: sequence.LowestPrice, highestPrice: sequence.HighestPrice, nonFirstHighestPrice: sequence.NonFirstHighestPrice, nonFirstLowestPrice: sequence.NonFirstLowestPrice); var result = order.AssessProfitFromOrder(operation: _operation, stopLoss: prediction.StopLossDistance, takeProfit: prediction.TakeProfitDistance, commission: _commission); if (result.outcome != ActionOutcome.NoAction) { profit += result.profit; } }); } IsSuccess = profit > 0; Profit = profit / actionCount; }
public static bool CheckActivation(this SequenceClass sequence, double[] weights, ParametersModel parameter) { bool returnVar = true; double[] rsiSequence = sequence.RsiSequence[^ parameter.IndicatorLastPointSequence..];