yuya_takahashi_
教育

Security関数なしで、上位足のZigZagを表示する

OANDA:USDJPY   米ドル/円
バックテストをする上で、
Security関数は使わないようにしています。

理由はいくつかあります。

・Pythonで再現するのに不都合がある
("なし" で作成しておいた方がPythonに書き換えやすい)

・予期しない挙動が起こることがある
(先物の週明けに上位足の価格が正常に取得できない等)

しかし、やはりコードは長くなります。

※ コピペする場合は以下の変更を行ってください
[](全角の角括弧)→(半角の角括弧)
(全角スペース)→(半角スペース)

=====
//@version=4
strategy( title='ZigZag PA Strategy 勉強中', shorttitle='S', overlay=true, pyramiding=0, initial_capital=100000 )

altTimeframe = input( title="Alt Timeframe" ,defval='60' )
is_open = change( time( altTimeframe ) ) != 0

bgcolor( is_open ? color.gray : color.white ,title='aot timeframe open' )

// 上位足の高値を過去2本分保有しておく
float cnt02_high = na
float cnt01_high = na
float cnt00_high = na
cnt02_high := is_open ? cnt01_high[1] : cnt02_high[1]
cnt01_high := is_open ? cnt00_high[1] : cnt01_high[1]
cnt00_high := is_open ? high : high > cnt00_high[1] ? high : cnt00_high[1]
// plot( cnt02_high ,color=color.color.red )
// plot( cnt01_high ,color=color.color.red )
// plot( cnt00_high ,color=color.color.red )

// 上位足の安値を過去2本分保有しておく
float cnt02_low = na
float cnt01_low = na
float cnt00_low = na
cnt02_low := is_open ? cnt01_low[1] : cnt02_low[1]
cnt01_low := is_open ? cnt00_low[1] : cnt01_low[1]
cnt00_low := is_open ? low : low < cnt00_low[1] ? low : cnt00_low[1]
// plot( cnt02_low )
// plot( cnt01_low )
// plot( cnt00_low )

// 上位足の始値を過去2本分保有しておく
float cnt02_open = na
float cnt01_open = na
float cnt00_open = na
cnt02_open := is_open ? cnt01_open[1] : cnt02_open[1]
cnt01_open := is_open ? cnt00_open[1] : cnt01_open[1]
cnt00_open := is_open ? open : cnt00_open[1]

// 上位足の終値を過去2本分保有しておく
float cnt02_close = na
float cnt01_close = na
cnt02_close := is_open ? cnt01_close[1] : cnt02_close[1]
cnt01_close := is_open ? close[1] : cnt01_close[1]

// zigzagを確認
isUp_02 = cnt02_close >= cnt02_open
isUp_01 = cnt01_close >= cnt01_open
isDown_02 = cnt02_close <= cnt02_open
isDown_01 = cnt01_close <= cnt01_open

int direction_02 = na
int direction_01 = na
direction_02 := is_open ? direction_01[1] : direction_02[1]
direction_01 := not is_open ? direction_01[1] : isUp_02 and isDown_01 ? -1
            : isDown_02 and isUp_01 ? 1
            : direction_01[1]

zigzag = not is_open ? na : isUp_02 and isDown_01 and direction_02 != -1 ? max( cnt01_high ,cnt02_high )
       : isDown_02 and isUp_01 and direction_02 != 1 ? min( cnt01_low ,cnt02_low )
       : na

plot( zigzag ,color=color.red ,linewidth=3 ,title='zigzag' )

// ジグザグが発生したときのジグザグの値を取得
float x = na
float a = na
float b = na
float c = na
float d = na

exist_zigzag = not na( zigzag )

x := exist_zigzag ? a[1] : x[1]
a := exist_zigzag ? b[1] : a[1]
b := exist_zigzag ? c[1] : b[1]
c := exist_zigzag ? d[1] : c[1]
d := exist_zigzag ? zigzag : d[1]

