xmd79

Gedhusek TrendFibonacci

Dec 13th, 2022
305
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.60 KB | None | 0 0
  1. // This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
  2. // © Gedhusek
  3.  
  4. //@version=5
  5. indicator("Gedhusek TrendFibonacci",shorttitle="G FiboTrend",scale=scale.left)
  6.  
  7. BackStep = input.int(50,"Analysis Period")
  8. lowerValue = input.float(0.382,"Lower Fibonacci Level",options=[0.236, 0.382, 0.50, 0.618, 0.786])
  9. upperValue = input.float(0.618,"Upper Fibonacci Level",options=[0.236, 0.382, 0.50, 0.618, 0.786])
  10. showFill = input.bool(true,"Show Filling")
  11. changeCandle = input.bool(true,"Change Candle Color")
  12. atr = ta.atr(200)
  13. max = ta.highest(close,BackStep)
  14. min = ta.lowest(close,BackStep)
  15.  
  16.  
  17. lowerFib = min + (max-min)*lowerValue
  18. upperFib = min + (max-min)*upperValue
  19. ma = ta.wma(close,6)
  20.  
  21. float closeVal = ma
  22. float openVal = ma
  23. color clrToUse = closeVal>upperFib and openVal>upperFib?color.green:closeVal<lowerFib and openVal<lowerFib?color.red:color.yellow
  24.  
  25. maxLine = plot(max,color=color.green)
  26. minLine = plot(min,color=color.red)
  27. LowerFibLine = plot(lowerFib,color=color.rgb(228, 255, 75, 20))
  28. UpperFibLine = plot(upperFib,color=color.rgb(228, 255, 75, 20))
  29. fill(maxLine,UpperFibLine,color=showFill?color.rgb(0,255,0,changeCandle?95:70):na)
  30. fill(UpperFibLine,LowerFibLine,color=showFill?color.rgb(228, 255, 75, changeCandle?95:70):na)
  31. fill(LowerFibLine,minLine,color=showFill?color.rgb(255,0,0,changeCandle?95:70):na)
  32. plotcandle(open,high,low,close,"Bar",color=changeCandle?clrToUse:na,wickcolor=changeCandle?clrToUse:na,bordercolor=changeCandle?clrToUse:na)
  33.  
  34.  
  35. float LowerRetracement = (max-min)*0.318
  36. float UpperRetracement = (max-min)*0.618
  37.  
  38.  
Advertisement
Add Comment
Please, Sign In to add comment