アリゲーター

cBots (自動売買)

概要

伝説的なトレーダーであり、市場心理学の初期の先駆者であるBill Williamsが開発したトレンドフォローのアリゲーター指標は、金融市場や個別証券が15%から30%の間しかトレンドを形成せず、残りの70%から85%の間は横ばいのレンジで推移するという前提に基づいています。

シグネチャ

1
public <span="k">abstract <span="k">interface <span="n">Alligator

 

名前空間

cAlgo.API.Indicators

 1
 2
<span="normal"> 3
<span="normal"> 4
<span="normal"> 5
<span="normal"> 6
<span="normal"> 7
<span="normal"> 8
<span="normal"> 9
<span="normal">10
<span="normal">11
<span="normal">12
<span="normal">13
<span="normal">14
<span="normal">15
<span="normal">16
<span="normal">17
<span="normal">18
<span="normal">19
<span="normal">20
<span="normal">21
<span="normal">22
<span="normal">23
<span="normal">24
<span="normal">25
<span="normal">26
<span="normal">27
<span="normal">28
<span="normal">29
<span="normal">30
<span="normal">31
<span="normal">32
<span="normal">33
<span="normal">34
<span="normal">35
<span="normal">36
<span="normal">37
<span="normal">38
<span="normal">39
<span="normal">40
<span="normal">41
<span="normal">42
<span="normal">43
<span="normal">44
<span="normal">45
<span="normal">46
<span="normal">47
<span="normal">48
<span="normal">49
<span="normal">50
<span="normal">51
<span="normal">52
<span="normal">53
 using cAlgo.API;
 using <span="nn">cAlgo.API.Indicators;
 namespace <span="nn">cAlgo.Robots
 {
     // このサンプルcBotは、アリゲーター指標の使用方法を示します
     [Robot(TimeZone = TimeZones.UTC, AccessRights = AccessRights.None)]
     public class <span="nc">AlligatorSample <span="p">: <span="n">Robot
     {
         private <span="kt">double <span="n">_volumeInUnits<span="p">;
         private <span="n">Alligator <span="n">_alligator<span="p">;
         [Parameter("Volume (Lots)", DefaultValue = 0.01)]
         public <span="kt">double <span="n">VolumeInLots <span="p">{ get<span="p">; <span="k">set<span="p">; <span="p">}
         [Parameter("Stop Loss (Pips)", DefaultValue = 10)]
         <span="k">public <span="kt">double <span="n">StopLossInPips <span="p">{ <span="k">get<span="p">; <span="k">set<span="p">; <span="p">}
         [Parameter("Take Profit (Pips)", DefaultValue = 10)]
         <span="k">public <span="kt">double <span="n">TakeProfitInPips <span="p">{ <span="k">get<span="p">; <span="k">set<span="p">; <span="p">}
         <span="na">[Parameter("Label", DefaultValue = "Sample")]
         <span="k">public <span="kt">string <span="n">Label <span="p">{ <span="k">get<span="p">; <span="k">set<span="p">; <span="p">}
         <span="k">public <span="n">Position<span="p">[] <span="n">BotPositions
         <span="p">{
             <span="k">get
             <span="p">{
                 <span="k">return <span="n">Positions<span="p">.<span="n">FindAll<span="p">(<span="n">Label<span="p">);
             <span="p">}
         <span="p">}
         <span="k">protected <span="k">override <span="k">void <span="nf">OnStart<span="p">()
         <span="p">{
             <span="n">_volumeInUnits <span="o">= <span="n">Symbol<span="p">.<span="n">QuantityToVolumeInUnits<span="p">(<span="n">VolumeInLots<span="p">);
             <span="n">_alligator <span="o">= <span="n">Indicators<span="p">.<span="n">Alligator<span="p">(<span="m">13<span="p">, <span="m">18<span="p">, <span="m">8<span="p">, <span="m">5<span="p">, <span="m">5<span="p">, <span="m">3<span="p">);
         <span="p">}
         <span="k">protected <span="k">override <span="k">void <span="nf">OnBar<span="p">()
         <span="p">{
             <span="k">if <span="p">(<span="n">_alligator<span="p">.<span="n">Lips<span="p">.<span="n">Last<span="p">(<span="m">1<span="p">) <span="o">> <span="n">_alligator<span="p">.<span="n">Teeth<span="p">.<span="n">Last<span="p">(<span="m">1<span="p">) <span="o">&& <span="n">_alligator<span="p">.<span="n">Lips<span="p">.<span="n">Last<span="p">(<span="m">2<span="p">) <span="o"><= <span="n">_alligator<span="p">.<span="n">Teeth<span="p">.<span="n">Last<span="p">(<span="m">2<span="p">))
             <span="p">{
                 <span="n">ClosePositions<span="p">(<span="n">TradeType<span="p">.<span="n">Sell<span="p">);
                 <span="n">ExecuteMarketOrder<span="p">(<span="n">TradeType<span="p">.<span="n">Buy<span="p">, <span="n">SymbolName<span="p">, <span="n">_volumeInUnits<span="p">, <span="n">Label<span="p">, <span="n">StopLossInPips<span="p">, <span="n">TakeProfitInPips<span="p">);
             <span="p">}
             <span="k">else <span="nf">if <span="p">(<span="n">_alligator<span="p">.<span="n">Lips<span="p">.<span="n">Last<span="p">(<span="m">1<span="p">) <span="o">< <span="n">_alligator<span="p">.<span="n">Teeth<span="p">.<span="n">Last<span="p">(<span="m">1<span="p">) <span="o">&& <span="n">_alligator<span="p">.<span="n">Lips<span="p">.<span="n">Last<span="p">(<span="m">2<span="p">) <span="o">>= <span="n">_alligator<span="p">.<span="n">Teeth<span="p">.<span="n">Last<span="p">(<span="m">2<span="p">))
             <span="p">{
                 <span="n">ClosePositions<span="p">(<span="n">TradeType<span="p">.<span="n">Buy<span="p">);
                 <span="n">ExecuteMarketOrder<span="p">(<span="n">TradeType<span="p">.<span="n">Sell<span="p">, <span="n">SymbolName<span="p">, <span="n">_volumeInUnits<span="p">, <span="n">Label<span="p">, <span="n">StopLossInPips<span="p">, <span="n">TakeProfitInPips<span="p">);
             <span="p">}
         <span="p">}
         <span="k">private <span="k">void <span="nf">ClosePositions<span="p">(<span="n">TradeType <span="n">tradeType<span="p">)
         <span="p">{
             <span="k">foreach <span="p">(<span="kt">var <span="n">position <span="k">in <span="n">BotPositions<span="p">)
             <span="p">{
                 <span="k">if <span="p">(<span="n">position<span="p">.<span="n">TradeType <span="o">!= <span="n">tradeType<span="p">) <span="k">continue<span="p">;
                 <span="n">ClosePosition<span="p">(<span="n">position<span="p">);
             <span="p">}
         <span="p">}
     <span="p">}
 <span="p">}

プロパティ

Jaws

概要

Jawは、x期間(13)の平滑移動平均であり、x(18)バー未来に移動されています。

シグネチャ

1
public <span="k">abstract <span="n">IndicatorDataSeries <span="n">Jaws <span="p">{<span="k">get<span="p">; <span="k">set<span="p">;}

 

戻り値

IndicatorDataSeries

Teeth

概要

Teethは、x期間(8)の平滑移動平均であり、x(5)バー未来に移動されています。

シグネチャ

1
public <span="k">abstract <span="n">IndicatorDataSeries <span="n">Teeth <span="p">{<span="k">get<span="p">; <span="k">set<span="p">;}

 

戻り値

IndicatorDataSeries

Lips

概要

Lipsは、x期間(5)の平滑移動平均であり、x(3)バー未来に移動されています。

シグネチャ

1
public <span="k">abstract <span="n">IndicatorDataSeries <span="n">Lips <span="p">{<span="k">get<span="p">; <span="k">set<span="p">;}

 

戻り値

IndicatorDataSeries

目次

このページについて