showPatterns = input( true, title='Show Patterns' )
showFib0000 = input( title='Display Fibonacci 0.000:', type=input.bool, defval=true )
showFib0236 = input( title='Display Fibonacci 0.236:', type=input.bool, defval=true )
showFib0382 = input( title='Display Fibonacci 0.382:', type=input.bool, defval=true )
showFib0500 = input( title='Display Fibonacci 0.500:', type=input.bool, defval=true )
showFib0618 = input( title='Display Fibonacci 0.618:', type=input.bool, defval=true )
showFib0764 = input( title='Display Fibonacci 0.764:', type=input.bool, defval=true )
showFib1000 = input( title='Display Fibonacci 1.000:', type=input.bool, defval=true )

fib_range = abs(d-c)
fib_0000 = not showFib0000 ? na : d > c ? d-(fib_range*0.000):d+(fib_range*0.000)
fib_0236 = not showFib0236 ? na : d > c ? d-(fib_range*0.236):d+(fib_range*0.236)
fib_0382 = not showFib0382 ? na : d > c ? d-(fib_range*0.382):d+(fib_range*0.382)
fib_0500 = not showFib0500 ? na : d > c ? d-(fib_range*0.500):d+(fib_range*0.500)
fib_0618 = not showFib0618 ? na : d > c ? d-(fib_range*0.618):d+(fib_range*0.618)
fib_0764 = not showFib0764 ? na : d > c ? d-(fib_range*0.764):d+(fib_range*0.764)
fib_1000 = not showFib1000 ? na : d > c ? d-(fib_range*1.000):d+(fib_range*1.000)
plot(title='Fib 0.000', series=fib_0000 ,color=fib_0000 != fib_0000[1] ? na : color.black)
plot(title='Fib 0.236', series=fib_0236 ,color=fib_0236 != fib_0236[1] ? na : color.red)
plot(title='Fib 0.382', series=fib_0382 ,color=fib_0382 != fib_0382[1] ? na : color.olive)
plot(title='Fib 0.500', series=fib_0500 ,color=fib_0500 != fib_0500[1] ? na : color.lime)
plot(title='Fib 0.618', series=fib_0618 ,color=fib_0618 != fib_0618[1] ? na : color.teal)
plot(title='Fib 0.764', series=fib_0764 ,color=fib_0764 != fib_0764[1] ? na : color.blue)
plot(title='Fib 1.000', series=fib_1000 ,color=fib_1000 != fib_1000[1] ? na : color.black)

xab = ( abs( b - a ) / abs( x - a ) )
xad = ( abs( a - d ) / abs( x - a ) )
abc = ( abs( b - c ) / abs( a - b ) )
bcd = ( abs( c - d ) / abs( b - c ) )

// 5つの点の比率からパターンを判断する関数
isBat(_mode)=>
 _xab = xab >= 0.382 and xab <= 0.5
 _abc = abc >= 0.382 and abc <= 0.886
 _bcd = bcd >= 1.618 and bcd <= 2.618
 _xad = xad <= 0.618 and xad <= 1.000 // 0.886
 _xab and _abc and _bcd and _xad and (_mode == 1 ? d < c : d > c)

isAntiBat(_mode)=>
 _xab = xab >= 0.500 and xab <= 0.886 // 0.618
 _abc = abc >= 1.000 and abc <= 2.618 // 1.13 --> 2.618
 _bcd = bcd >= 1.618 and bcd <= 2.618 // 2.0 --> 2.618
 _xad = xad >= 0.886 and xad <= 1.000 // 1.13
 _xab and _abc and _bcd and _xad and (_mode == 1 ? d < c : d > c)

isAltBat(_mode)=>
 _xab = xab <= 0.382
 _abc = abc >= 0.382 and abc <= 0.886
 _bcd = bcd >= 2.0 and bcd <= 3.618
 _xad = xad <= 1.13
 _xab and _abc and _bcd and _xad and (_mode == 1 ? d < c : d > c)

