Fix backtests and indicators
This commit is contained in:
@@ -42,26 +42,6 @@ public class LightIndicator
|
||||
|
||||
[Id(11)] public int? CyclePeriods { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Converts a full Indicator to a LightIndicator
|
||||
/// </summary>
|
||||
public static LightIndicator BaseToLight(IndicatorBase indicatorBase)
|
||||
{
|
||||
return new LightIndicator(indicatorBase.Name, indicatorBase.Type)
|
||||
{
|
||||
SignalType = indicatorBase.SignalType,
|
||||
MinimumHistory = indicatorBase.MinimumHistory,
|
||||
Period = indicatorBase.Period,
|
||||
FastPeriods = indicatorBase.FastPeriods,
|
||||
SlowPeriods = indicatorBase.SlowPeriods,
|
||||
SignalPeriods = indicatorBase.SignalPeriods,
|
||||
Multiplier = indicatorBase.Multiplier,
|
||||
SmoothPeriods = indicatorBase.SmoothPeriods,
|
||||
StochPeriods = indicatorBase.StochPeriods,
|
||||
CyclePeriods = indicatorBase.CyclePeriods
|
||||
};
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Converts a LightIndicator back to a full Indicator
|
||||
/// </summary>
|
||||
|
||||
@@ -30,7 +30,7 @@ public class LightScenario
|
||||
{
|
||||
var lightScenario = new LightScenario(scenario.Name, scenario.LoopbackPeriod)
|
||||
{
|
||||
Indicators = scenario.Indicators?.Select(LightIndicator.BaseToLight).ToList() ??
|
||||
Indicators = scenario.Indicators?.Select(ScenarioHelpers.BaseToLight).ToList() ??
|
||||
new List<LightIndicator>()
|
||||
};
|
||||
return lightScenario;
|
||||
|
||||
@@ -103,6 +103,26 @@ public static class ScenarioHelpers
|
||||
return result;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Converts a full Indicator to a LightIndicator
|
||||
/// </summary>
|
||||
public static LightIndicator BaseToLight(IndicatorBase indicatorBase)
|
||||
{
|
||||
return new LightIndicator(indicatorBase.Name, indicatorBase.Type)
|
||||
{
|
||||
SignalType = indicatorBase.SignalType,
|
||||
MinimumHistory = indicatorBase.MinimumHistory,
|
||||
Period = indicatorBase.Period,
|
||||
FastPeriods = indicatorBase.FastPeriods,
|
||||
SlowPeriods = indicatorBase.SlowPeriods,
|
||||
SignalPeriods = indicatorBase.SignalPeriods,
|
||||
Multiplier = indicatorBase.Multiplier,
|
||||
SmoothPeriods = indicatorBase.SmoothPeriods,
|
||||
StochPeriods = indicatorBase.StochPeriods,
|
||||
CyclePeriods = indicatorBase.CyclePeriods
|
||||
};
|
||||
}
|
||||
|
||||
public static IIndicator BuildIndicator(
|
||||
IndicatorType type,
|
||||
string name,
|
||||
|
||||
Reference in New Issue
Block a user