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


詳細設定
+
anonymous タイトルなし
JavaScript
        class Person {
            constructor(firstName) {
                this.firstName = firstName;
            }
            myName() {
                return this.firstName;
            }
        }

        var name = new Person('fukushima');
        console.log(name.myName());

/*
*以下、エラー内容
*Uncaught TypeError: name.myName is not a function at top2.html:20
*/
  • 0
  • 1
anonymous タイトルなし
JavaScript
        class Person {
            constructor(firstName) {
                this.firstName = firstName;
            }
            myName() {
                return this.firstName;
            }
        }

        var name = new Person('fukushima');
        console.log(name.myName());

/*
以下、エラー
Uncaught TypeError: name.myName is not a function at top2.html:20
*/
  • 0
  • 0
anonymous タイトルなし
JavaScript
        class Person {
            constructor(firstName) {
                this.firstName = firstName;
            }
            myName() {
                return this.firstName;
            }
        }

        var name = new Person('fukushima');
        console.log(name.myName());





        class User {
            constructor(name, age) {
                this.name = name;
                this.age = age;
            }
            getName() {
                return this.name + this.age;
            }
        }

        //インスタンスを生成する
        var taro = new User('太郎', 32);
        console.log(taro.getName());
        document.querySelector("h1").innerHTML = taro.getName();
  • 0
  • 0
anonymous タイトルなし
JavaScript
        class Person {
            constructor(firstName) {
                this.firstName = firstName;
            }
            myName() {
                return this.firstName;
            }
        }

        var name = new Person('fukushima');
        console.log(name.myName());
  • 0
  • 0
LC23 タイトルなし
Python
//@version=3
strategy("Parabolic SAR Strategy", overlay=true)

start = input(0.02)
increment = input(0.02)
maximum = input(0.2)

psar = sar(start, increment, maximum)

if (psar >= high)
    strategy.entry("ParLE", strategy.long, stop=psar, comment="LONG")
else
    strategy.cancel("ParLE")

if (psar <= low)
    strategy.entry("ParSE", strategy.short, stop=psar, comment="SHORT")
else
    strategy.cancel("ParSE")

plot(psar,color=lime,style =circles,linewidth = 2)
  • 0
  • 1
リキマル タイトルなし
Python
//@version=3
strategy(title = "MAcross&trnd", overlay = true)

len = input(20, minval=1, title="SMA")
len1 = input(20, minval=1, title="EMA")
len2 = input(120, minval=1, title="TREND MA")
ma1 = sma(close,len)
ma2 = ema(close,len1)
ma3 = sma(close,len2)
buy = crossover(ma1,ma2) and ma1>ma3
sel = crossunder(ma1,ma2) and ma1<ma3


strategy.entry("BUY",  strategy.long , when=buy)
strategy.entry("SELL", strategy.short, when=sel)

plot(ma1,color=lime,linewidth=1)
plot(ma2,color=red,linewidth=1)
plot(ma3,color=aqua,linewidth=1)
  • 0
  • 0
リキマル タイトルなし
Python
//@version=3
study(title = "BBMA-PO")

source = hlc3
length = input(20, minval=1), mult = input(2.0, minval=0.001, maxval=50)
len = input(15, minval=1, title="FASTMA")
len2 = input(20, minval=1, title="FASTMA2")
len3 = input(35, minval=1, title="FASTMA3")
len4 = input(55, minval=1, title="SLOWMA")
len5 = input(85, minval=1, title="SLOWMA2")
len6 = input(120, minval=1, title="SLOWMA3")
hiline = input(0.8, "HL")
lowline = input(0.2, "LL")
showPerfectOrder = input(title="Show Perfect Order?", type=bool, defval=true)
//RSI
rsi1 = rsi(source, length)

// BB of RSI
basis = sma(rsi1, length)
dev = mult * stdev(rsi1, length)
upper = basis + dev
lower = basis - dev
br = (rsi1 - lower)/(upper - lower)

//MA OF RSI
er = ema(br,len)
er2 = ema(br,len2)
er3 = ema(br,len3)
er4 = ema(br,len4)
er5 = ema(br,len5)
er6 = ema(br,len6)
//COLOR

plot(er, title="FMA", style=line, linewidth=1, color=lime,transp=10)
plot(er2, title="FMA2", style=line, linewidth=1, color=red,transp=10)
plot(er3, title="FMA3", style=line, linewidth=1, color=yellow,transp=10)
plot(er4, title="SMA", style=line, linewidth=1, color=purple,transp=10)
plot(er5, title="SMA2", style=line, linewidth=1, color=aqua,transp=10)
plot(er6, title="SMA3", style=line, linewidth=1, color=orange,transp=10)
plot(hiline, title="HL",color=gray,style =circles,linewidth = 1)
plot(lowline, title="LL",color=gray,style =circles,linewidth = 1)