isButterfly(_mode)=>
 _xab = xab <= 0.786
 _abc = abc >= 0.382 and abc <= 0.886
 _bcd = bcd >= 1.618 and bcd <= 2.618
 _xad = xad >= 1.27 and xad <= 1.618
 _xab and _abc and _bcd and _xad and (_mode == 1 ? d < c : d > c)

isAntiButterfly(_mode)=>
 _xab = xab >= 0.236 and xab <= 0.886 // 0.382 - 0.618
 _abc = abc >= 1.130 and abc <= 2.618 // 1.130 - 2.618
 _bcd = bcd >= 1.000 and bcd <= 1.382 // 1.27
 _xad = xad >= 0.500 and xad <= 0.886 // 0.618 - 0.786
 _xab and _abc and _bcd and _xad and (_mode == 1 ? d < c : d > c)

isABCD(_mode)=>
 _abc = abc >= 0.382 and abc <= 0.886
 _bcd = bcd >= 1.13 and bcd <= 2.618
 _abc and _bcd and (_mode == 1 ? d < c : d > c)

isGartley(_mode)=>
 _xab = xab >= 0.5 and xab <= 0.618 // 0.618
 _abc = abc >= 0.382 and abc <= 0.886
 _bcd = bcd >= 1.13 and bcd <= 2.618
 _xad = xad >= 0.75 and xad <= 0.875 // 0.786
 _xab and _abc and _bcd and _xad and (_mode == 1 ? d < c : d > c)

isAntiGartley(_mode)=>
 _xab = xab >= 0.500 and xab <= 0.886 // 0.618 -> 0.786
 _abc = abc >= 1.000 and abc <= 2.618 // 1.130 -> 2.618
 _bcd = bcd >= 1.500 and bcd <= 5.000 // 1.618
 _xad = xad >= 1.000 and xad <= 5.000 // 1.272
 _xab and _abc and _bcd and _xad and (_mode == 1 ? d < c : d > c)

isCrab(_mode)=>
 _xab = xab >= 0.500 and xab <= 0.875 // 0.886
 _abc = abc >= 0.382 and abc <= 0.886 
 _bcd = bcd >= 2.000 and bcd <= 5.000 // 3.618
 _xad = xad >= 1.382 and xad <= 5.000 // 1.618
 _xab and _abc and _bcd and _xad and (_mode == 1 ? d < c : d > c)

isAntiCrab(_mode)=>
 _xab = xab >= 0.250 and xab <= 0.500 // 0.276 -> 0.446
 _abc = abc >= 1.130 and abc <= 2.618 // 1.130 -> 2.618
 _bcd = bcd >= 1.618 and bcd <= 2.618 // 1.618 -> 2.618
 _xad = xad >= 0.500 and xad <= 0.750 // 0.618
 _xab and _abc and _bcd and _xad and (_mode == 1 ? d < c : d > c)

isShark(_mode)=>
 _xab = xab >= 0.500 and xab <= 0.875 // 0.5 --> 0.886
 _abc = abc >= 1.130 and abc <= 1.618 //
 _bcd = bcd >= 1.270 and bcd <= 2.240 //
 _xad = xad >= 0.886 and xad <= 1.130 // 0.886 --> 1.13
 _xab and _abc and _bcd and _xad and (_mode == 1 ? d < c : d > c)

isAntiShark(_mode)=>
 _xab = xab >= 0.382 and xab <= 0.875 // 0.446 --> 0.618
 _abc = abc >= 0.500 and abc <= 1.000 // 0.618 --> 0.886
 _bcd = bcd >= 1.250 and bcd <= 2.618 // 1.618 --> 2.618
 _xad = xad >= 0.500 and xad <= 1.250 // 1.130 --> 1.130
 _xab and _abc and _bcd and _xad and (_mode == 1 ? d < c : d > c)

