Harigami
ログイン
Harigamiは、ログイン不要のコード共有サービスです。コードの投稿後に発行されるURLでコードを共有できます。
PythonやRubyなど一部の言語は、投稿後にオンラインで実行することもできます。
誰でも無料で使えて、広告もありません。コードレビューやスニペットの代わりに使ってみてください。


詳細設定
+
1233343536
anonymous タイトルなし
Python
//@version=3
study("DCCフィボナッチ", overlay=true)

//DCCF
len=input(37, "DCC期間")
h3=highest(high,len)
l3=lowest(low,len)  
len2=h3-l3        
h2=h3-len2*0.236    
h1=h3-len2*0.382   
l1=h3-len2*0.618    
l2=h3-len2*0.764    
basis= avg(l3, h3)
//ENTRY&ALERT
LONG = cross(high,h3) 
SHORT = cross(low,l3)

switch = 0
setA = 0
setB = 0

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

alertcondition(setA, title = "HIGHT", message = "HIGHT")
alertcondition(setB, title = "LOW", message = "LOW")
//COLOR
fill(plot(h3, title="+3σ"), plot(l3, title="-3σ"), color = aqua) 
fill(plot(h2, title="+2σ"), plot(l2, title="-2σ"), color = aqua) 
fill(plot(h1, title="+1σ"), plot(l1, title="-1σ"), color = aqua) 
plot(basis,color=orange,style=cross)

plotshape(setA,title="HIGHT",style=shape.triangleup,text="HI",color=blue,textcolor=blue,location=location.belowbar)
plotshape(setB,title="LOW",style=shape.triangledown,text="LO",color=red,textcolor=red,location=location.abovebar)
  • 0
  • 1
anonymous タイトルなし
Python
//@version=3
strategy("pivot reverse", overlay=true)

//pivot
len=4
len2=20
pL = input(len,minval=1,title="left")
pR = input(len2,minval=1,title="right")
SL     = input(true,title="line")
maxLvlLen        = input(20,minval=0, title="line")
pvthi = pivothigh(pL,pR)
pvtlo = pivotlow(pL,pR)
swh = pivothigh(pL, pR)
swl = pivotlow(pL, pR)

//entry
swh_cond = not na(swh)

hprice = 0.0
hprice := swh_cond ? swh : hprice[1]

le = false
le := swh_cond ? true : (le[1] and high > hprice ? false : le[1])

if (le)
    strategy.entry("BUY", strategy.long, comment="L", stop=hprice + syminfo.mintick)

swl_cond = not na(swl)

lprice = 0.0
lprice := swl_cond ? swl : lprice[1]


se = false
se := swl_cond ? true : (se[1] and low < lprice ? false : se[1])

if (se)
    strategy.entry("SEL", strategy.short, comment="S", stop=lprice - syminfo.mintick)

//coler&etc.

counthi = 0.0 
counthi := pvthi[1] ? 0 : nz(counthi[1])+1
countlo = 0.0
countlo := pvtlo[1] ? 0 : nz(countlo[1])+1
pvthis = 0.0
pvthis := pvthi[1] ? high[pR+1] : pvthis[1]
pvtlos = 0.0
pvtlos := pvtlo[1] ? low[pR+1] :  pvtlos[1]
hipc = (pvthis != pvthis[1]) ? na : blue
lopc = (pvtlos != pvtlos[1]) ? na: red
h2l= (pvthis+pvtlos)/2
plot(SL and (maxLvlLen==0 or counthi<maxLvlLen)? pvthis : na, color=hipc, transp=30, linewidth=1, offset=-pR-1, title="H-line", trackprice=false)
plot(SL and (maxLvlLen==0 or countlo<maxLvlLen)? pvtlos : na, color=lopc, transp=30, linewidth=1, offset=-pR-1, title="L-line", trackprice=false)
  • 2
  • 0
anonymous タイトルなし
Python
//@version=3
strategy("CB", overlay=true)
len=37
//DCC
i2 = input(len, "DCC", type=integer, minval=3)
eh = highest(high,i2)
el = lowest(low,i2)
r = eh - el
k = (close - el) / r
upBound = highest(high, i2)
downBound = lowest(low, i2)

//ENTRY
if (not na(close[i2]))
    strategy.entry("CBL", strategy.long, stop=upBound + syminfo.mintick, comment="L")
    strategy.entry("ChS", strategy.short, stop=downBound - syminfo.mintick, comment="S")


//COLOR
P1 = plot(eh,color=aqua)
P2 = plot(el,color=aqua)
fill(P1 , P2 ,color=aqua)
  • 0
  • 0
anonymous ABC124 A
Python
A, B = map(int, input().split())

num = max(A, B)

if A == B:
    print(num + num)
else:
    print(num + num - 1)
  • 0
  • 0
anonymous ABC125 B
Python
N = int(input())
V = list(map(int, input().split()))
C = list(map(int, input().split()))

sum = 0

for i in range(N):
    if V[i] - C[i] > 0:
        sum += V[i] - C[i]

print(sum)
  • 0
  • 0
anonymous ABC125 A
Python
A, B, T = map(int, input().split())

sum = 0
for s in range(1, T+1):
    if s % A == 0:
        sum += B

print(sum)
  • 0
  • 0
anonymous ABC126 B
Python
S = input()

aa = S[0:2]
bb = S[2:4]


def isYY(yy):
    if 0 <= int(yy) and int(yy) <= 99:
        return True
    else:
        return False


def isMM(mm):
    if 1 <= int(mm) and int(mm) <= 12:
        return True
    else:
        return False


ans = []
if isYY(aa) and isMM(bb):
    # YYMM
    ans.append('YYMM')
if isMM(aa) and isYY(bb):
    # MMYY
    ans.append('MMYY')

if len(ans) >= 2:
    print('AMBIGUOUS')
elif len(ans) == 1:
    print(ans[0])
else:
    print('NA')
  • 0
  • 0
anonymous ABC127 B
Python
r, D, x2 = map(int, input().split())

for _ in range(0, 10):
    nx = r * x2 - D
    print(nx)
    x2 = nx
  • 0
  • 0
anonymous ABC127
Python
A, B = map(int, input().split())

if A >= 13:
    print(B)
elif 6 <= A and A <= 12:
    print(int(B/2))
elif A <= 5:
    print(0)
  • 0
  • 0
anonymous タイトルなし
Ruby
nil
  • 0
  • 0
1233343536