Ara
Ürünler
Topluluk
Piyasalar
Haberler
Aracı kurum
Daha Fazla
TR
Şimdi başlat
Topluluk
/
Fikirler
/
Pine講座64 タートルズ流投資の魔術|時限式ドンチアン・トレンド
ABD Doları / Japon Yeni
Eğitim
Pine講座64 タートルズ流投資の魔術|時限式ドンチアン・トレンド
yuya_takahashi_ tarafından
Takip Et
Takip Et
27 Eyl 2019
1
3
27 Eyl 2019
「タートルズ流投資の魔術
カーティス・フェイス著」
で紹介されている手法の再現。
6つ目、最後の手法です。
決済がかなり特殊なストラテジーです。
決済の条件は、
「エントリーから80日経過したときのみ」
というもの。
これでも利益が出ることに
本当に驚きました。
(長期のトレンドフォロー
なので分散投資が必須です)
※ コピペする場合は以下の変更を行ってください
[](全角の角括弧)→(半角の角括弧)
(全角スペース)→(半角スペース)
=====
//
version
=3
strategy("Strategy Turtle Time Exit Donchian Trend"
,default_qty_type=strategy.fixed
,default_qty_value=1
,pyramiding=4
,overlay=true)
src = close
len_dc_entry = input(20 ,minval=1 ,title="length of dc entry")
len_ema_m = input(25 ,minval=1 ,title="length of middle ema")
len_ema_l = input(350 ,minval=1 ,title="length of long ema")
MAX_N = input(1 ,type=integer ,minval=1 ,maxval=4 ,title="maximun num of unit")
LO_len = input(20 ,type=integer ,minval=1 ,title="pyramiding ATR length")
LO_N = input(1 ,type=float ,minval=0.5 ,title="pyramiding ATR*N")
Tm_len = input(80 ,type=integer ,minval=1 ,title="timed exit length")
fromYear = input(2005 ,type=integer ,minval=1900 ,title="test start")
endYear = input(2017 ,type=integer ,minval=1900 ,title="test end")
isWork = timestamp(fromYear ,1 ,1 ,00 ,00) <= time and time < timestamp(endYear+1 ,1 ,1 ,00 ,00)
upper_en = highest(high ,len_dc_entry)[1]
lower_en = lowest(low ,len_dc_entry)[1]
ema_m = ema(src ,len_ema_m)
ema_l = ema(src ,len_ema_l)
atr_LO_ = ema(tr ,LO_len)
atr_LO = atr_LO_*LO_N
countTradingDays = na
countNonTradingDays = na
countTradingDays := strategy.position_size==0 ? 0 : countTradingDays[1] + 1
countNonTradingDays := strategy.position_size!=0 ? 0 : countNonTradingDays[1] + 1
entry1 = close
entry2 = close
entry3 = close
entry4 = close
entry1 := strategy.position_size==0 ? na : entry1[1]
entry2 := strategy.position_size==0 ? na : entry2[1]
entry3 := strategy.position_size==0 ? na : entry3[1]
entry4 := strategy.position_size==0 ? na : entry4[1]
lo2 = close
lo3 = close
lo4 = close
lo2 := strategy.position_size==0 ? na : lo2[1]
lo3 := strategy.position_size==0 ? na : lo3[1]
lo4 := strategy.position_size==0 ? na : lo4[1]
L_EntrySig = strategy.position_size==0 and high >= upper_en and ema_m >= ema_l
S_EntrySig = strategy.position_size==0 and low <= lower_en and ema_m <= ema_l
lo_sig2 = strategy.position_size>0 ? lo2 < high : strategy.position_size<0 ? lo2 > low : na
lo_sig3 = strategy.position_size>0 ? lo3 < high : strategy.position_size<0 ? lo3 > low : na
lo_sig4 = strategy.position_size>0 ? lo4 < high : strategy.position_size<0 ? lo4 > low : na
if(strategy.position_size != 0)
TimedSig = countTradingDays >= Tm_len
strategy.close_all(when = TimedSig)
if(TimedSig)
entry1 := na
entry2 := na
entry3 := na
entry4 := na
lo2 := na
lo3 := na
lo4 := na
if(strategy.position_size > 0)
if(lo_sig2 and MAX_N >= 2)
lo2 := na
strategy.entry("L-Entry2" ,strategy.long ,comment="L-Entry2")
if(lo_sig3 and MAX_N >= 3)
lo3 := na
strategy.entry("L-Entry3" ,strategy.long ,comment="L-Entry3")
if(lo_sig4 and MAX_N >= 4)
lo4 := na
strategy.entry("L-Entry4" ,strategy.long ,comment="L-Entry4")
if(strategy.position_size < 0)
if(lo_sig2 and MAX_N >= 2)
lo2 := na
strategy.entry("S-Entry2" ,strategy.short ,comment="S-Entry2")
if(lo_sig3 and MAX_N >= 3)
lo3 := na
strategy.entry("S-Entry3" ,strategy.short ,comment="S-Entry3")
if(lo_sig4 and MAX_N >= 4)
lo4 := na
strategy.entry("S-Entry4" ,strategy.short ,comment="S-Entry4")
if((L_EntrySig or S_EntrySig) and isWork)
countTradingDays := 1
entry1 := close
if(L_EntrySig)
strategy.entry("L-Entry1" ,strategy.long ,comment="L-Entry1")
lo2 := MAX_N >= 2 ? close + atr_LO : na
lo3 := MAX_N >= 3 ? close + atr_LO * 2 : na
lo4 := MAX_N >= 4 ? close + atr_LO * 3 : na
if(S_EntrySig)
strategy.entry("S-Entry1" ,strategy.short ,comment="S-Entry1")
lo2 := MAX_N >= 2 ? close - atr_LO : na
lo3 := MAX_N >= 3 ? close - atr_LO * 2 : na
lo4 := MAX_N >= 4 ? close - atr_LO * 3 : na
plot(strategy.position_size ,transp=0 ,title="保有ポジションの数")
plot(strategy.openprofit ,transp=0 ,title="未決済の損益")
plot(strategy.netprofit ,transp=0 ,title="決済済みの損益")
plot(strategy.closedtrades ,transp=0 ,title="決済済み取引数")
plot(countTradingDays ,transp=0 ,title="取引日数")
plot(countNonTradingDays ,transp=0 ,title="ノンポジ日数")
plot(entry1 ,title="entry1" ,color=blue ,transp=0 ,style=linebr)
plot(lo2 ,title="lo2" ,color=red ,transp=0 ,style=linebr)
plot(lo3 ,title="lo3" ,color=red ,transp=0 ,style=linebr)
plot(lo4 ,title="lo4" ,color=red ,transp=0 ,style=linebr)
plot(atr_LO ,transp=0 ,title="ATR_LO")
// plot(strategy.max_drawdown ,transp=50 ,title="最大DD")
// plot(strategy.equity, title="equity", color=red, linewidth=2, style=areabr)
p1 = plot(ema_m ,color=#303F9F ,title="ema_m" ,style=line ,linewidth=1, transp=0)
p2 = plot(ema_l ,color=#4CAF50 ,title="ema_l" ,style=line ,linewidth=1, transp=0)
fill(p1 ,p2 ,color=#2196F3 ,title="fill" ,transp=80)
p3 = plot(lower_en ,color=gray ,title="lower_entry" ,style=linebr ,linewidth=1 ,transp=40)
p4 = plot(upper_en ,color=gray ,title="upper_entry" ,style=linebr ,linewidth=1 ,transp=40)
fill(p3 ,p4 ,color=gray ,title="fill" ,transp=90)
=====
Beyond Technical Analysis
pinescript
yuya_takahashi_
Takip Et
小次郎講師公式インジケーターのお申込
bit.ly/2vdSV4Q
小次郎講師のLINE@
bit.ly/2VZQFu3
小次郎講師のチャート情報局
bit.ly/2GvLAEp
Aynı zamanda::
İlgili yayınlar
Pine講座① たった2行で移動平均線が出せる
yuya_takahashi_ tarafından
Pine講座㉕ TradingViewでバックテストをする
yuya_takahashi_ tarafından
Pine講座59 タートルズ流投資の魔術|ダブル移動平均
yuya_takahashi_ tarafından
Feragatname
Bilgiler ve yayınlar, TradingView tarafından sağlanan veya onaylanan finansal, yatırım, işlem veya diğer türden tavsiye veya tavsiyeler anlamına gelmez ve teşkil etmez.
Kullanım Şartları
'nda daha fazlasını okuyun.