is5o(_mode)=>
 _xab = xab >= 1.13 and xab <= 1.618
 _abc = abc >= 1.618 and abc <= 2.24
 _bcd = bcd >= 0.5 and bcd <= 0.625 // 0.5
 _xad = xad >= 0.0 and xad <= 0.236 // negative?
 _xab and _abc and _bcd and _xad and (_mode == 1 ? d < c : d > c)

isWolf(_mode)=>
 _xab = xab >= 1.27 and xab <= 1.618
 _abc = abc >= 0 and abc <= 5
 _bcd = bcd >= 1.27 and bcd <= 1.618
 _xad = xad >= 0.0 and xad <= 5
 _xab and _abc and _bcd and _xad and (_mode == 1 ? d < c : d > c)

isHnS(_mode)=>
 _xab = xab >= 2.0 and xab <= 10
 _abc = abc >= 0.90 and abc <= 1.1
 _bcd = bcd >= 0.236 and bcd <= 0.88
 _xad = xad >= 0.90 and xad <= 1.1
 _xab and _abc and _bcd and _xad and (_mode == 1 ? d < c : d > c)

isConTria(_mode)=>
 _xab = xab >= 0.382 and xab <= 0.618
 _abc = abc >= 0.382 and abc <= 0.618
 _bcd = bcd >= 0.382 and bcd <= 0.618
 _xad = xad >= 0.236 and xad <= 0.764
 _xab and _abc and _bcd and _xad and (_mode == 1 ? d < c : d > c)

isExpTria(_mode)=>
 _xab = xab >= 1.236 and xab <= 1.618
 _abc = abc >= 1.000 and abc <= 1.618
 _bcd = bcd >= 1.236 and bcd <= 2.000
 _xad = xad >= 2.000 and xad <= 2.236
 _xab and _abc and _bcd and _xad and (_mode == 1 ? d < c : d > c)

