Conversion from TRading View to PRT : Fibonacci Golden wave indicator
Forums › ProRealTime English forum › ProBuilder support › Conversion from TRading View to PRT : Fibonacci Golden wave indicator
- This topic has 2 replies, 2 voices, and was last updated 1 week ago by
Philouxp.
-
-
06/27/2024 at 11:20 PM #234447
Hello Nico, Ivan and other,
could you please convert this trading view indicator to PRT : Fibonacci Golden Wave?
I would like backtest this indicator by combination with vwap divergence
Details of the fibo indicator here :
https://www.tradingview.com/script/SWe51Ddl-Fibonacci-Golden-Wave-Flux-Charts/
Explanations:
Fibonacci retracement tool is typically used to find entries after a pullback in an uptrend or downtrend. The Fibonacci Golden Wave can be used in the same way. It can be used to find entries after markets retrace. In this example, the Fibonacci Golden Wave is able to catch 2 pullback opportunities to enter long in the market with the trend.
SETTINGS
1. General Configuration
Swing Range -> This setting determines how the highest high / lowest low levels are calculated. This essentially means that the script will look back X bars before the current bar in calculation to find the highest / lowest wick points.
2. Golden Zone
Here you can select which range of the Fibonacci retracement levels should be considered as the golden zone. The default value is 0.5 – 0.618.Please see the code below:
// This Pine Script™ code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
// © fluxchart
//@version=5
const bool DEBUG = false
const int maxBarsBack = 1250
const int textBack = 2
indicator(“Fibonacci Golden Wave | Flux Charts”, overlay = true, max_boxes_count = 500, max_labels_count = 500, max_lines_count = 500, max_bars_back = 5000)
// Settings
pivotRange = input.int(20, “Swing Range”, group = “General Configuration”)
usePivots = DEBUG ? input.bool(false, “Use Pivots”, group = “General Configuration”) : false
fibArea1 = input.float(0.5, “”, options = [0.236, 0.382, 0.5, 0.618, 0.786], group = “Golden Zone”, inline = “zone”)
fibArea2 = input.float(0.618, ” – “, options = [0.236, 0.382, 0.5, 0.618, 0.786], group = “Golden Zone”, inline = “zone”)
gzLineColor = input.color(color.new(color.yellow, 80), “Golden Zone Lines”, group = “Style”)
showArea = input.bool(true, “Show Area”, group = “Style”, inline = “area”)
gzAreaColor = input.color(color.new(color.yellow, 90), “”, group = “Style”, inline = “area”)
textSize = input.string(“Normal”, “Text Size”, options = [“Auto”, “Small”, “Normal”], group = “Style”, inline = “text”)
textColor = input.color(color.new(color.white, 30), “”, group = “Style”, inline = “text”)
type pivot
bool isHigh
float price
int barTime
var pivot[] highPivots = array.new<pivot>(0)
var pivot[] lowPivots = array.new<pivot>(0)
var box tf1Text = na
float pivotHigh = na
float pivotLow = na
int pHighTime = na
int pLowTime = na
// SWING
if not usePivots
pivotHigh := ta.highest(high, pivotRange)
pHighTime := time[math.abs(ta.highestbars(high, pivotRange))]
pivotLow := ta.lowest(low, pivotRange)
pLowTime := time[math.abs(ta.lowestbars(low, pivotRange))]
else
pivotHigh := ta.pivothigh(pivotRange, pivotRange)
pHighTime := time[pivotRange]
pivotLow := ta.pivotlow(pivotRange, pivotRange)
pLowTime := time[pivotRange]
formatTimeframeString (formatTimeframe) =>
timeframeF = formatTimeframe == “” ? timeframe.period : formatTimeframe
if str.contains(timeframeF, “D”) or str.contains(timeframeF, “W”) or str.contains(timeframeF, “S”) or str.contains(timeframeF, “M”)
timeframeF
else
seconds = timeframe.in_seconds(timeframeF)
if seconds >= 3600
hourCount = int(seconds / 3600)
str.tostring(hourCount) + ” Hour” + (hourCount > 1 ? “s” : “”)
else
timeframeF + ” Min”
getFibonacciLevels (fib1, fib2) =>
if highPivots.size() > 0 and lowPivots.size() > 0
highPivot = highPivots.get(0)
lowPivot = lowPivots.get(0)
top = highPivot.price
bottom = lowPivot.price
difference = top – bottom
fib050 = top – (difference * fib1)
fib061 = top – (difference * fib2)
[fib050, fib061]
else
[na, na]
if last_bar_index – bar_index < maxBarsBack
if not na(pivotHigh)
highPivots.unshift(pivot.new(true, pivotHigh, pHighTime))
if not na(pivotLow)
lowPivots.unshift(pivot.new(false, pivotLow, pLowTime))
fib1 = fibArea1
fib2 = fibArea2
[fib05, fib061] = getFibonacciLevels(fib1, fib2)
line05 = plot(fib05, color = gzLineColor, linewidth = 1, style = plot.style_line)
line061 = plot(fib061, color = gzLineColor, linewidth = 1, style = plot.style_line)
fill(line05, line061, color = showArea ? gzAreaColor : na)
if barstate.islast
box.delete(tf1Text)
//tf1Text := box.new(bar_index – textBack, fib05[textBack / 2], bar_index, fib061[textBack / 2], text = formatTimeframeString(timeframe.period), text_color = textColor, bgcolor = na, border_width = 0, text_size = (textSize == “Auto” ? size.auto : textSize == “Normal” ? size.normal : size.small))
Thank you in advance!
Best Regards
06/28/2024 at 11:58 AM #234484Hi. Here you have the code.
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283//-------------------------------------------------------------------////PRC_Fibonacci Golden Wave//version = 0//13.03.24//Iván González @ www.prorealcode.com//Sharing ProRealTime knowledge//-------------------------------------------------------------------////-------------------------------------------------------------------//prd=20usepivots=0 //Boolean/ 0=Calculate Donchian Channel / 1=Calculate Pivot Pointslevel1=3 //1=0.236 / 2=0.382 / 3=0.500 / 4=0.618 / 5=0.786level2=4//1=0.236 / 2=0.382 / 3=0.500 / 4=0.618 / 5=0.786//-------------------------------------------------------------------////-----Level 1 Selection---------------------------------------------//if level1=1 thenfibArea1=0.236elsif level1=2 thenfibArea1=0.382elsif level1 = 4 thenfibArea1=0.618elsif level1=5 thenfibArea1=0.786elsefibArea1=0.500endif//-------------------------------------------------------------------////-----Level 2 Selection---------------------------------------------//if level2=1 thenfibArea2=0.236elsif level2=2 thenfibArea2=0.382elsif level2=3 thenfibArea2=0.500elsif level2=5 thenfibArea2=0.786elsefibArea2=0.618endif//-------------------------------------------------------------------////-----Level Top and Bottom Calculation------------------------------//if usepivots then//-----Pivot Points Method----------------------------------------//src1 = lowsrc2 = high//-----pivots lowif src1 > src1[prd] and lowest[prd](src1) > src1[prd] and src1[prd] < lowest[prd](src1)[prd+1] then$ply[z+1] = src1[prd]$plx[z+1] = barindex[prd]z = z+1endif//-----pivots highif src2 < src2[prd] and highest[prd](src2)<src2[prd] and src2[prd]>highest[prd](src2)[prd+1] then$phy[t+1]=src2[prd]$phx[t+1]=barindex[prd]t=t+1endif//-----Top and Bottom levelif isset($phy[t]) and isset($ply[z]) thenfibtop=$phy[t]fibbot=$ply[z]diff=fibtop-fibbotfib1=fibtop-(diff*fibArea1)fib2=fibtop-(diff*fibArea2)endifelse//-----Donchian----- Method----------------------------------------//fibtop=highest[prd](high)fibbot=lowest[prd](low)diff=fibtop-fibbotfib1=fibtop-(diff*fibArea1)fib2=fibtop-(diff*fibArea2)endif//-------------------------------------------------------------------//colorbetween(fib1,fib2,"orange",100)//-------------------------------------------------------------------//myfib1=round(fib1,2)myfib2=round(fib2,2)if islastbarupdate thendrawtext("Fibo Level #fibArea1#: #myfib1#",barindex+5,fib1)drawtext("Fibo Level #fibArea2#: #myfib2#",barindex+5,fib2)endif//-------------------------------------------------------------------//return fib1 as "Fibonacci Level1" coloured("orange"), fib2 as "Fibonacci Level2" coloured("orange")//, fibtop coloured("blue"), fibbot coloured("red")08/28/2024 at 1:04 AM #236767 -
AuthorPosts
Find exclusive trading pro-tools on