Harigami
ログイン
LC23 タイトルなし
No License Python
コピー
//@version=3
study("Stochastic Slow alert", overlay=true)
length = input(14, minval=1)
OverBought = input(70)
OverSold = input(30)
smoothK = 3
smoothD = 3

k = sma(stoch(close, high, low, length), smoothK)
d = sma(k, smoothD)

A = crossover(k,d) and k < OverSold
B = crossunder(k,d) and k > OverBought
C = crossover(k,d) 
D = crossunder(k,d)


switch = 0
setA = 0
setB = 0

if (A and (switch[1] == 0))
    switch := 1
    setA := 1
    setB := 0
else    
    if (B and (switch[1] == 0))
        switch := 0
        setA := 0
        setB := 1
    else
        switch := nz(switch[0],0)
        setA := 0
        setB := 0

plotshape(setA,title="LONG",style=shape.triangleup,text="L",color=blue,textcolor=blue,location=location.belowbar)
plotshape(setB,title="SHORT",style=shape.triangledown,text="S",color=red,textcolor=red,location=location.abovebar)
plotshape(D,title="LONG",style=shape.triangleup,text="LCL",color=purple,textcolor=purple,location=location.belowbar)
plotshape(C,title="SHORT",style=shape.triangledown,text="SCL",color=purple,textcolor=purple,location=location.abovebar)

alertcondition(setA, title = "LONG", message = "ロングチャンス!")
alertcondition(setB, title = "SHORT", message = "ショートチャンス!")
alertcondition(D, title = "LONG", message = "L撤退")
alertcondition(C, title = "SHORT", message = "S撤退")
//@version=3
study("Stochastic Slow alert", overlay=true)
length = input(14, minval=1)
OverBought = input(70)
OverSold = input(30)
smoothK = 3
smoothD = 3

k = sma(stoch(close, high, low, length), smoothK)
d = sma(k, smoothD)

A = crossover(k,d) and k < OverSold
B = crossunder(k,d) and k > OverBought
C = crossover(k,d) 
D = crossunder(k,d)


switch = 0
setA = 0
setB = 0

if (A and (switch[1] == 0))
    switch := 1
    setA := 1
    setB := 0
else    
    if (B and (switch[1] == 0))
        switch := 0
        setA := 0
        setB := 1
    else
        switch := nz(switch[0],0)
        setA := 0
        setB := 0

plotshape(setA,title="LONG",style=shape.triangleup,text="L",color=blue,textcolor=blue,location=location.belowbar)
plotshape(setB,title="SHORT",style=shape.triangledown,text="S",color=red,textcolor=red,location=location.abovebar)
plotshape(D,title="LONG",style=shape.triangleup,text="LCL",color=purple,textcolor=purple,location=location.belowbar)
plotshape(C,title="SHORT",style=shape.triangledown,text="SCL",color=purple,textcolor=purple,location=location.abovebar)

alertcondition(setA, title = "LONG", message = "ロングチャンス!")
alertcondition(setB, title = "SHORT", message = "ショートチャンス!")
alertcondition(D, title = "LONG", message = "L撤退")
alertcondition(C, title = "SHORT", message = "S撤退")
コンソール
現在、コメントはありません。
最初のコメンターになりませんか?