Untitled
//@version=5 indicator(title="fisher", shorttitle="fisher", format=format.price, max_labels_count = 500) len = input.int(9, minval=1, title="Length") top = input.int(80, minval=50, title="Upper limit") bot = input.int(20, maxval=50, title="Lower limit") high_ = ta.highest(hl2, len) low_ = ta.lowest(hl2, len) round_(val) => val > .99 ? .999 : val < -.99 ? -.999 : val value = 0.0 value := round_(.66 * ((hl2 - low_) / (high_ - low_) - .5) + .67 * nz(value[1])) fish1 = 0.0 fish1 := .5 * math.log((1 + value) / (1 - value)) + .5 * nz(fish1[1]) y = math.abs(fish1) n = bar_index m = n<len? 1 : math.min(n-len+1,500) t = ta.wma(y,m)//ta.cum(y)/n f = 100-100/(math.pow(1+1/t,fish1)+1) hline(top) hline(bot) hline(50, color = #E91E63, linestyle = hline.style_solid) fish2 = f[1] plot(fish2, color = color.orange) plot(f, color= #2962ff) buy = ta.crossover(ta.change(f),0) and f<bot sell = ta.crossunder(ta.change(f),0) and f>top for i = 0 to len-1 buy:= buy and buy[i+1]==false sell:= sell and sell[i+1]==false label.new(ta.valuewhen(buy, bar_index,0),ta.valuewhen(buy,f,0), text = "Buy", color = color.green, style = label.style_label_upper_left, textcolor = color.white, size = size.small) label.new(ta.valuewhen(sell, bar_index,0),ta.valuewhen(sell,f,0), text = "Sell", color = color.red, style = label.style_label_lower_left, textcolor = color.white, size = size.small) alertcondition(buy, title = "buy") alertcondition(sell, title = "sell") bgcolor(color = buy? color.rgb(0,255,0,50) : sell? color.rgb(255,0,0,50) : na, display= display.all) barcolor(color = buy? color.rgb(0,255,0) : sell? color.rgb(255,0,0) : na, display= display.all)
Leave a Comment