Skip to content

Commit

Permalink
Fix issue with period and WarmUpPeriod
Browse files Browse the repository at this point in the history
  • Loading branch information
JosueNina committed Dec 17, 2024
1 parent 6c03643 commit da1e4f8
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion Algorithm.CSharp/AddBetaIndicatorRegressionAlgorithm.cs
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ public override void OnOrderEvent(OrderEvent orderEvent)
/// <summary>
/// Data Points count of the algorithm history
/// </summary>
public int AlgorithmHistoryDataPoints => 15;
public int AlgorithmHistoryDataPoints => 11;

/// <summary>
/// Final status of the algorithm
Expand Down
4 changes: 2 additions & 2 deletions Indicators/Beta.cs
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ public class Beta : BarIndicator, IIndicatorWarmUpPeriodProvider
/// <summary>
/// Gets a flag indicating when the indicator is ready and fully initialized
/// </summary>
public override bool IsReady => (2 * _targetReturns.Samples >= WarmUpPeriod) && (2 * _referenceReturns.Samples >= WarmUpPeriod);
public override bool IsReady => (_targetReturns.Samples >= WarmUpPeriod - 1) && (_referenceReturns.Samples >= WarmUpPeriod - 1);

/// <summary>
/// Creates a new Beta indicator with the specified name, target, reference,
Expand All @@ -118,7 +118,7 @@ public Beta(string name, Symbol targetSymbol, Symbol referenceSymbol, int period
throw new ArgumentException($"Period parameter for Beta indicator must be greater than 2 but was {period}.");
}

WarmUpPeriod = 2 * period;
WarmUpPeriod = period + 1;
_referenceSymbol = referenceSymbol;
_targetSymbol = targetSymbol;

Expand Down

0 comments on commit da1e4f8

Please sign in to comment.