Home Article color flip S/R data filter color flip S/R data filter Software Technique Web Technique All Computer Language and Computer Language Practice Computer Educa April 15, 2026 0 Comments Share: Facebook Twitter Google+ Pinterest Whatsapp TREDING //@version=5 indicator("Color Flip S/R (Date Filter) - Separate Price", overlay=true) // ==== INPUT ==== tf = input.timeframe("15", "Timeframe") targetDay = input.int(10, "Target Day") targetMonth = input.int(4, "Target Month") targetYear = input.int(2026, "Target Year") // ==== SEPARATE PRICE INPUT ==== greenPriceType = input.string("high", "Green Line Price", options=["open", "high", "low", "close"]) redPriceType = input.string("low", "Red Line Price", options=["open", "high", "low", "close"]) // ==== DATA ==== o = request.security(syminfo.tickerid, tf, open) h = request.security(syminfo.tickerid, tf, high) l = request.security(syminfo.tickerid, tf, low) c = request.security(syminfo.tickerid, tf, close) // ==== SELECT PRICE FUNCTION ==== getPrice(ptype) => switch ptype "open" => o "high" => h "low" => l => c greenPrice = getPrice(greenPriceType) redPrice = getPrice(redPriceType) // ==== CANDLE COLOR ==== green = c > o red = c < o // ==== DATE FILTER ==== isTargetDate = (dayofmonth == targetDay and month == targetMonth and year == targetYear) // ==== FLIP CONDITIONS ==== flipDown = green[1] and red flipUp = red[1] and green // ==== DRAW ==== // 🔴 RED LINE (Green → Red flip) if isTargetDate and flipDown line.new(bar_index, redPrice, bar_index + 50, redPrice, color=color.red, width=2, extend=extend.right) // 🟢 GREEN LINE (Red → Green flip) if isTargetDate and flipUp line.new(bar_index, greenPrice, bar_index + 50, greenPrice, color=color.green, width=2, extend=extend.right) Copy Copied Text:
No comments