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


詳細設定
+
anonymous タイトルなし
PlainText
#!/bin/bash

#This script created by Midnight Express Ginga81(ginga81) 2019
#This script is Public Domain

#I checked this script on Ubuntu19.04 and Wine4.0.1 and winetricks 20190615-next

#This scrript creates to running environment with MikuMikuDance64 with MikuMikuEffect64 and PMXEditor64.
#適当なフォルダにこのスクリプトを用意し、実行すると自動的に準備を整えます。VCrun2008と2010は自動化できなかったので同意してインストールしてください。
#実行した後MikuMikuDance_v931x64.zipとPmxEditor_0254f.zip、MMEffect_x64_v037.zipをWindowsと同じ方法で
#~/.WineMMD64/drive_c/Program Files/以下に展開するだけです。
#実行は
#WINEPREFIX=~/.WineMMD64 wine ~/.WineMMD64/drive_c/Program\ Files/MikuMikuDance_v931x64/MikuMikuDance.exe
#WINEPREFIX=~/.WineMMD64 wine ~/.WineMMD64/drive_c/Program\ Files/PmxEditor_0254f/PmxEditor_x64.exe
#アンインストールは~/.WineMMD64をまるごと消せば終わりで、設定ファイルは残らず綺麗に消えます。

WINEPREFIX=~/.WineMMD64 wineboot
WINEPREFIX=~/.WineMMD64 winetricks -q vcrun2005 vcrun2008 vcrun2010 d3dx9 d3dxof d3dx9_43 fakejapanese_ipamona dotnet40 vcrun2013 devenum quartz qcap qedit win7 quartz gdiplus
WINEPREFIX=~/.WineMMD64 wine reg add HKCU\\Software\\Wine\\DllOverrides /v msvcr90 /t reg_sz /d "builtin"
WINEPREFIX=~/.WineMMD64 wine reg add HKCU\\Software\\Wine\\DllOverrides /v d3d9 /t reg_sz /d "native,builtin"
WINEPREFIX=~/.WineMMD64 wine reg add HKCU\\Software\\Wine\\DllOverrides /v d3dx9_43 /t reg_sz /d "native,builtin"
WINEPREFIX=~/.WineMMD64 wine reg add HKCU\\Software\\Wine\\DllOverrides /v d3dxof /t reg_sz /d "native,builtin"
WINEPREFIX=~/.WineMMD64 wine reg add HKCU\\Software\\Wine\\DllOverrides /v d3dx9 /t reg_sz /d "native,builtin"
WINEPREFIX=~/.WineMMD64 wine reg add HKCU\\Software\\Wine\\DllOverrides /v devenum /t reg_sz /d "native"
WINEPREFIX=~/.WineMMD64 wine reg add HKCU\\Software\\Wine\\DllOverrides /v quartz /t reg_sz /d "native,builtin"
WINEPREFIX=~/.WineMMD64 wine reg add HKCU\\Software\\Wine\\DllOverrides /v qcap /t reg_sz /d "native,builtin"
WINEPREFIX=~/.WineMMD64 wine reg add HKCU\\Software\\Wine\\DllOverrides /v qedit /t reg_sz /d "native,builtin"

#vcrun2008 https://www.microsoft.com/ja-jp/download/details.aspx?id=15336
wget -c https://download.microsoft.com/download/f/0/c/f0cf29d7-442e-49cd-98aa-eba28c2f8ab6/vcredist_x64.exe
mv ./vcredist_x64.exe ./vcredist_x64-2008.exe
WINEPREFIX=~/.WineMMD64 wine ./vcredist_x64-2008.exe

#vcrun2010 https://www.microsoft.com/ja-jp/download/details.aspx?id=14632
wget -c https://download.microsoft.com/download/3/2/2/3224B87F-CFA0-4E70-BDA3-3DE650EFEBA5/vcredist_x64.exe
mv ./vcredist_x64.exe ./vcredist_x64-2010.exe
WINEPREFIX=~/.WineMMD64 wine ./vcredist_x64-2010.exe

#d3dcompiler_43だけは必ず最後に入れなければならない。
WINEPREFIX=~/.WineMMD64 winetricks -q d3dcompiler_43
  • 0
  • 1
anonymous タイトルなし
Python
//@version=3
study(title="CCIBB")

//input CCI ------
cci_len = input(14, "CCI length")
cci_src = input(close, "CCI source")
//input BB ------
mult1 = input(1.0, minval=0.001, maxval=50, title="1シグマ")
mult2 = input(2.0, minval=0.001, maxval=50, title="2シグマ")
mult3 = input(3.0, minval=0.001, maxval=50, title="3シグマ")
length1 = input(14, minval=1, title="BB length1")
length2 = input(14, minval=1, title="BB length2")
length3 = input(14, minval=1, title="BB length3")
//CCI -----
cci = cci(cci_src, cci_len)

