TradingView
capissimo
23 août 2019 08:58

Forecasting - Vanilla Locally Weighted Regression 

Bitcoin / United States DollarCoinbase

Description

There is not much to say - just vanilla locally weighted regression in PineScript 4.
see: medium.com/100-days-of-algorithms/day-97-locally-weighted-regression-c9cfaff087fb
also: cs229.stanford.edu/proj2017/final-reports/5241098.pdf
Commentaires
simwai
Which is your most accurate forecasting indicator for altcoins?
capissimo
UPD:
add line
mmx = input(2, "Scaler Lookback", minval=1) // originally 4
and replace line
pred = scale(lwr(sec, gendata, p, tau), p)
with
pred = scale(lwr(sec, gendata, p, tau), mmx)
capissimo
@capissimo, if you wnat to control the offset of the signal flag, then do the following:
add this line:
oft = input(5, "Flag Offset", minval=2)
Then replace this line:
plotshape(not(fl and rs) ? hl2 : na, location=location.absolute, style=shape.flag, color=c, size=size.small, transp=0, offset=3, show_last=1)
with:
plotshape(not(fl and rs) ? hl2 : na, location=location.absolute, style=shape.flag, color=c, size=size.small, transp=0, offset=oft, show_last=1)
capissimo
@capissimo, whoops, replace three lines))
plotshape(fl ? hl2: na, location=location.absolute, style=shape.flag, color=c, size=size.small, transp=0, offset=oft, show_last=1)
plotshape(rs ? hl2: na, location=location.absolute, style=shape.flag, color=c, size=size.small, transp=0, offset=oft, show_last=1)
plotshape(not(fl and rs) ? hl2 : na, location=location.absolute, style=shape.flag, color=c, size=size.small, transp=0, offset=oft, show_last=1)
Plus