Home Article MTF Fixed 3 Candle Box MTF Fixed 3 Candle Box Software Technique Web Technique All Computer Language and Computer Language Practice Computer Educa May 20, 2026 0 Comments Share: Facebook Twitter Google+ Pinterest Whatsapp TREDING //@version=5 indicator("MTF Fixed 3 Candle Box", overlay=true) // 🔧 Inputs tf = input.timeframe("15", title="Time Frame") len = input.int(3, title="Candles per Box", minval=1, maxval=50) shiftX = input.int(0, title="Box X Shift", minval=-100, maxval=100) topType = input.string("High", title="Top Price", options=["High", "Low", "Close", "Open"]) bottomType = input.string("Low", title="Bottom Price", options=["High", "Low", "Close", "Open"]) boxColor = input.color(color.blue, "Box Color") // 📅 Date Filter fromDate = input.time(timestamp("2026-01-01 00:00"), "From Date") toDate = input.time(timestamp("2026-12-31 23:59"), "To Date") // 📊 MTF Data mtfHigh = request.security(syminfo.tickerid, tf, high) mtfLow = request.security(syminfo.tickerid, tf, low) mtfClose = request.security(syminfo.tickerid, tf, close) mtfOpen = request.security(syminfo.tickerid, tf, open) // ✅ Date Condition inDate = time >= fromDate and time <= toDate // ✅ New Box Only After Complete Group newGroup = (bar_index + 1) % len == 0 if newGroup and inDate // 🔺 Top Selection float topPrice = topType == "High" ? mtfHigh[len - 1] : topType == "Low" ? mtfLow[len - 1] : topType == "Close" ? mtfClose[len - 1] : mtfOpen[len - 1] // 🔻 Bottom Selection float bottomPrice = bottomType == "High" ? mtfHigh : bottomType == "Low" ? mtfLow : bottomType == "Close" ? mtfClose : mtfOpen int start = bar_index - len + 1 + shiftX int end = bar_index + shiftX box.new( left=start, right=end, top=topPrice, bottom=bottomPrice, border_color=boxColor, bgcolor=color.new(boxColor, 85)) Copy Copied Text:
No comments