//BB -----
bb_src = cci
basis = sma(bb_src, length1)
dev = mult1 * stdev(bb_src, length1)
upper = basis + dev
lower = basis - dev
//BB2 -----
bb_src2 = cci
basis2 = sma(bb_src, length2)
dev2 = mult2 * stdev(bb_src, length2)
upper2 = basis2 + dev2
lower2 = basis2 - dev2
//BB3 -----
bb_src3 = cci
basis3 = sma(bb_src, length3)
dev3 = mult3 * stdev(bb_src, length3)
upper3 = basis3 + dev3
lower3 = basis3 - dev3
//plot -----
p1 = plot(upper, color=aqua, title="uppper band1")
p2 = plot(lower, color=aqua, title="lower band1")
p3 = plot(upper2, color=lime, title="uppper band2")
p4 = plot(lower2, color=lime, title="lower band2")
p5 = plot(upper3, color=green, title="uppper band3")
p6 = plot(lower3, color=green, title="lower band3")
plot(basis, color=yellow, style=cross,title="center line")
plot(cci, color=orange, transp=0, linewidth=1, title="CCI")
fill(p1 , p2 ,color=aqua,transp=95)
fill(p3 , p4 ,color=aqua,transp=95)
fill(p5 , p6 ,color=aqua,transp=95)
  • 0
  • 1
anonymous タイトルなし
Python
//@version=3
study(title="CCIBB")

//input CCI ------
cci_len = input(14, "CCI length")
cci_src = input(close, "CCI source")
//input BB ------
mult1 = input(1.0, minval=0.001, maxval=50, title="1シグマ")
mult2 = input(2.0, minval=0.001, maxval=50, title="2シグマ")
mult3 = input(3.0, minval=0.001, maxval=50, title="3シグマ")
length1 = input(14, minval=1, title="BB length1")
length2 = input(14, minval=1, title="BB length2")
length3 = input(14, minval=1, title="BB length3")
//CCI -----
cci = cci(cci_src, cci_len)

//BB -----
bb_src = cci
basis = sma(bb_src, length1)
dev = mult1 * stdev(bb_src, length1)
upper = basis + dev
lower = basis - dev
//BB2 -----
bb_src2 = cci
basis2 = sma(bb_src, length2)
dev2 = mult2 * stdev(bb_src, length2)
upper2 = basis2 + dev2
lower2 = basis2 - dev2
//BB3 -----
bb_src3 = cci
basis3 = sma(bb_src, length3)
dev3 = mult3 * stdev(bb_src, length3)
upper3 = basis3 + dev3
lower3 = basis3 - dev3
//plot -----
p1 = plot(upper, color=aqua, title="uppper band")
p2 = plot(lower, color=aqua, title="lower band")
p3 = plot(upper2, color=lime, title="uppper band")
p4 = plot(lower2, color=lime, title="lower band")
p5 = plot(upper3, color=green, title="uppper band")
p6 = plot(lower3, color=green, title="lower band")
plot(basis, color=yellow, style=cross,title="center line")
plot(cci, color=orange, transp=0, linewidth=1, title="CCI")
fill(p1 , p2 ,color=aqua,transp=95)
fill(p3 , p4 ,color=aqua,transp=95)
fill(p5 , p6 ,color=aqua,transp=95)
  • 0
  • 0
anonymous タイトルなし
Python
//@version=3
study(title="CCIBB")

//input CCI ------
cci_len = input(14, "CCI length")
cci_src = input(close, "CCI source")
//input BB ------
mult1 = input(1.0, minval=0.001, maxval=50, title="1シグマ")
mult2 = input(2.0, minval=0.001, maxval=50, title="2シグマ")
mult3 = input(3.0, minval=0.001, maxval=50, title="3シグマ")
length1 = input(14, minval=1, title="BB length1")
length2 = input(14, minval=1, title="BB length2")
length3 = input(14, minval=1, title="BB length3")
//CCI -----
cci = cci(cci_src, cci_len)

//BB -----
bb_src = cci
basis = sma(bb_src, length1)
dev = mult1 * stdev(bb_src, length1)
upper = basis + dev
lower = basis - dev
//BB2 -----
bb_src2 = cci
basis2 = sma(bb_src, length2)
dev2 = mult2 * stdev(bb_src, length2)
upper2 = basis2 + dev2
lower2 = basis2 - dev2
//BB3 -----
bb_src3 = cci
basis3 = sma(bb_src, length3)
dev3 = mult3 * stdev(bb_src, length3)
upper3 = basis3 + dev3
lower3 = basis3 - dev3
//plot -----
p1 = plot(upper, color=aqua, title="UBB1")
p2 = plot(lower, color=aqua, title="LBB2")
p3 = plot(upper2, color=lime, title="UBB2")
p4 = plot(lower2, color=lime, title="LBB2")
p5 = plot(upper3, color=green, title="UBB3")
p6 = plot(lower3, color=green, title="UBB3")
plot(basis, color=yellow, style=cross,title="center line")
plot(cci, color=orange, transp=0, linewidth=1, title="CCI")
fill(p1 , p2 ,color=aqua,transp=95)
fill(p3 , p4 ,color=aqua,transp=95)
fill(p5 , p6 ,color=aqua,transp=95)

