1784
by saurabhjadhav
Hi Team, Sorry for earlier request.
I am Saurabh and I trade in Indian Market Mostly NIFTY 50. majorly work with indicators like Fib, Gann Fann and ICT Kill zones.
following is the code on custom Fibonacci level indicator in Trading View (Pine Script v5) which i curretly trade by manually calculating the levels.
FOLLOWING IS THE LOGIC
Fibonacci Ratios:
0.0236 (2.36%)
0.0382 (3.82%)
0.0500 (5.00%)
0.0618 (6.18%)
0.0786 (7.86%)
From Significant High:
Subtract 0.0236 from the high.
Subtract other ratios from the closing price of the high bar.
From Significant Low:
Add 0.0236 to the low.
Add other ratios to the closing price of the low bar.
based on above logic i have developed a code but not able to complete it, have tried on Tradingview but its not giving its output. currently i manually calculate the logic and trade on the reversal points. this fib only need Significant HIGH or Significant LOW which can predict the upcoming reversal points.
//@version=5
indicator("Custom Fib Levels (High & Low Based)", overlay=true)
// === Parameters ===
length = input.int(100, title="Lookback Period", minval=1)
// === Find Significant High and Low ===
var float sigHigh = na
var float sigLow = na
var int highBarIndex = na
var int lowBarIndex = na
// Find highest high and lowest low
sigHigh := ta.highest(high, length)
highBarIndex := ta.highestbars(high, length)
sigHighClose = close[highBarIndex]
sigLow := ta.lowest(low, length)
lowBarIndex := ta.lowestbars(low, length)
sigLowClose = close[lowBarIndex]
// === Define Ratios ===
r1 = 0.0236
r2 = 0.0382
r3 = 0.0500
r4 = 0.0618
r5 = 0.0786
// === Levels from High ===
levelH1 = sigHigh - sigHigh * r1 // from high
levelH2 = sigHighClose - sigHighClose * r2
levelH3 = sigHighClose - sigHighClose * r3
levelH4 = sigHighClose - sigHighClose * r4
levelH5 = sigHighClose - sigHighClose * r5
// === Levels from Low ===
levelL1 = sigLow + sigLow * r1 // from low
levelL2 = sigLowClose + sigLowClose * r2
levelL3 = sigLowClose + sigLowClose * r3
levelL4 = sigLowClose + sigLowClose * r4
levelL5 = sigLowClose + sigLowClose * r5
// === Plotting From High ===
plot(levelH1, title="High - 2.36% (from High)", color=color.red)
plot(levelH2, title="High - 3.82% (from Close)", color=color.red, style=plot.style_line)
plot(levelH3, title="High - 5.00% (from Close)", color=color.orange)
plot(levelH4, title="High - 6.18% (from Close)", color=color.yellow)
plot(levelH5, title="High - 7.86% (from Close)", color=color.green)
// === Plotting From Low ===
plot(levelL1, title="Low + 2.36% (from Low)", color=color.purple)
plot(levelL2, title="Low + 3.82% (from Close)", color=color.fuchsia)
plot(levelL3, title="Low + 5.00% (from Close)", color=color.aqua)
plot(levelL4, title="Low + 6.18% (from Close)", color=color.blue)
plot(levelL5, title="Low + 7.86% (from Close)", color=color.navy)
// Optional: Show High/Low levels for reference
plot(sigHigh, title="Significant High", color=color.gray, style=plot.style_linebr)
plot(sigLow, title="Significant Low", color=color.gray, style=plot.style_linebr)