private void TestIndicator(IIndicator indicator, SlotTypes slotType, IDataSet dataSet, Random random) { indicator.Initialize(slotType); // List parameters foreach (ListParam list in indicator.IndParam.ListParam) { if (list.Enabled) { list.Index = random.Next(list.ItemList.Length); list.Text = list.ItemList[list.Index]; } } // Numeric parameters foreach (NumericParam num in indicator.IndParam.NumParam) { if (num.Enabled) { double step = Math.Pow(10, -num.Point); double minimum = num.Min; double maximum = num.Max; double value = minimum + step * random.Next((int)((maximum - minimum) / step)); num.Value = Math.Round(value, num.Point); } } indicator.Calculate(dataSet); }
private void TestIndicator(IIndicator indicator, SlotTypes slotType, IDataSet dataSet, Random random) { indicator.Initialize(slotType); // List parameters foreach (ListParam list in indicator.IndParam.ListParam) if (list.Enabled) { list.Index = random.Next(list.ItemList.Length); list.Text = list.ItemList[list.Index]; } // Numeric parameters foreach (NumericParam num in indicator.IndParam.NumParam) if (num.Enabled) { double step = Math.Pow(10, -num.Point); double minimum = num.Min; double maximum = num.Max; double value = minimum + step * random.Next((int)((maximum - minimum) / step)); num.Value = Math.Round(value, num.Point); } indicator.Calculate(dataSet); }
private void SetLogicalRules(StringBuilder sb, IIndicator indicator, SlotTypes slotType) { sb.AppendLine(); sb.AppendLine($"**Logical rules for {SlotTypeToString(slotType)} slot.**"); indicator.Initialize(slotType); indicator.IndParam.ListParam[0].ItemList.ToList() .ForEach(text => sb.AppendLine($" * {text};")); }