buy = crossover(cci,lower2)
sel = crossunder(cci,upper2)
switch = 0
setA = 0
setB = 0

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

plotshape(setA,title="BUY",style=shape.triangleup,text="C",color=blue,textcolor=blue,location=location.belowbar)
plotshape(setB,title="SELL",style=shape.triangledown,text="H",color=red,textcolor=red,location=location.abovebar)

alertcondition(setA, title = "LONG", message = "売られすぎ")
alertcondition(setB, title = "SHORT", message = "買われすぎ")
  • 0
  • 0
anonymous タイトルなし
Python
//@version=3
study(title="CCIBB")

//input CCI ------
cci_len = input(14, "CCI length")
cci_src = input(close, "CCI source")
//input BB ------
mult1 = input(1.0, minval=0.001, maxval=50, title="1シグマ")
mult2 = input(2.0, minval=0.001, maxval=50, title="2シグマ")
mult3 = input(3.0, minval=0.001, maxval=50, title="3シグマ")
length1 = input(14, minval=1, title="BB length1")
length2 = input(14, minval=1, title="BB length2")
length3 = input(14, minval=1, title="BB length3")
//CCI -----
cci = cci(cci_src, cci_len)

//BB -----
bb_src = cci
basis = sma(bb_src, length1)
dev = mult1 * stdev(bb_src, length1)
upper = basis + dev
lower = basis - dev
//BB2 -----
bb_src2 = cci
basis2 = sma(bb_src, length2)
dev2 = mult2 * stdev(bb_src, length2)
upper2 = basis2 + dev2
lower2 = basis2 - dev2
//BB3 -----
bb_src3 = cci
basis3 = sma(bb_src, length3)
dev3 = mult3 * stdev(bb_src, length3)
upper3 = basis3 + dev3
lower3 = basis3 - dev3
//plot -----
p1 = plot(upper, color=aqua, title="uppper band")
p2 = plot(lower, color=aqua, title="lower band")
p3 = plot(upper2, color=lime, title="uppper band")
p4 = plot(lower2, color=lime, title="lower band")
p5 = plot(upper3, color=green, title="uppper band")
p6 = plot(lower3, color=green, title="lower band")
plot(basis, color=yellow, style=cross,title="center line")
plot(cci, color=orange, transp=0, linewidth=1, title="CCI")
fill(p1 , p2 ,color=aqua,transp=95)
fill(p3 , p4 ,color=aqua,transp=95)
fill(p5 , p6 ,color=aqua,transp=95)

buy = crossover(cci,lower2)
sel = crossunder(cci,upper2)
switch = 0
setA = 0
setB = 0

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

plotshape(setA,title="BUY",style=shape.triangleup,text="C",color=blue,textcolor=blue,location=location.belowbar)
plotshape(setB,title="SELL",style=shape.triangledown,text="H",color=red,textcolor=red,location=location.abovebar)

alertcondition(setA, title = "LONG", message = "売られすぎ")
alertcondition(setB, title = "SHORT", message = "買われすぎ")
  • 0
  • 1
anonymous タイトルなし
Python
//@version=3
study(title="CCIBB")

//input CCI ------
cci_len = input(14, "CCI length")
cci_src = input(close, "CCI source")
//input BB ------
mult1 = input(1.0, minval=0.001, maxval=50, title="1シグマ")
mult2 = input(2.0, minval=0.001, maxval=50, title="2シグマ")
mult3 = input(3.0, minval=0.001, maxval=50, title="3シグマ")
length1 = input(14, minval=1, title="BB length1")
length2 = input(14, minval=1, title="BB length2")
length3 = input(14, minval=1, title="BB length3")
//CCI -----
cci = cci(cci_src, cci_len)

//BB -----
bb_src = cci
basis = sma(bb_src, length1)
dev = mult1 * stdev(bb_src, length1)
upper = basis + dev
lower = basis - dev
//BB2 -----
bb_src2 = cci
basis2 = sma(bb_src, length2)
dev2 = mult2 * stdev(bb_src, length2)
upper2 = basis2 + dev2
lower2 = basis2 - dev2
//BB3 -----
bb_src3 = cci
basis3 = sma(bb_src, length3)
dev3 = mult3 * stdev(bb_src, length3)
upper3 = basis2 + dev2
lower3 = basis2 - dev2
//plot -----
p1 = plot(upper, color=aqua, title="uppper band")
p2 = plot(lower, color=aqua, title="lower band")
p3 = plot(upper2, color=lime, title="uppper band")
p4 = plot(lower2, color=lime, title="lower band")
p5 = plot(upper3, color=green, title="uppper band")
p6 = plot(lower3, color=green, title="lower band")
plot(basis, color=yellow, style=cross,title="center line")
plot(cci, color=orange, transp=0, linewidth=1, title="CCI")
fill(p1 , p2 ,color=aqua,transp=95)
fill(p3 , p4 ,color=aqua,transp=95)
fill(p5 , p6 ,color=aqua,transp=95)

