Harigami
ログイン
anonymous タイトルなし
Python
Dropped in website’s rankings? Try our new Slow Link building Service. 
We will run a slow & steady link building campaign for 7 days and send you a report with 140 live Social posts 
 
More info and more variations in posts: 
https://monkeydigital.co/product/daily-social-posting-service/ 
 
Thanks and regards 
Mike 
monkeydigital.co@gmail.com
  • 0
  • 0
LC23 タイトルなし
Python
//@version=3

strategy(title = "AWABI改")

source = hlc3
length = input(26, minval=1), multi = input(2.0, minval=0.001,title="シグマ", maxval=50)
len = input(14, minval=1, title="MA1")
len2 = input(20, minval=1, title="MA2")

//RSI
rsi1 = rsi(source, length)

// BB of RSI
basis = wma(rsi1, length)
dev = multi * stdev(rsi1, length)
upper = basis + dev
lower = basis - dev
br = (rsi1 - lower)/(upper - lower)
obLevel1 = input(1, "Over Bought Level 1")
obLevel2 = input(0.5, "Over Bought Level 2")
obLevel3 = input(0, "Over Bought Level 3")
//MA OF RSI
er = wma(br,len)
er2 = wma(br,len2)

//ENTRY条件
LONG = crossover(br,er)
SHORT = crossunder(br,er)
LONG1 = crossover(er,er2)
SHORT1 = crossunder(er,er2)
strategy.entry("LONG",true,when=LONG)
strategy.entry("SHORT",false,when=SHORT)

//COLOR
mc = er > er2 ? lime:red
plot(br, color=aqua)
plot(obLevel1, title="ov1",color=silver, style=3)
plot(obLevel2, title="ov2",color=silver, style=3)
plot(obLevel3, title="ov3",color=silver, style=3)
plot(er, title="MA1", style=line, linewidth=1, color=mc,transp=10)
plot(er2, title="MA2", style=line, linewidth=1, color=mc,transp=10)
fill(plot(er), plot(er2), color = mc)
bgcolor(LONG1 ? green : na, transp=90, offset=-1)
bgcolor(SHORT1 ? red : na, transp=90, offset=-1)
  • 0
  • 0
anonymous タイトルなし
Python
study(title="US10Y+EMA", shorttitle="US10Y+EMA")

// Security

us10y_C = security("TVC:US10Y", period, close)
us10y_H = security("TVC:US10Y", period, high)
us10y_L = security("TVC:US10Y", period, low)

//EMA

EMA1 = input(20, minval=1, title="EMA1"),
EMA2 = input(75, minval=1, title="EMA2")

// Plots
a = plot(us10y_H, style=line,  linewidth=1, color=lime)
b = plot(us10y_L, style=line,  linewidth=1, color=lime)
fill(a, b, color=gray, transp = 80)
plot(us10y_C, style=line,  linewidth=3,transp=5, color=lime)
plot(ema(us10y_C, EMA1), color=aqua,transp=5, linewidth=1)
plot(ema(us10y_C, EMA2), color=white,transp=5, linewidth=1)
  • 0
  • 0
anonymous タイトルなし
Python
//@version=3
study("MA20MTF GMMA", overlay=true)


A = input(title='5M', type=resolution, defval="1")
B = input(title='15M', type=resolution, defval="1")
C = input(title='30M', type=resolution, defval="1")
D = input(title='1H', type=resolution, defval="1")
E = input(title='4H', type=resolution, defval="1")


A1 = security(tickerid, A, sma(close, 100))
B1 = security(tickerid, B, sma(close, 300))
C1 = security(tickerid, C, sma(close, 600))
D1 = security(tickerid, D, sma(close, 1200))
E1 = security(tickerid, E, sma(close, 4800))



plot(A1 , color=gray, linewidth=1)
AL=plot(B1 , color=lime, linewidth=1)
BL=plot(C1 , color=lime, linewidth=1)
CL=plot(D1 , color=red, linewidth=1)
DL=plot(E1 , color=red, linewidth=1)
fill(AL,BL ,color=lime,transp=80)
fill(CL,DL ,color=red,transp=80)
  • 0
  • 0
anonymous タイトルなし
Python
print('hello world')
  • 0
  • 0
LC23 タイトルなし
Python
//@version=3

strategy(title = "AWABI改")

source = hlc3
length = input(26, minval=1), multi = input(2.0, minval=0.001,title="シグマ", maxval=50)
len = input(9, minval=1, title="MA1")
len2 = input(20, minval=1, title="MA2")

//RSI
rsi1 = rsi(source, length)

