Skip to content

Commit

Permalink
Update 13 Indicators.php
Browse files Browse the repository at this point in the history
  • Loading branch information
DerekMelchin authored Dec 31, 2024
1 parent 321dc21 commit 4959ef4
Showing 1 changed file with 6 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,9 @@
<pre class="csharp">// Get the Symbol of an asset.
var symbol = AddEquity("SPY").Symbol;
// Get the 21-day SMA values of an asset for the last 5 trading days.
var history = IndicatorHistory(new SimpleMovingAverage(21), symbol, 5, Resolution.Daily);</pre>
var history = IndicatorHistory(new SimpleMovingAverage(21), symbol, 5, Resolution.Daily);
// Get the maximum of the SMA values.
var maxSMA = history.Max(indicatorDataPoint => indicatorDataPoint.Current.Value);</pre>
<pre class="python"># Get the Symbol of an asset.
symbol = self.add_equity('SPY').symbol
# Get the 21-day SMA values of an asset for the last 5 trading days.
Expand Down Expand Up @@ -58,7 +60,9 @@
// Create a 21-period Beta indicator.
var beta = new Beta("", targetSymbol, referenceSymbol, 21);
// Get the historical values of the indicator over the last 10 trading days.
var history = IndicatorHistory(beta, new[] {targetSymbol, referenceSymbol}, 10, Resolution.Daily);</pre>
var history = IndicatorHistory(beta, new[] {targetSymbol, referenceSymbol}, 10, Resolution.Daily);
// Get the average Beta value.
var avgBeta = history.Average(indicatorDataPoint => indicatorDataPoint.Current.Value);</pre>
<pre class="python"># Add the target and reference assets.
target_symbol = self.add_equity('AAPL').symbol
reference_symbol = self.add_equity('SPY').symbol
Expand Down

0 comments on commit 4959ef4

Please sign in to comment.