我从交易视图中获得了这个脚本,我想在我的策略中使用它,但它在 v2 中。我需要帮助将其更改为 v4。谢谢大家。
study("Kuskus Starlight", overlay=false)
//parameters
range = input (30, title="Range Periods")
pricesmoothing = input(0.3, title = "Price Smoothing")
indexsmoothing = input(0.3, title = "Index Smoothing")
highesthigh = highest(high, range)
lowestlow = lowest(low, range)
greatestrange = (highesthigh - lowestlow)!=0?(highesthigh-lowestlow):greatestrange[1]
midprice = (high+low)/2
//pricelocation
pricelocation = 2*((midprice-lowestlow)/greatestrange)-1
//smoothing of pricelocation
extmapbuffer = pricesmoothing*nz(extmapbuffer [1]) + (1-pricesmoothing)*pricelocation
smoothedlocation = (extmapbuffer>0.99?0.99:(extmapbuffer<-0.99?-0.99:extmapbuffer))!=1?(extmapbuffer>0.99?0.99:(extmapbuffer<-0.99?-0.99: extmapbuffer)): smoothedlocation [1]
//Fisher location
fishindex = log((1+smoothedlocation)/(1-smoothedlocation))
//smoothingoffishindex
extmapbuffer1 = indexsmoothing*nz(extmapbuffer1[1])+(1-indexsmoothing)*(fishindex)
smoothedfish = extmapbuffer1
plot(smoothedfish, color=smoothedfish>0?green:red, linewidth=3, style=histogram)