// BB of RSI
basis = wma(rsi1, length)
dev = multi * stdev(rsi1, length)
upper = basis + dev
lower = basis - dev
br = (rsi1 - lower)/(upper - lower)
obLevel1 = input(1, "Over Bought Level 1")
obLevel2 = input(0.5, "Over Bought Level 2")
obLevel3 = input(0, "Over Bought Level 3")
//MA OF RSI
er = wma(br,len)
er2 = wma(br,len2)

//ENTRY条件
LONG = crossover(br,er)
SHORT = crossunder(br,er)
LONG1 = crossover(er,er2)
SHORT1 = crossunder(er,er2)
strategy.entry("LONG",true,when=LONG)
strategy.entry("SHORT",false,when=SHORT)

//COLOR
mc = er > er2 ? lime:red
plot(br, color=aqua)
plot(obLevel1, title="ov1",color=silver, style=3)
plot(obLevel2, title="ov2",color=silver, style=3)
plot(obLevel3, title="ov3",color=silver, style=3)
plot(er, title="MA1", style=line, linewidth=1, color=mc,transp=10)
plot(er2, title="MA2", style=line, linewidth=1, color=mc,transp=10)
fill(plot(er), plot(er2), color = mc)
bgcolor(LONG1 ? green : na, transp=90, offset=-1)
bgcolor(SHORT1 ? red : na, transp=90, offset=-1)
  • 0
  • 1
anonymous タイトルなし
Python
#初期化
ans=[[[1,2,3,4,5,6,7,8,9]for i in range(9)]for j in range(9)]
data=[[0 for i in range(9)] for j in range(9)]

#入力
for i in range(9):
    data[i]=list(map(int,input().split()))


#確定したマスを周りのマスの数字から消す関数
def solve(i,j):
    for k in range(9):  # 縦
        if (k == j):
            continue
        if (data[i][j] in ans[i][k]):
            ans[i][k].remove(data[i][j])

    for k in range(9):  # 横
        if (k == i):
            continue
        if (data[i][j] in ans[k][j]):
            ans[k][j].remove(data[i][j])

    for k in range(3):  # 3×3
        for l in range(3):
            if (data[i][j] in ans[i + k - i % 3][j + l - j % 3]):
                if (k == i % 3 and l == j % 3):
                    continue
                ans[i + k - i % 3][j + l - j % 3].remove(data[i][j])
#関数ここまで

#最初から与えられているマスに値を入れる
for i in range(9):
    for j in range(9):
        if (data[i][j] != 0):
            ans[i][j] = [data[i][j], "END"]
        solve(i,j)

#一回の実行で1マスは絶対確定するから81回回せば理論上解ける(はず)
for x in range(81):
    for i in range(9):
        for j in range(9):
            if (len(ans[i][j]) == 1):

                data[i][j]=ans[i][j][0]
                solve(i, j)
                #確定したマスはENDをつけて次回からスキップ
                ans[i][j].append("END")

#ここまでで解き終わる

for i in range(9):
    for j in range(9):
        if("END" in ans[i][j]):
            ans[i][j].remove("END")
#ENDを外す

for i in range(9):
    for j in range(9):
        print(ans[i][j][0],end=" ")
    print()
#結果を出力
  • 0
  • 1
anonymous タイトルなし
Python
#初期化
ans=[[[1,2,3,4,5,6,7,8,9]for i in range(9)]for j in range(9)]
data=[[0 for i in range(9)] for j in range(9)]

#入力
for i in range(9):
    data[i]=list(map(int,input().split()))


#確定したマスを周りのマスの数字から消す関数
def solve(i,j):
    for k in range(9):  # 縦
        if (k == j):
            continue
        if (data[i][j] in ans[i][k]):
            ans[i][k].remove(data[i][j])

    for k in range(9):  # 横
        if (k == i):
            continue
        if (data[i][j] in ans[k][j]):
            ans[k][j].remove(data[i][j])

    for k in range(3):  # 3×3
        for l in range(3):
            if (data[i][j] in ans[i + k - i % 3][j + l - j % 3]):
                if (k == i % 3 and l == j % 3):
                    continue
                ans[i + k - i % 3][j + l - j % 3].remove(data[i][j])
#関数ここまで

#最初から与えられているマスに値を入れる
for i in range(9):
    for j in range(9):
        if (data[i][j] != 0):
            ans[i][j] = [data[i][j], "END"]
        solve(i,j)

#一回の実行で1マスは絶対確定するから81回回せば理論上解ける(はず)
for x in range(81):
    for i in range(9):
        for j in range(9):
            if (len(ans[i][j]) == 1):

                data[i][j]=ans[i][j][0]
                solve(i, j)
                #確定したマスはENDをつけて次回からスキップ
                ans[i][j].append("END")

