Skip to content

Commit d89ae37

Browse files
author
GitHub Actions
committed
Code generated by indicator_reference_code_generator.py
1 parent 07d1215 commit d89ae37

2 files changed

Lines changed: 41 additions & 3 deletions

File tree

03 Writing Algorithms/28 Indicators/01 Supported Indicators/107 Swiss Army Knife/02 Using SWISS Indicator.html

Lines changed: 26 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,12 @@
1919
// The current value of _swiss is represented by itself (_swiss)
2020
// or _swiss.Current.Value
2121
Plot("SwissArmyKnife", "swiss", _swiss);
22+
// Plot all properties of abands
23+
Plot("SwissArmyKnife", "gauss", _swiss.Gauss);
24+
Plot("SwissArmyKnife", "butter", _swiss.Butter);
25+
Plot("SwissArmyKnife", "highpass", _swiss.HighPass);
26+
Plot("SwissArmyKnife", "twopolehighpass", _swiss.TwoPoleHighPass);
27+
Plot("SwissArmyKnife", "bandpass", _swiss.BandPass);
2228
}
2329
}
2430
}</pre>
@@ -31,7 +37,13 @@
3137

3238
if self._swiss.is_ready:
3339
# The current value of self._swiss is represented by self._swiss.current.value
34-
self.plot("SwissArmyKnife", "swiss", self._swiss.current.value)</pre></div>
40+
self.plot("SwissArmyKnife", "swiss", self._swiss.current.value)
41+
# Plot all attributes of self._swiss
42+
self.plot("SwissArmyKnife", "gauss", self._swiss.gauss.current.value)
43+
self.plot("SwissArmyKnife", "butter", self._swiss.butter.current.value)
44+
self.plot("SwissArmyKnife", "high_pass", self._swiss.high_pass.current.value)
45+
self.plot("SwissArmyKnife", "two_pole_high_pass", self._swiss.two_pole_high_pass.current.value)
46+
self.plot("SwissArmyKnife", "band_pass", self._swiss.band_pass.current.value)</pre></div>
3547
<p>For more information about this method, see the <a rel="nofollow" target="_blank" class='csharp' href="https://www.lean.io/docs/v2/lean-engine/class-reference/cs/classQuantConnect_1_1Algorithm_1_1QCAlgorithm.html">QCAlgorithm class</a><a rel="nofollow" target="_blank" class='python' href="https://www.lean.io/docs/v2/lean-engine/class-reference/py/QuantConnect/Algorithm/QCAlgorithm/#QuantConnect.Algorithm.QCAlgorithm.swiss">QCAlgorithm class</a>.</p>
3648
<p>You can manually create a <code>SwissArmyKnife</code> indicator, so it doesn't automatically update. Manual indicators let you update their values with any data you choose.</p>
3749
<p>Updating your indicator manually enables you to control when the indicator is updated and what data you use to update it. To manually update the indicator, call the <code class="csharp">Update</code><code class="python">update</code> method. The indicator will only be ready after you prime it with enough data.</p>
@@ -57,6 +69,12 @@
5769
// The current value of _swissarmyknife is represented by itself (_swissarmyknife)
5870
// or _swissarmyknife.Current.Value
5971
Plot("SwissArmyKnife", "swissarmyknife", _swissarmyknife);
72+
// Plot all properties of abands
73+
Plot("SwissArmyKnife", "gauss", _swissarmyknife.Gauss);
74+
Plot("SwissArmyKnife", "butter", _swissarmyknife.Butter);
75+
Plot("SwissArmyKnife", "highpass", _swissarmyknife.HighPass);
76+
Plot("SwissArmyKnife", "twopolehighpass", _swissarmyknife.TwoPoleHighPass);
77+
Plot("SwissArmyKnife", "bandpass", _swissarmyknife.BandPass);
6078
}
6179
}
6280
}</pre>
@@ -72,5 +90,11 @@
7290

7391
if self._swissarmyknife.is_ready:
7492
# The current value of self._swissarmyknife is represented by self._swissarmyknife.current.value
75-
self.plot("SwissArmyKnife", "swissarmyknife", self._swissarmyknife.current.value)</pre></div>
93+
self.plot("SwissArmyKnife", "swissarmyknife", self._swissarmyknife.current.value)
94+
# Plot all attributes of self._swissarmyknife
95+
self.plot("SwissArmyKnife", "gauss", self._swissarmyknife.gauss.current.value)
96+
self.plot("SwissArmyKnife", "butter", self._swissarmyknife.butter.current.value)
97+
self.plot("SwissArmyKnife", "high_pass", self._swissarmyknife.high_pass.current.value)
98+
self.plot("SwissArmyKnife", "two_pole_high_pass", self._swissarmyknife.two_pole_high_pass.current.value)
99+
self.plot("SwissArmyKnife", "band_pass", self._swissarmyknife.band_pass.current.value)</pre></div>
76100
<p>For more information about this indicator, see its <a rel="nofollow" target="_blank" class='csharp' href="https://www.lean.io/docs/v2/lean-engine/class-reference/cs/classQuantConnect_1_1Indicators_1_1SwissArmyKnife.html">reference</a><a rel="nofollow" target="_blank" class='python' href="https://www.lean.io/docs/v2/lean-engine/class-reference/py/QuantConnect/Indicators/SwissArmyKnife">reference</a>.</p>

03 Writing Algorithms/28 Indicators/01 Supported Indicators/107 Swiss Army Knife/04 Indicator History.html

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,13 @@
1414
var indicatorHistory = IndicatorHistory(_swiss, _symbol, 100, Resolution.Minute);
1515
var timeSpanIndicatorHistory = IndicatorHistory(_swiss, _symbol, TimeSpan.FromDays(10), Resolution.Minute);
1616
var timePeriodIndicatorHistory = IndicatorHistory(_swiss, _symbol, new DateTime(2024, 7, 1), new DateTime(2024, 7, 5), Resolution.Minute);
17+
18+
// Access all attributes of indicatorHistory
19+
var gauss = indicatorHistory.Select(x => ((dynamic)x).Gauss).ToList();
20+
var butter = indicatorHistory.Select(x => ((dynamic)x).Butter).ToList();
21+
var highPass = indicatorHistory.Select(x => ((dynamic)x).HighPass).ToList();
22+
var twoPoleHighPass = indicatorHistory.Select(x => ((dynamic)x).TwoPoleHighPass).ToList();
23+
var bandPass = indicatorHistory.Select(x => ((dynamic)x).BandPass).ToList();
1724
}
1825
}</pre>
1926
<pre class="python">class SwissArmyKnifeAlgorithm(QCAlgorithm):
@@ -24,4 +31,11 @@
2431
indicator_history = self.indicator_history(self._swiss, self._symbol, 100, Resolution.MINUTE)
2532
timedelta_indicator_history = self.indicator_history(self._swiss, self._symbol, timedelta(days=10), Resolution.MINUTE)
2633
time_period_indicator_history = self.indicator_history(self._swiss, self._symbol, datetime(2024, 7, 1), datetime(2024, 7, 5), Resolution.MINUTE)
27-
</pre></div>
34+
35+
# Access all attributes of indicator_history
36+
indicator_history_df = indicator_history.data_frame
37+
gauss = indicator_history_df["gauss"]
38+
butter = indicator_history_df["butter"]
39+
high_pass = indicator_history_df["highpass"]
40+
two_pole_high_pass = indicator_history_df["twopolehighpass"]
41+
band_pass = indicator_history_df["bandpass"]</pre></div>

0 commit comments

Comments
 (0)