buy = crossover(cci,lower3)
sel = crossunder(cci,upper3)
switch = 0
setA = 0
setB = 0

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

plotshape(setA,title="BUY",style=shape.triangleup,text="C",color=blue,textcolor=blue,location=location.belowbar)
plotshape(setB,title="SELL",style=shape.triangledown,text="H",color=red,textcolor=red,location=location.abovebar)

alertcondition(setA, title = "LONG", message = "売られすぎ")
alertcondition(setB, title = "SHORT", message = "買われすぎ")
  • 0
  • 0
anonymous タイトルなし
C++
#include <bits/stdc++.h>
using namespace std;
#define ALL(A) (A).begin(),(A).end()
#define ll long long
const ll mod = 1234567;
const ll INF = 2*1e18;
const int inf = 1e9+7;
ll dp[500005];
ll h[500005];
ll b[500005];
int N,P;

bool isOK(int index,ll key){
	if(h[index]>=key)return 1;
	else return 0;
}

int bs(ll key){
	int ok = N+1;
	int ng = -1;
	while(abs(ok-ng)>1){
		int mid = (ok+ng)/2;
		if(isOK(mid,key))ok=mid;
		else ng = mid;
	}
	return ok;
}
int main(void){
	cin >> N >> P;
	for(int i=1;i<=N;i++){
		int a;cin>>a;
		h[i]=h[i-1]+a;
	}
	for(int i=1;i<=N;i++)cout << h[i] <<endl;
	dp[0]=1;
	//h[i]の高さはh[i]-h[i-1];で出せる
	//どの区間まで足せるかを考える
	for(int i=0;i<=N;i++){
		int ng = bs(P+h[i]+1);
		printf("%d から %dまで飛べる\n",i,ng-1);
		dp[i+1]+=dp[i];
		dp[ng]-=dp[i];
	}
	for(int i=1;i<=N;i++){
		dp[i]=dp[i-1]+dp[i];
	}
	cout << dp[N] << endl;
}
  • 0
  • 1
anonymous タイトルなし
Python
//@version=3
strategy("Momentum Strategy", overlay=false)
length = input(12)
price = close

momentum(seria, length) =>
    mom = seria - seria[length]
    mom

mom0 = momentum(price, length)
mom1 = momentum( mom0, 1)

if (mom0 > 0 and mom1 > 0)
    strategy.entry("MomLE", strategy.long, stop=high+syminfo.mintick, comment="LONG")
else
    strategy.cancel("MomLE")

if (mom0 < 0 and mom1 < 0)
    strategy.entry("MomSE", strategy.short, stop=low-syminfo.mintick, comment="SHORT")
else
    strategy.cancel("MomSE")

plot(mom0,color=lime)
plot(mom1,color=red)
hline(0)
  • 0
  • 1
anonymous タイトルなし
Python
//@version=3
strategy("Stochastic Slow Strategy", overlay=false)
length = input(14, minval=1)
OverBought = input(80)
OverSold = input(20)
smoothK = 3
smoothD = 3

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

if (not na(k) and not na(d))
    if (crossover(k,d) and k < OverSold)
        strategy.entry("StochLE", strategy.long, comment="LONG")
    if (crossunder(k,d) and k > OverBought)
        strategy.entry("StochSE", strategy.short, comment="SHORT")

plot(OverBought,color=red,style=3)
plot(OverSold,color=lime,style=3)
plot(k,color=aqua)
plot(d,color=purple)
  • 0
  • 1
anonymous タイトルなし
Python
//@version=3
strategy("Momentum Strategy", overlay=false)
length = input(12)
price = close

momentum(seria, length) =>
    mom = seria - seria[length]
    mom

mom0 = momentum(price, length)
mom1 = momentum( mom0, 1)

if (mom0 > 0 and mom1 > 0)
    strategy.entry("MomLE", strategy.long, stop=high+syminfo.mintick, comment="LONG")
else
    strategy.cancel("MomLE")

if (mom0 < 0 and mom1 < 0)
    strategy.entry("MomSE", strategy.short, stop=low-syminfo.mintick, comment="SHORT")
else
    strategy.cancel("MomSE")

plot(mom0,color=lime)
plot(mom1,color=red)
  • 0
  • 0