// 売りパターンが出現したところに印を表示
plotshape(not showPatterns ? na : isABCD(-1) and not isABCD(-1)[1], text="\nAB=CD", title='Bear ABCD', style=shape.labeldown, color=color.maroon, textcolor=color.white, location=location.top, transp=0, offset=-2)
plotshape(not showPatterns ? na : isBat(-1) and not isBat(-1)[1], text="Bat", title='Bear Bat', style=shape.labeldown, color=color.maroon, textcolor=color.white, location=location.top, transp=0, offset=-2)
plotshape(not showPatterns ? na : isAntiBat(-1) and not isAntiBat(-1)[1], text="Anti Bat", title='Bear Anti Bat', style=shape.labeldown, color=color.maroon, textcolor=color.white, location=location.top, transp=0, offset=-2)
plotshape(not showPatterns ? na : isAltBat(-1) and not isAltBat(-1)[1], text="Alt Bat", title='Bear Alt Bat', style=shape.labeldown, color=color.maroon, textcolor=color.white, location=location.top, transp=0)
plotshape(not showPatterns ? na : isButterfly(-1) and not isButterfly(-1)[1], text="Butterfly", title='Bear Butterfly', style=shape.labeldown, color=color.maroon, textcolor=color.white, location=location.top, transp=0)
plotshape(not showPatterns ? na : isAntiButterfly(-1) and not isAntiButterfly(-1)[1], text="Anti Butterfly", title='Bear Anti Butterfly', style=shape.labeldown, color=color.maroon, textcolor=color.white, location=location.top, transp=0)
plotshape(not showPatterns ? na : isGartley(-1) and not isGartley(-1)[1], text="Gartley", title='Bear Gartley', style=shape.labeldown, color=color.maroon, textcolor=color.white, location=location.top, transp=0)
plotshape(not showPatterns ? na : isAntiGartley(-1) and not isAntiGartley(-1)[1], text="Anti Gartley", title='Bear Anti Gartley', style=shape.labeldown, color=color.maroon, textcolor=color.white, location=location.top, transp=0)
plotshape(not showPatterns ? na : isCrab(-1) and not isCrab(-1)[1], text="Crab", title='Bear Crab', style=shape.labeldown, color=color.maroon, textcolor=color.white, location=location.top, transp=0)
plotshape(not showPatterns ? na : isAntiCrab(-1) and not isAntiCrab(-1)[1], text="Anti Crab", title='Bear Anti Crab', style=shape.labeldown, color=color.maroon, textcolor=color.white, location=location.top, transp=0)
plotshape(not showPatterns ? na : isShark(-1) and not isShark(-1)[1], text="Shark", title='Bear Shark', style=shape.labeldown, color=color.maroon, textcolor=color.white, location=location.top, transp=0)
plotshape(not showPatterns ? na : isAntiShark(-1) and not isAntiShark(-1)[1], text="Anti Shark", title='Bear Anti Shark', style=shape.labeldown, color=color.maroon, textcolor=color.white, location=location.top, transp=0)
plotshape(not showPatterns ? na : is5o(-1) and not is5o(-1)[1], text="5-O", title='Bear 5-O', style=shape.labeldown, color=color.maroon, textcolor=color.white, location=location.top, transp=0)
plotshape(not showPatterns ? na : isWolf(-1) and not isWolf(-1)[1], text="Wolf Wave", title='Bear Wolf Wave', style=shape.labeldown, color=color.maroon, textcolor=color.white, location=location.top, transp=0)
plotshape(not showPatterns ? na : isHnS(-1) and not isHnS(-1)[1], text="Head and Shoulders", title='Bear Head and Shoulders', style=shape.labeldown, color=color.maroon, textcolor=color.white, location=location.top, transp=0)
plotshape(not showPatterns ? na : isConTria(-1) and not isConTria(-1)[1], text="Contracting Triangle", title='Bear Contracting triangle', style=shape.labeldown, color=color.maroon, textcolor=color.white, location=location.top, transp=0)
plotshape(not showPatterns ? na : isExpTria(-1) and not isExpTria(-1)[1], text="Expanding Triangle", title='Bear Expanding Triangle', style=shape.labeldown, color=color.maroon, textcolor=color.white, location=location.top, transp=0)

