Ledger Nano X - The secure hardware wallet
SHARE
TWEET

Reverse Stoch

pigfuck Apr 2nd, 2020 98 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. // This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
  2. // © Motgench
  3.  
  4. //@version=4
  5. study("🐷 Rerverse Stochastic Cross", overlay = true,precision=2)
  6.  
  7. len = input(14,title = "K")
  8. D = input(3,minval = 1, title = "D")
  9. smooth = input(6, minval = 1,title="Smooth")
  10. Cir = input(true, "Plot Crossing Circle")
  11. s = input(true,"plot stoch value")
  12.  
  13.  
  14.  
  15. st(len) =>
  16.     (close - lowest(low,len))/(highest(high,len) - lowest(low,len))
  17.  
  18. x = st(len)
  19. x2 = sma(x,smooth)
  20. x3 = sma(x2,D)
  21.  
  22. C(level, len,smooth) =>
  23.     if smooth == 1
  24.         C = (highest(high,len) - lowest(low,len))*level + lowest(low,len)
  25.     else    
  26.         sum = 0.0
  27.         for i = 1 to smooth -1
  28.             sum := x[i] + sum
  29.         a = smooth*level - sum
  30.         C = a * (highest(high,len) - lowest(low,len)) + lowest(low,len)
  31.    
  32.  
  33.  
  34.  
  35.  
  36. Cross = C(x3,len,smooth)
  37.  
  38. Co = close[1] > Cross[1] ? color.aqua : color.fuchsia
  39.  
  40.  
  41.  
  42.  
  43. US = close > Cross and close[1] < Cross[1] ? Cross : na
  44. UD = close < Cross and close[1] > Cross[1] ? Cross : na
  45.  
  46.  
  47.  
  48.  
  49.  
  50. plot(Cross, title ="Stochastic Stop", style=plot.style_linebr, linewidth=2, color=Co)
  51. Color = color.aqua
  52. Color1 = color.fuchsia
  53. style = "•"
  54. size = size.small
  55.  
  56.  
  57. plotchar(Cir?US:na ,"Upcross Stop Start",style ,location.absolute,Color,0,size = size)
  58. plotchar(Cir?UD:na ,"Upcross Stop Start",style ,location.absolute,Color1,0,size = size)
  59.  
  60.  
  61.  
  62.  
  63. lable(P, T, s, color_PnL) =>// show_panel
  64.     label PnL_Label = na
  65.     PnL_Label := label.new(bar_index, P, text = T, color=color_PnL, textcolor=color.white, style = s, yloc=yloc.price, xloc=xloc.bar_index,size=size.small)
  66.  
  67.  
  68.  
  69. if (s) and US
  70.     lable(US,+ tostring(round(x2*100)),label.style_label_down,color.new(color.aqua, 50))
  71.    
  72.    
  73. if (s) and UD  
  74.     lable(UD,+ tostring(round(x2*100)),label.style_label_up,color.new(color.fuchsia, 50))
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Top