/// <summary> /// Resets this indicator to its initial state /// </summary> public override void Reset() { base.Reset(); ShortAverage.Reset(); MediumAverage.Reset(); LongAverage.Reset(); }
/// <summary> /// Copmutes the next value for this indicator from the given state. /// </summary> /// <param name="input">The input value to this indicator on this time step</param> /// <returns>A new value for this indicator</returns> protected override decimal ComputeNextValue(IndicatorDataPoint input) { ShortAverage.Update(input); MediumAverage.Update(input); LongAverage.Update(input); return(LongAverage.Current.Value - MediumAverage.Current.Value + ShortAverage.Current.Value); }
} // end CheckSolution function /******************************************************* * SetAverageSolutionTime function * * Arguments: (0): * * Return Type: void * Use Case: Sets the AverageLabel with avgTime, recordTime, and totalCompleted ******************************************************/ private void SetAverageSolutionTime() { StringBuilder sb = new StringBuilder("Average Solution Time: "); int amount = 0, recordTime = 0; switch (DifficultyBox.SelectedItem) { case "Easy": sb.Append(EasyAverage.ToString("T")); amount = GetCompletedAmount(easyPuzzles); recordTime = GetRecordTime(easyPuzzles); break; case "Medium": sb.Append(MediumAverage.ToString("T")); amount = GetCompletedAmount(mediumPuzzles); recordTime = GetRecordTime(mediumPuzzles); break; case "Hard": sb.Append(HardAverage.ToString("T")); amount = GetCompletedAmount(hardPuzzles); recordTime = GetRecordTime(hardPuzzles); break; default: sb.Append("\t Set Average Error!"); break; } // end switch DifficultyBox.SelectedItem TimeSpan formattedRecord = TimeSpan.FromSeconds(recordTime); sb.Append(" || Total Completed: " + amount); sb.Append(" || Record Time: " + formattedRecord.ToString("T")); AvgLabel.Text = sb.ToString(); } // end SetAverageSolutionTime function