// 買いパターンが出現したところに印を表示
plotshape(not showPatterns ? na : isABCD(1) and not isABCD(1)[1], text="AB=CD\n", title='Bull ABCD', style=shape.labelup, color=color.green, textcolor=color.white, location=location.bottom, transp=0)
plotshape(not showPatterns ? na : isBat(1) and not isBat(1)[1], text="Bat", title='Bull Bat', style=shape.labelup, color=color.green, textcolor=color.white, location=location.bottom, transp=0)
plotshape(not showPatterns ? na : isAntiBat(1) and not isAntiBat(1)[1], text="Anti Bat", title='Bull Anti Bat', style=shape.labelup, color=color.green, textcolor=color.white, location=location.bottom, transp=0)
plotshape(not showPatterns ? na : isAltBat(1) and not isAltBat(1)[1], text="Alt Bat", title='Bull Alt Bat', style=shape.labelup, color=color.green, textcolor=color.white, location=location.bottom, transp=0)
plotshape(not showPatterns ? na : isButterfly(1) and not isButterfly(1)[1], text="Butterfly", title='Bull Butterfly', style=shape.labelup, color=color.green, textcolor=color.white, location=location.bottom, transp=0)
plotshape(not showPatterns ? na : isAntiButterfly(1) and not isAntiButterfly(1)[1], text="Anti Butterfly", title='Bull Anti Butterfly', style=shape.labelup, color=color.green, textcolor=color.white, location=location.bottom, transp=0)
plotshape(not showPatterns ? na : isGartley(1) and not isGartley(1)[1], text="Gartley", title='Bull Gartley', style=shape.labelup, color=color.green, textcolor=color.white, location=location.bottom, transp=0)
plotshape(not showPatterns ? na : isAntiGartley(1) and not isAntiGartley(1)[1], text="Anti Gartley", title='Bull Anti Gartley', style=shape.labelup, color=color.green, textcolor=color.white, location=location.bottom, transp=0)
plotshape(not showPatterns ? na : isCrab(1) and not isCrab(1)[1], text="Crab", title='Bull Crab', style=shape.labelup, color=color.green, textcolor=color.white, location=location.bottom, transp=0)
plotshape(not showPatterns ? na : isAntiCrab(1) and not isAntiCrab(1)[1], text="Anti Crab", title='Bull Anti Crab', style=shape.labelup, color=color.green, textcolor=color.white, location=location.bottom, transp=0)
plotshape(not showPatterns ? na : isShark(1) and not isShark(1)[1], text="Shark", title='Bull Shark', style=shape.labelup, color=color.green, textcolor=color.white, location=location.bottom, transp=0)
plotshape(not showPatterns ? na : isAntiShark(1) and not isAntiShark(1)[1], text="Anti Shark", title='Bull Anti Shark', style=shape.labelup, color=color.green, textcolor=color.white, location=location.bottom, transp=0)
plotshape(not showPatterns ? na : is5o(1) and not is5o(1)[1], text="5-O", title='Bull 5-O', style=shape.labelup, color=color.green, textcolor=color.white, location=location.bottom, transp=0)
plotshape(not showPatterns ? na : isWolf(1) and not isWolf(1)[1], text="Wolf Wave", title='Bull Wolf Wave', style=shape.labelup, color=color.green, textcolor=color.white, location=location.bottom, transp=0)
plotshape(not showPatterns ? na : isHnS(1) and not isHnS(1)[1], text="Head and Shoulders", title='Bull Head and Shoulders', style=shape.labelup, color=color.green, textcolor=color.white, location=location.bottom, transp=0)
plotshape(not showPatterns ? na : isConTria(1) and not isConTria(1)[1], text="Contracting Triangle", title='Bull Contracting Triangle', style=shape.labelup, color=color.green, textcolor=color.white, location=location.bottom, transp=0)
plotshape(not showPatterns ? na : isExpTria(1) and not isExpTria(1)[1], text="Expanding Triangle", title='Bull Expanding Triangle', style=shape.labelup, color=color.green, textcolor=color.white, location=location.bottom, transp=0)

//
// 売買のロジック
////

//「fib_rangeに対する指定された比率の幅」を返す関数
f_last_fib( _rate ) => d > c ? d - ( fib_range * _rate ) : d + ( fib_range * _rate )

// ターゲット1の設定項目と初期値
////

// 上から
// 取引量
// エントリーの基準(0.236を超えていない)
// 利益確定幅
// ロスカット幅

target01_trade_size = input(title='Target 1 - Trade size:', type=input.float, defval=10000.00)
target01_ew_rate = input(title='Target 1 - Fib. Rate to use for Entry Window:', type=input.float, defval=0.236)
target01_tp_rate = input(title='Target 1 - Fib. Rate to use for TP:', type=input.float, defval=0.618)
target01_sl_rate = input(title='Target 1 - Fib. Rate to use for SL:', type=input.float, defval=-0.236)

// ターゲット2の設定
////

target02_active  = input(title='Target 2 - Active?', type=input.bool, defval=false)
target02_trade_size = input(title='Target 2 - Trade size:', type=input.float, defval=10000.00)
target02_ew_rate = input(title='Target 2 - Fib. Rate to use for Entry Window:', type=input.float, defval=0.236)
target02_tp_rate = input(title='Target 2 - Fib. Rate to use for TP:', type=input.float, defval=1.618)
target02_sl_rate = input(title='Target 2 - Fib. Rate to use for SL:', type=input.float, defval=-0.236)

