Harigami
ログイン
pk-hangjing タイトルなし
No License Python
コピー
//@version=4
study(title="天秤アラート", overlay=true)

ru = close[1] + tr[1]
rd = close[1] - tr[1]
haClose = (open + high + low + close) / 4
haOpen  = float(na)
haOpen := na(haOpen[1]) ? (open + close) / 2 : (nz(haOpen[1]) + nz(haClose[1])) / 2
haHigh  = max(high, max(haOpen, haClose))
haLow   = min(low, min(haOpen, haClose))

LONG = high > ru and close > open
SHORT = low < rd and close < open

switch = 0
setA = 0
setB = 0

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

plotshape(setA, title="LONG", style=shape.labelup, text="L", color=color.white, textcolor=color.green, location=location.belowbar)
plotshape(setB, title="SHORT", style=shape.labeldown, text="S", color=color.white, textcolor=color.red, location=location.abovebar)
alertcondition(setA, title="LONG", message="LONG!")
alertcondition(setB, title="SHORT", message="SHORT!")
//@version=4
study(title="天秤アラート", overlay=true)

ru = close[1] + tr[1]
rd = close[1] - tr[1]
haClose = (open + high + low + close) / 4
haOpen  = float(na)
haOpen := na(haOpen[1]) ? (open + close) / 2 : (nz(haOpen[1]) + nz(haClose[1])) / 2
haHigh  = max(high, max(haOpen, haClose))
haLow   = min(low, min(haOpen, haClose))

LONG = high > ru and close > open
SHORT = low < rd and close < open

switch = 0
setA = 0
setB = 0

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

plotshape(setA, title="LONG", style=shape.labelup, text="L", color=color.white, textcolor=color.green, location=location.belowbar)
plotshape(setB, title="SHORT", style=shape.labeldown, text="S", color=color.white, textcolor=color.red, location=location.abovebar)
alertcondition(setA, title="LONG", message="LONG!")
alertcondition(setB, title="SHORT", message="SHORT!")
コンソール
現在、コメントはありません。
最初のコメンターになりませんか?