Tracha

Time Series Forecast with WMA

354
Time Series Forecast with WMA
オープンソーススクリプト

TradingViewの精神に則り、このスクリプトの作者は、トレーダーが理解し検証できるようにオープンソースで公開しています。作者に敬意を表します!無料で使用することができますが、このコードを投稿で再利用するには、ハウスルールに準拠する必要があります。 お気に入りに登録してチャート上でご利用頂けます。

免責事項

これらの情報および投稿は、TradingViewが提供または保証する金融、投資、取引、またはその他の種類のアドバイスや推奨を意図したものではなく、またそのようなものでもありません。詳しくは利用規約をご覧ください。

チャートでこのスクリプトを利用したいですか?
study("The system no.1", shorttitle="System no.1", overlay=true)

_length = input(title="Length", type=integer, defval=21)
_offset = input(title="Offset", type=integer, defval=0)

_smooth = input(title="WMA Length", type=integer, defval=8, minval=1)


_source = close

_lsma = linreg(_source, _length, _offset)
_lsmaS = wma(_lsma, _smooth)
_lsmaC = cross(_lsma, _lsmaS) ? (_lsma + _lsmaS) * 0.5 : na
//iscross() => _lsmaC
plot(_lsma, color=white, linewidth=2)
plot(_lsmaS, color=#2299CC, linewidth=2)
plotshape(_lsmaC, color=green, style=shape.xcross)

//barcolor(iscross() ? yellow : na)

//coppock

wmaLength = input(title="WMA Length", type=integer, defval=10)
longRoCLength = input(title="Long RoC Length", type=integer, defval=14)
shortRoCLength = input(title="Short RoC Length", type=integer, defval=11)

_crossoverMA = input(title="Crossover WMA Lenth", defval=5, minval=1)
_histogramMultiplier = input(title="Histogram Multiplier", defval=2, type=float)

_sourcec = close

_curve = wma(roc(_sourcec, longRoCLength) + roc(_sourcec, shortRoCLength), wmaLength)
_curveWMA = wma(_curve, _crossoverMA)

_h = (_curve - _curveWMA) * _histogramMultiplier

_curveWMAx = cross(_curve, _curveWMA) ? (_curve + _curveWMA) * 0.5 : na

//final decision
check(x,y) => cross(_curve[x], _curveWMA[x]) and cross(_lsma[y], _lsmaS[y])
check00 = check(0,0)
check01 = check(0,1)
check02 = check(0,2)
check10 = check(1,0)
//check11 = check(1,1)
//check12 = check(1,2)
check20 = check(2,0)
//check21 = check(2,1)
check03 = check(0,3)
//check13 = check(1,3)
//check23 = check(2,3)
check30 = check(3,0)
//check22 = check(2,2)
checkcross = (check00 ? true : check01 ? true : check02 ? true : check10 ? true : check30 ? true :
        check20 ? true : check03 ? true : na)



//checking value
mathcall = (abs(lowest(_curve,50)) + abs(highest(_curve,50))) * 0.3
highalert = highest(_curve,50) - mathcall
lowalert = lowest(_curve,50) + mathcall 

// sell position
sellcheck =  _curveWMA > _curve ? true : false
sellcheck1 =  _lsma < _lsmaS ? true : false
sellcheck2 = _curve>highalert

SELLSIGNAL = checkcross and sellcheck and sellcheck1 and sellcheck2
barcolor(SELLSIGNAL ? yellow : na)

// buy position
buycheck =  _curveWMA < _curve ? true : false
buycheck1 =  _lsma > _lsmaS ? true : false
buycheck2 = _curve<lowalert

BUYSIGNAL = checkcross and buycheck and buycheck1 and buycheck2
barcolor(BUYSIGNAL ? blue : na)