perfectOrderByUpTrend = er[1] > er2[1] and er3[1] > er4[1] and er5[1] > er6[1] ? true : false
perfectOrderByDownTrend = er[1] < er2[1] and er3[1] < er4[1] and er5[1] < er6[1] ? true : false
bgcolor(perfectOrderByUpTrend and showPerfectOrder ? green : white, transp=90, offset=-1)
bgcolor(perfectOrderByDownTrend and showPerfectOrder ? red : white, transp=90, offset=-1)
  • 0
  • 0
リキマル タイトルなし
Python
//
// @author Jadbrother modified by gero, optimized by yuza
//
//@version=3
study(title = "RCI3lines optimized", shorttitle = "RCI3lines opt") 

itvs = input(9, "short interval")
itvm = input(26, "middle interval")
itvl = input(52, "long interval")
src = input(close, "source")
res = input(9, "resolution", minval=9)
upperband=input(title="High line[%]",defval=80,type=integer)
lowerband=input(title="Low line[%]",defval=-80,type=integer)
dmul = 600 / res / (res*res-1)

ord(seq, idx, itv) =>
    p = seq[idx]
    o = 0.5
    for i = 0 to res-1
        d = (p - seq[i*itv])
        o := o + ((d<0) ? 1 : ((d==0) ? 0.5 : 0))
    o

d(itv) =>
    sum = 0.0
    step = itv/res
    for i = 0 to res-1
        x = (i + 1) - ord(src, i*step, step)
        sum := sum + x*x
    sum

rci(itv) => sma(100.0 - dmul * d(itv), ceil(itv/res))

hline(upperband,color=gray,linestyle=dashed)
hline(lowerband,color=gray,linestyle=dashed)
plot(rci(itvs), title = "RCI short", color = red)
plot(rci(itvm), title = "RCI middle", color = blue)
plot(rci(itvl), title = "RCI long", color = green)
  • 0
  • 0
anonymous タイトルなし
Python
//@version=3

strategy(title = "XAUUSD_30min", shorttitle = "XAU", overlay = true)

source = hlc3
length = input(26, minval=1), multi = input(2.0, minval=0.001,title="シグマ", maxval=50)
len = input(23, minval=1, title="移動平均線")

//RSI
rsi1 = rsi(source, length)

// BB of RSI
basis = sma(rsi1, length)
dev = multi * stdev(rsi1, length)
upper = basis + dev
lower = basis - dev
br = (rsi1 - lower)/(upper - lower)

//MA OF RSI
er = sma(br,len)

//stochRSI
lengthK = input(title='Stoch K:', type=integer, defval=6)
smoothK = input(title='Smooth K:', type=integer, defval=6)
topLine = input(70,title='Top Line')
mid_Hline = input(45,title='mid_Hline')
mid_Lline = input(58,title='mid_Lline')
botLine = input(50,title='Bottom Line')
k = sma(stoch(close, high, low, lengthK), smoothK)

trendDetectionLength=input(30)
showDistributionBelowZero=input(false, type=bool)
mov = 0
trend = 0
wave = 0
vol = na
mov := close>close[1] ? 1 : close<close[1] ? -1 : 0
trend := (mov != 0) and (mov != mov[1]) ? mov : nz(trend[1])
isTrending = rising(close, trendDetectionLength) or falling(close, trendDetectionLength) //abs(close-close[1]) >= dif
wave:=(trend != nz(wave[1])) and isTrending ? trend : nz(wave[1])
vol:=wave==wave[1] ? (nz(vol[1])+volume) : volume
up=wave == 1 ? vol : 0
dn=showDistributionBelowZero ? (wave == 1 ? 0 : wave == -1 ? -vol : vol) : (wave == 1 ? 0 : vol)



//signal
buy = (br>er)and(k<topLine)and(k>mid_Hline)and(up<400000)
sell = (br<er)and(k>botLine)and(k<mid_Lline)and(dn<400000)
strategy.entry("buy",true,when=buy)
strategy.entry("sell",false,when=sell)
  • 0
  • 1
anonymous タイトルなし
CSS
.feed-box {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-start;
  padding: 0 1%;
}
.feed {
  width: 30%;
  margin: 1% 1.66%;
  margin: 1% -webkit-calc(10% / 6);
  margin: 1% calc(10% / 6);
}
  • 0
  • 1