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


詳細設定
+
anonymous タイトルなし
Python
//@version=3
study("MTF 8 SMA/EMA", overlay=true)

// SMA or EMA
SEswitch = input(title="on:EMA off:SMA", type=bool, defval=true)

//Get EMA Values
maA = input(title='MA1 期間', type=integer, minval=1, step=1, defval=10)
maB = input(title='MA2 期間', type=integer, minval=1, step=1, defval=75)
maC = input(title='MA3 期間', type=integer, minval=1, step=1, defval=10)
maD = input(title='MA4 期間', type=integer, minval=1, step=1, defval=20)
maE = input(title='MA5 期間', type=integer, minval=1, step=1, defval=75)
maF = input(title='MA6 期間', type=integer, minval=1, step=1, defval=10)
maG = input(title='MA7 期間', type=integer, minval=1, step=1, defval=75)
maH = input(title='MA8 期間', type=integer, minval=1, step=1, defval=10)

//Set resolutions
resA = input(title='MA1 時間足', type=resolution, defval="15")
resB = input(title='MA2 時間足', type=resolution, defval="15")
resC = input(title='MA3 時間足', type=resolution, defval="60")
resD = input(title='MA4 時間足', type=resolution, defval="60")
resE = input(title='MA5 時間足', type=resolution, defval="60")
resF = input(title='MA6 時間足', type=resolution, defval="240")
resG = input(title='MA7 時間足', type=resolution, defval="240")
resH = input(title='MA8 時間足', type=resolution, defval="1440")

//Set switches
emaAswitch = input(title="MA1 On/Off", type=bool, defval=true)
emaBswitch = input(title="MA2 On/Off", type=bool, defval=true)
emaCswitch = input(title="MA3 On/Off", type=bool, defval=true)
emaDswitch = input(title="MA4 On/Off", type=bool, defval=true)
emaEswitch = input(title="MA5 On/Off", type=bool, defval=true)
emaFswitch = input(title="MA6 On/Off", type=bool, defval=true)
emaGswitch = input(title="MA7 On/Off", type=bool, defval=true)
emaHswitch = input(title="MA8 On/Off", type=bool, defval=true)

//get data
dataA = security(tickerid, resA, SEswitch ? ema(close, maA) : sma(close, maA))
dataB = security(tickerid, resB, SEswitch ? ema(close, maB) : sma(close, maB))
dataC = security(tickerid, resC, SEswitch ? ema(close, maC) : sma(close, maC))
dataD = security(tickerid, resD, SEswitch ? ema(close, maD) : sma(close, maD))
dataE = security(tickerid, resE, SEswitch ? ema(close, maE) : sma(close, maE))
dataF = security(tickerid, resF, SEswitch ? ema(close, maF) : sma(close, maF))
dataG = security(tickerid, resG, SEswitch ? ema(close, maG) : sma(close, maG))
dataH = security(tickerid, resH, SEswitch ? ema(close, maH) : sma(close, maH))


//Plotting
plot(emaAswitch ? dataA : na, color=lime, linewidth=3)
plot(emaBswitch ? dataB : na, color=aqua, linewidth=3)
plot(emaCswitch ? dataC : na, color=orange, linewidth=3)
plot(emaDswitch ? dataD : na, color=yellow, linewidth=3)
plot(emaEswitch ? dataE : na, color=olive, linewidth=3)
plot(emaFswitch ? dataF : na, color=fuchsia, linewidth=3)
plot(emaGswitch ? dataG : na, color=maroon, linewidth=3)
plot(emaHswitch ? dataH : na, color=white, linewidth=4)
  • 0
  • 0
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
anonymous タイトルなし
MATLAB
n = 1000;

av1 = 0;
av2 = 1;
n1 = 30;
n2 = 30;
sigma1 = 1;
sigma2 = 2;

ps = length(n);
for I = 1:n
    
    % rng(123)
    x1 = randn(1, n1)*sigma1 + av1;
    x2 = randn(1, n1)*sigma2 + av2;

    [~, p] = ttest(x1, x2);
    ps(I) = log(p);

    % pairs(table(x1', x2'))
end

histogram(ps)
xline(log(0.05));
  • 0
  • 1
anonymous 簡易検索ロジック
PHP
<?php

    $dsn = 'mysql:dbname=DB名;host=localhost;charset=utf8';
    $user = 'root';
    $password = '';
    $dbh = new PDO($dsn,$user,$password);
    $dbh->setAttribute(PDO::ATTR_ERRMODE,PDO::ERRMODE_EXCEPTION);

    if(isset($_GET['namesearch'])){
      $namesearch = $_GET['namesearch'];
    }else{
      $namesearch = '';
    }
    if(isset($_GET['codesearch'])){
      $codesearch = $_GET['codesearch'];
    }else{
      $codesearch = '';
    }

    $sql = 'SELECT code,name FROM テーブル名 WHERE code LIKE "%'.$codesearch.'%" AND name LIKE "%'.$namesearch.'%"';

    $stmt = $dbh->prepare($sql);
    $stmt->execute();

    $dbh = null;

    echo '<form method="get">';
    echo '<input type="text" placeholder="No." name="codesearch" value="'.$codesearch.'">';
    echo '<input type="text" placeholder="氏名" name="namesearch" value="'.$namesearch.'">';
    echo '<input type="submit" value="検索">';
    echo '</form>';

    echo '一覧<br/><br/>';

    while(true){
      $rec = $stmt->fetch(PDO::FETCH_ASSOC);
      if($rec == false){
        break;
      }
      echo $rec['code'].'.';
      echo $rec['name'];
      echo '<br/>';
    }

?>
  • 0
  • 1
anonymous 簡易検索ロジック
PHP
<?php

    $dsn = 'mysql:dbname=DB名;host=localhost;charset=utf8';
    $user = 'root';
    $password = '';
    $dbh = new PDO($dsn,$user,$password);
    $dbh->setAttribute(PDO::ATTR_ERRMODE,PDO::ERRMODE_EXCEPTION);

    if(isset($_GET['namesearch'])){
      $namesearch = $_GET['namesearch'];
    }else{
      $namesearch = '';
    }
    if(isset($_GET['codesearch'])){
      $codesearch = $_GET['codesearch'];
    }else{
      $codesearch = '';
    }

    $sql = 'SELECT code,name FROM テーブル名 WHERE code LIKE "%'.$codesearch.'%" AND name LIKE "%'.$namesearch.'%"';

    $stmt = $dbh->prepare($sql);
    $stmt->execute();

    $dbh = null;

    echo '<form method="get">';
    echo '<input type="text" placeholder="No." name="codesearch" value="'.$codesearch.'">';
    echo '<input type="text" placeholder="氏名" name="namesearch" value="'.$namesearch.'">';
    echo '<input type="submit" value="検索">';
    echo '</div></div>';
    echo '</form>';

    echo '一覧<br/><br/>';

    while(true){
      $rec = $stmt->fetch(PDO::FETCH_ASSOC);
      if($rec == false){
        break;
      }
      echo $rec['code'].'.';
      echo $rec['name'];
      echo '<br/>';
    }

?>
  • 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