#ここまでで解き終わる

for i in range(9):
    for j in range(9):
        if("END" in ans[i][j]):
            ans[i][j].remove("END")
#ENDを外す

for i in range(9):
    for j in range(9):
        print(ans[i][j],end=" ")
    print()
#結果を出力
  • 0
  • 0
anonymous タイトルなし
Python
import numpy as np
import time

def input_sudoku():
    L=[]
    for i in range(9):
        L.append([int(x) for x in input().split()])
    print(L)


def check(a):
    for x in range(9):
        for y in range(9):
            i=a[y][x]
            if i not in (row(a,y) | col(a,x) | sq(a,x,y)):
                return x,y
    return True

def row(a,n):
    return set(a[n])

def col(a,n):
    return set(a[:,n])

def sq(a,x,y):
    if y<=2:
        k=a[:3]
        if x<=2:
            k=k[:,:3]
        elif x<=5:
            k=k[:,3:6]
        else:
            k=k[:,6:9]
    elif y<=5:
        k=a[3:6]
        if x<=2:
            k=k[:,:3]
        elif x<=5:
            k=k[:,3:6]
        else:
            k=k[:,6:9]
    else:
        k=a[6:9]
        if x<=2:
            k=k[:,:3]
        elif x<=5:
            k=k[:,3:6]
        else:
            k=k[:,6:9]

    return set(k.flatten())

def print_if_progress(a,mx):#埋けれた数が増えた時のみその時の進捗を出力
    filled=np.count_nonzero(a!=0)
    if filled>mx:
        mx=filled
        print(mx)
        print(a)
    return mx


def dfs(a,mx):#mxの因数は出力用/なくても動く
    if np.min(a)!=0:
        return a
    space=np.argmin(a)#左上から左へ、下へと見ていき、最小値(==空白 : 0以外が最小値の時は、上のif文でreturn)のindex(スカラ)を返す
    x=space%9  #x座標
    y=space//9 #y座標
    for i in range(1,10):
        if i not in (row(a,y) | col(a,x) | sq(a,x,y)):
            a[y][x]=i

            mx=print_if_progress(a,mx)#出力/なくても動く
    
            r=dfs(a,mx)
            if r.shape[0]:
                return r
            
    a[y][x]=0
    
    return np.array([])

def main():
    L=[]
    for i in range(9):
        L.append([int(x) for x in input().split()])
   
    a=np.array(L)

    if a.shape!=(9,9):
        print('入力値エラー:各行半角スペース区切りで9つの数字が入っていることを確認してください')
        return

    start=time.time()
    
    result=dfs(a,0)
        
    print(time.time()-start,"sec")
    print('---------------------')

    if result.shape[0]:
        for row in result:
            print(" ".join([str(x) for x in row.tolist()]))
    else:
        print('有効な解がありません')


if __name__ == '__main__':
    main()
  • 0
  • 0
LC23 タイトルなし
Python
//@version=3

study(title = "AWABI改")

source = hlc3
length = input(26, minval=1), multi = input(2.0, minval=0.001,title="シグマ", maxval=50)
len = input(14, minval=1, title="MA1")
len2 = input(20, minval=1, title="MA2")

//RSI
rsi1 = rsi(source, length)

// BB of RSI
basis = wma(rsi1, length)
dev = multi * stdev(rsi1, length)
upper = basis + dev
lower = basis - dev
br = (rsi1 - lower)/(upper - lower)
obLevel1 = input(1, "Over Bought Level 1")
obLevel2 = input(0.5, "Over Bought Level 2")
obLevel3 = input(0, "Over Bought Level 3")
//MA OF RSI
er = wma(br,len)
er2 = wma(br,len2)

//ENTRY条件
LONG = crossover(er,er2)
SHORT = crossunder(er,er2)


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 = "LONG", message = "LLLLL!")
alertcondition(setB, title = "SHORT", message = "SSSSS!")



//COLOR
mc = er > er2 ? lime:red
plot(br, color=aqua)
plot(obLevel1, title="ov1",color=silver, style=3)
plot(obLevel2, title="ov2",color=silver, style=3)
plot(obLevel3, title="ov3",color=silver, style=3)
plot(er, title="MA1", style=line, linewidth=1, color=mc,transp=10)
plot(er2, title="MA2", style=line, linewidth=1, color=mc,transp=10)
fill(plot(er), plot(er2), color = mc)
bgcolor(setA ? green : na, transp=90, offset=-1)
bgcolor(setB ? red : na, transp=90, offset=-1)
  • 0
  • 0
あなたもコードを投稿しませんか?
投稿する