Pine講座㊼ バックテスト|20 years old Turtles strategy still work!! の解説 教育 U.S. Dollar/Japanese Yen FXCM
詳細 ⋅ 2019年8月28日午前3時11分 trm0さんによるストラテジーです。 20年前のタートルズのストラテジーが今でも通用する! というインジケーター名ですね。 バージョン2のコードなので、随分と古いようです。 今ならもっと違う書き方ができそうな気がします。 タートルズはドンチャンチャネルを複数組み合わせていました。 タートルズの手法は、 ・もみあいが少ない ・トレンドが大きい このあたりがクリアできる銘柄でないと トータル利益を実現するのが難しいですね。 単一銘柄では難しいですが、 流動性がある20銘柄くらいでの分散投資を 長期で回すとうまくいくイメージを持っています。 ※ 解説はコードの中で ※ コピペする場合は以下の変更を行ってください [](全角の角括弧)→(半角の角括弧) (全角スペース)→(半角スペース) ===== //@version =2 //coded by tmr0 //original idea from «Way of the Turtle: The Secret Methods that Turned Ordinary People into Legendary Traders» (2007) CURTIS FAITH strategy("20 years old Turtles strategy by tmr0 の解説", shorttitle = "Turtles", overlay=true, pyramiding=5, default_qty_type= strategy.cash, default_qty_value = 1000) //計算用の数値を設定 //早いエントリーの基準 enter_fast = input(20, minval=1) //早いエントリーの決済 exit_fast = input(10, minval=1) //遅いエントリーの基準 enter_slow = input(55, minval=1) //遅いエントリーの決済 exit_slow = input(20, minval=1) //計算 fastL = highest(enter_fast) fastLC = lowest(exit_fast) fastS = lowest(enter_fast) fastSC = highest(exit_fast) slowL = highest(enter_slow) slowLC = lowest(exit_slow) slowS = lowest(enter_slow) slowSC = highest(exit_slow) //エントリーと決済の判断 enterL1 = high > fastL[1] exitL1 = low <= fastLC[1] enterS1 = low < fastS[1] exitS1 = high >= fastSC[1] enterL2 = high > slowL[1] exitL2 = low <= slowLC[1] enterS2 = low < slowS[1] exitS2 = high >= slowSC[1] strategy.entry("fast L", strategy.long, when = enterL1) strategy.entry("fast S", strategy.short, when = enterS1) strategy.close("fast L", when = exitL1) strategy.close("fast S", when = exitS1) strategy.entry("slow L", strategy.long, when = enterL2) strategy.entry("slow S", strategy.short, when = enterS2) strategy.close("slow L", when = exitL2) strategy.close("slow S", when = exitS2) //確認用で描画 plot( fastL ) plot( fastS ) plot( fastLC ) plot( fastSC ) plot( slowL ,color=red ) plot( slowLC ,color=red ) =====