// 買いのパターン
buy_patterns_00 = isABCD(1) or isBat(1) or isAltBat(1) or isButterfly(1) or isGartley(1) or isCrab(1) or isShark(1) or is5o(1) or isWolf(1) or isHnS(1) or isConTria(1) or isExpTria(1)
buy_patterns_01 = isAntiBat(1) or isAntiButterfly(1) or isAntiGartley(1) or isAntiCrab(1) or isAntiShark(1)

// 売りのパターン
sel_patterns_00 = isABCD(-1) or isBat(-1) or isAltBat(-1) or isButterfly(-1) or isGartley(-1) or isCrab(-1) or isShark(-1) or is5o(-1) or isWolf(-1) or isHnS(-1) or isConTria(-1) or isExpTria(-1)
sel_patterns_01 = isAntiBat(-1) or isAntiButterfly(-1) or isAntiGartley(-1) or isAntiCrab(-1) or isAntiShark(-1)

// ターゲット1の売買
////

// 買いのパターン & エントリーの基準を満たす → 買いエントリー
// 利確・損切りを超える → 買いの決済
target01_buy_entry = (buy_patterns_00 or buy_patterns_01) and close <= f_last_fib(target01_ew_rate)
target01_buy_close = high >= f_last_fib(target01_tp_rate) or low <= f_last_fib(target01_sl_rate)
strategy.entry('target01_buy', long=strategy.long, qty=target01_trade_size, comment='buy 01', when=target01_buy_entry)
strategy.close('target01_buy', when=target01_buy_close)

// 売りのパターン & エントリーの基準を満たす → 売りエントリー
// 利確・損切りを超える → 売りの決済
target01_sel_entry = (sel_patterns_00 or sel_patterns_01) and close >= f_last_fib(target01_ew_rate)
target01_sel_close = low <= f_last_fib(target01_tp_rate) or high >= f_last_fib(target01_sl_rate)
strategy.entry('target01_sell', long=strategy.short, qty=target01_trade_size, comment='sell 01', when=target01_sel_entry)
strategy.close('target01_sell', when=target01_sel_close)

// ターゲット2の売買
////

target02_buy_entry = target02_active and (buy_patterns_00 or buy_patterns_01) and close <= f_last_fib(target02_ew_rate)
target02_buy_close = target02_active and high >= f_last_fib(target02_tp_rate) or low <= f_last_fib(target02_sl_rate)
strategy.entry('target02_buy', long=strategy.long, qty=target02_trade_size, comment='buy 02', when=target02_buy_entry)
strategy.close('target02_buy', when=target02_buy_close)

target02_sel_entry = target02_active and (sel_patterns_00 or sel_patterns_01) and close >= f_last_fib(target02_ew_rate)
target02_sel_close = target02_active and low <= f_last_fib(target02_tp_rate) or high >= f_last_fib(target02_sl_rate)
strategy.entry('target02_sell', long=strategy.short, qty=target02_trade_size, comment='sell 02', when=target02_sel_entry)
strategy.close('target02_sell', when=target02_sel_close)
=====
Nov 21
コメント: 次の投稿
小次郎講師公式インジケーターのお申込
http://bit.ly/2vdSV4Q

小次郎講師のLINE@
http://bit.ly/2VZQFu3

小次郎講師のチャート情報局
http://bit.ly/2GvLAEp
ありがとうございます。スクリプトの勉強になります。
返信
@tx4187, ぜひ、ご活用ください^^
返信
ホーム 株式スクリーナー FXスクリーナー 仮想通貨スクリーナー 経済指標カレンダー 番組 使い方 チャート機能 価格 友達紹介 ハウスルール ヘルプセンター ウェブサイト&ブローカー向けソリューション ウィジェット チャートソリューション 軽量チャートライブラリ ブログ&ニュース ツイッター
プロフィール プロフィール設定 アカウントとお支払い 友達紹介 マイサポートチケット ヘルプセンター 公開したアイデア フォロワー フォロー中 プライベートメッセージ チャット サインアウト