概要
プロットタイプ。
シグネチャ
1 |
|
名前空間
cAlgo.API
例
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 |
using cAlgo.API;
using cAlgo.API.Indicators;
namespace cAlgo
{
// このサンプルは、インジケーターの出力に対して異なる種類のプロットを使用する方法を示しています。
[Indicator(IsOverlay = false, TimeZone = TimeZones.UTC, AccessRights = AccessRights.None)]
public class PlotTypeSample : Indicator
{
private StandardDeviation _standardDeviation;
[Output("Discontinuous Line", LineColor = "Red", PlotType = PlotType.DiscontinuousLine)]
public IndicatorDataSeries DiscontinuousLine { get; set; }
[Output("Histogram", LineColor = "Green", PlotType = PlotType.Histogram)]
public IndicatorDataSeries Histogram <span="p">{ get<span="p">; set<span="p">; <span="p">}
[Output("Line", LineColor = "Blue", PlotType = PlotType.Line)]
public <span="n">IndicatorDataSeries <span="n">Line <span="p">{ <span="k">get<span="p">; <span="k">set<span="p">; <span="p">}
[Output("Points", LineColor = "Yellow", PlotType = PlotType.Points)]
public <span="n">IndicatorDataSeries <span="n">Points <span="p">{ <span="k">get<span="p">; <span="k">set<span="p">; <span="p">}
protected <span="k">override <span="k">void <span="nf">Initialize<span="p">()
<span="p">{
_standardDeviation <span="o">= <span="n">Indicators<span="p">.<span="n">StandardDeviation<span="p">(<span="n">Bars<span="p">.<span="n">ClosePrices<span="p">, <span="m">20<span="p">, <span="n">MovingAverageType<span="p">.<span="n">Simple<span="p">);
<span="p">}
<span="k">public <span="k">override <span="k">void <span="nf">Calculate<span="p">(int <span="n">index<span="p">)
<span="p">{
<span="n">DiscontinuousLine<span="p">[<span="n">index<span="p">] <span="o">= <span="n">Bars<span="p">.<span="n">ClosePrices<span="p">[<span="n">index<span="p">] <span="o">+ <span="n">_standardDeviation<span="p">.<span="n">Result<span="p">[<span="n">index<span="p">];
<span="n">Histogram<span="p">[<span="n">index<span="p">] <span="o">= <span="n">Bars<span="p">.<span="n">ClosePrices<span="p">[<span="n">index<span="p">] <span="o">+ <span="p">(<span="n">_standardDeviation<span="p">.<span="n">Result<span="p">[<span="n">index<span="p">] <span="o">* <span="m">1.5<span="p">);
<span="n">Line<span="p">[<span="n">index<span="p">] <span="o">= <span="n">Bars<span="p">.<span="n">ClosePrices<span="p">[<span="n">index<span="p">] <span="o">+ <span="p">(<span="n">_standardDeviation<span="p">.<span="n">Result<span="p">[<span="n">index<span="p">] <span="o">* <span="m">2<span="p">);
<span="n">Points<span="p">[<span="n">index<span="p">] <span="o">= <span="n">Bars<span="p">.<span="n">ClosePrices<span="p">[<span="n">index<span="p">] <span="o">+ <span="p">(<span="n">_standardDeviation<span="p">.<span="n">Result<span="p">[<span="n">index<span="p">] <span="o">* <span="m">2.5<span="p">);
<span="p">}
<span="p">}
<span="p">}
フィールド
Line
概要
インジケーターの結果をラインとしてプロットします。
シグネチャ
1 |
public <span="k">static <span="n">PlotType <span="n">Line<span="p">;
戻り値
PlotType
例
1 2 |
[Output("Main", PlotType = PlotType.Line)]
public <span="n">IndicatorDataSeries <span="n">Result <span="p">{ <span="k">get<span="p">; <span="k">set<span="p">; <span="p">}
Histogram
概要
インジケーターの結果をヒストグラムとしてプロットします。
シグネチャ
1 |
public <span="k">static <span="n">PlotType <span="n">Histogram<span="p">;
戻り値
PlotType
例
1
<span="normal">2 |
[Output("Main", PlotType = PlotType.Histogram)]
public <span="n">IndicatorDataSeries <span="n">Result <span="p">{ <span="k">get<span="p">; <span="k">set<span="p">; <span="p">}
Points
概要
インジケーターの結果をポイントとしてプロットします。
シグネチャ
1 |
public <span="k">static <span="n">PlotType <span="n">Points<span="p">;
戻り値
PlotType
例
<span="normal">1 <span="normal">2 |
[Output("Main", PlotType = PlotType.Points)]
public <span="n">IndicatorDataSeries <span="n">Result <span="p">{ <span="k">get<span="p">; <span="k">set<span="p">; <span="p">}
DiscontinuousLine
概要
インジケーターの結果を、IndicatorDataSeriesに値がない部分で切れ目のあるラインとしてプロットします。
シグネチャ
1 |
public <span="k">static <span="n">PlotType <span="n">DiscontinuousLine<span="p">;
戻り値
PlotType
例
<span="normal">1 <span="normal">2 |
[Output("Main", PlotType = PlotType.DiscontinuousLine)]
public <span="n">IndicatorDataSeries <span="n">Result <span="p">{ <span="k">get<span="p">; <span="k">set<span="p">; <span="p">}