Untitled
//@version=5 indicator("[blackcat] L1 Main life line oscillator", overlay=false) // Function to calculate the Main Force and Life Line oscillators calculate_life_line_oscillator(n, weight, close, high, low) => smoothedPrice = ((2 * close + high + low) / 4) lowestLow = ta.lowest(low, n) highestHigh = ta.highest(high, n) mainForce = ta.alma(ta.ema(((smoothedPrice - lowestLow) / (highestHigh - lowestLow)) * 100, n) * weight,3,0.85,6) lifeLine = ta.ema((0.667 * mainForce[1] + 0.333 * mainForce), 2) * weight [mainForce, lifeLine] // User-defined inputs n = input.int(14, title="Period") weight = input.float(1.0, title="Weight", minval=0.1) // Calculate the oscillators [mainForce, lifeLine] = calculate_life_line_oscillator(n, weight, close, high, low) // Plot the oscillators plot(mainForce, color=color.yellow, linewidth = 2, title="Main Force") plot(lifeLine, color=color.fuchsia, linewidth = 2, title="Life Line") // Detect crossovers and crossunders crossoverCondition = ta.crossover(mainForce, lifeLine) crossunderCondition = ta.crossunder(mainForce, lifeLine) // Draw labels for crossovers and crossunders if crossoverCondition label.new(x=bar_index, y=mainForce, text="B", style=label.style_label_up, color=color.new(color.yellow,50), textcolor=color.white, size=size.small) if crossunderCondition label.new(x=bar_index, y=mainForce, text="S", style=label.style_label_down, color=color.new(color.fuchsia,50), textcolor=color.white, size=size.small) //functions xrf(values, length) => r_val = float(na) if length >= 1 for i = 0 to length by 1 if na(r_val) or not na(values[i]) r_val := values[i] r_val r_val xsa(src, len, wei) => sumf = 0.0 ma = 0.0 out = 0.0 sumf := nz(sumf[1]) - nz(src[len]) + src ma := na(src[len]) ? na : sumf / len out := na(out[1]) ? ma : (src * wei + out[1] * (len - wei)) / len out //set up a simple model of banker fund flow trend fundtrend = (3 * xsa((close - ta.lowest(low, 27)) / (ta.highest(high, 27) - ta.lowest(low, 27)) * 100, 5, 1) - 2 * xsa(xsa((close - ta.lowest(low, 27)) / (ta.highest(high, 27) - ta.lowest(low, 27)) * 100, 5, 1), 3, 1) - 50) * 1.032 + 50 //define typical price for banker fund typ = (2 * close + high + low + open) / 5 //lowest low with mid term fib # 34 lol = ta.lowest(low, 34) //highest high with mid term fib # 34 hoh = ta.highest(high, 34) //define banker fund flow bull bear line bullbearline = ta.ema((typ - lol) / (hoh - lol) * 100, 13) //define banker entry signal bankerentry = ta.crossover(fundtrend, bullbearline) and bullbearline < 41 bankerexit = ta.crossover(fundtrend, bullbearline) and bullbearline > 75 //banker fund entry with yellow candle plotcandle(0, 50, 0, 50, color = bankerentry ? color.new(color.yellow, 0) : na) alertcondition(bankerentry, title = 'DİP ALARM', message = 'DİP!')
Leave a Comment