Ledger Nano X - The secure hardware wallet
SHARE
TWEET

Untitled

a guest Mar 31st, 2020 60 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. def price = close;
  2. def superfast_length = 8;
  3. def fast_length = 13;
  4. def slow_length = 21;
  5. def displace = 0;
  6.  
  7. def mov_avg8 = ExpAverage(price[-displace], superfast_length);
  8. def mov_avg13 = ExpAverage(price[-displace], fast_length);
  9. def mov_avg21 = ExpAverage(price[-displace], slow_length);
  10.  
  11. #moving averages
  12. Def Superfast = mov_avg8;
  13. def Fast = mov_avg13;
  14. def Slow = mov_avg21;
  15.  
  16. def buy = mov_avg8 > mov_avg13 and mov_avg13 > mov_avg21 and low > mov_avg8;
  17. def stopbuy = mov_avg8 <= mov_avg13;
  18. def buynow = !buy[1] and buy;
  19. def buysignal = CompoundValue(1, if buynow and !stopbuy then 1 else if buysignal[1]==1 and stopbuy then 0 else buysignal[1], 0);
  20.  
  21. def Buy_Signal = buysignal[1] == 0 and buysignal==1;
  22.  
  23. #Alert(condition = buysignal[1] == 0 and buysignal == 1, text = "Buy Signal", sound = Sound.Bell, "alert type" = Alert.BAR);
  24.  
  25. def Momentum_Down = buysignal[1] ==1 and buysignal==0;
  26.  
  27.  
  28. #Alert(condition = buysignal[1] == 1 and buysignal == 0, text = "Momentum_Down", sound = Sound.Bell, "alert type" = Alert.BAR);
  29.  
  30. def sell = mov_avg8 < mov_avg13 and mov_avg13 < mov_avg21 and high < mov_avg8;
  31. def stopsell = mov_avg8 >= mov_avg13;
  32. def sellnow = !sell[1] and sell;
  33. def sellsignal = CompoundValue(1, if sellnow and !stopsell then 1 else if sellsignal[1]==1 and stopsell then 0 else sellsignal[1], 0);
  34.  
  35. Def Sell_Signal = sellsignal[1] ==0 and sellsignal;
  36.  
  37.  
  38. #Alert(condition = sellsignal[1] == 0 and sellsignal == 1, text = "Sell Signal", sound = Sound.Bell, "alert type" = Alert.BAR);
  39.  
  40. Def Momentum_Up = sellsignal[1]==1 and sellSignal==0;
  41.  
  42.  
  43. #Alert(condition = sellsignal[1] == 1 and sellSignal == 0, text = "Momentum_Up", sound = Sound.Bell, "alert type" = Alert.BAR);
  44.  
  45. plot Colorbars = if buysignal ==1 then 1 else if sellsignal ==1 then 2 else if buysignal ==0 or sellsignal==0 then 3 else 0;
  46. colorbars.hide();
  47. Colorbars.definecolor("Buy_Signal_Bars", color.dark_green);
  48. Colorbars.definecolor("Sell_Signal_Bars", color.red);
  49. Colorbars.definecolor("Neutral", color.plum);
  50.  
  51. AssignPriceColor(if Colorbars ==1 then colorbars.color("buy_signal_bars") else if colorbars ==2 then colorbars.color("Sell_Signal_bars") else  colorbars.color("neutral"));
  52.  
  53. #___________________________________________________________________________
  54.  
  55.  
  56.  
  57. input method = {default average, high_low}; 
  58. def bubbleoffset = .0005; 
  59. def percentamount = .01; 
  60. def revAmount = .05; 
  61. def atrreversal = 2.0; 
  62. def atrlength = 5; 
  63. def pricehigh = high; 
  64. def pricelow = low; 
  65. def averagelength = 5; 
  66. def averagetype = AverageType.EXPONENTIAL; 
  67. def mah = MovingAverage(averagetype, pricehigh, averagelength); 
  68. def mal = MovingAverage(averagetype, pricelow, averagelength); 
  69. def priceh = if method == method.high_low then pricehigh else mah; 
  70. def pricel = if method == method.high_low then pricelow else mal; 
  71. def EI = ZigZagHighLow("price h" = priceh, "price l" = pricel, "percentage reversal" = percentamount, "absolute reversal" = revAmount, "atr length" = atrlength, "atr reversal" = atrreversal); 
  72. def reversalAmount = if (close * percentamount / 100) > Max(revAmount < atrreversal * reference ATR(atrlength), revAmount) then (close * percentamount / 100) else if revAmount < atrreversal * reference ATR(atrlength) then atrreversal * reference ATR(atrlength) else revAmount; 
  73. rec EISave = if !IsNaN(EI) then EI else GetValue(EISave, 1); 
  74. def chg = (if EISave == priceh then priceh else pricel) - GetValue(EISave, 1); 
  75. def isUp = chg >= 0; 
  76. rec isConf = AbsValue(chg) >= reversalAmount or (IsNaN(GetValue(EI, 1)) and GetValue(isConf, 1)); 
  77. def EId = if isUp then 1 else 0; 
  78. #plot EnhancedLines = if EId <= 1 then EI else Double.NaN; 
  79. #EnhancedLines.AssignValueColor(if EId == 1 then Color.GREEN else if EId == 0 then Color.RED else Color.DARK_ORANGE); 
  80. #EnhancedLines.SetStyle(Curve.FIRM); 
  81. #EnhancedLines.EnableApproximation(); 
  82. #EnhancedLines.HideBubble(); 
  83. #Price Change between Enhanceds 
  84. def xxhigh = if EISave == priceh then priceh else xxhigh[1]; 
  85. def chghigh = priceh - xxhigh[1]; 
  86. def xxlow = if EISave == pricel then pricel else xxlow[1]; 
  87. def chglow = pricel - xxlow[1]; 
  88. def showBubbleschange = no; 
  89. AddChartBubble(showBubbleschange and !IsNaN(EI) and BarNumber() != 1, if isUp then priceh * (1 + bubbleoffset) else pricel * (1 - bubbleoffset) , "$" + chg , if isUp and chghigh > 0 then Color.GREEN else if isUp and chghigh < 0 then Color.RED else if isUp then Color.YELLOW else if !isUp and chglow > 0 then Color.GREEN else if !isUp and chglow < 0 then Color.RED else Color.YELLOW, isUp); 
  90. #Price at High/Low 
  91. def showBubblesprice = no; 
  92. AddChartBubble(showBubblesprice and !IsNaN(EI) and BarNumber() != 1, if isUp then priceh * (1 + bubbleoffset) else pricel * (1 - bubbleoffset) , if isUp then "$" + priceh else "$" + pricel , if isUp and chghigh > 0 then Color.GREEN else if isUp and chghigh < 0 then Color.RED else if isUp then Color.YELLOW else if !isUp and chglow > 0 then Color.GREEN else if !isUp and chglow < 0 then Color.RED else Color.YELLOW, isUp); 
  93. #Label for Confirmed/Unconfirmed Status of Current Enhanced 
  94.  
  95. #Bar Count between Enhanceds 
  96. rec EIcount = if EISave[1] != EISave then 1 else if EISave[1] == EISave then EIcount[1] + 1 else 0; 
  97. def EIcounthilo = if EIcounthilo[1] == 0 and (EISave == priceh or EISave == pricel) then 1 else if EISave == priceh or EISave == pricel then EIcounthilo[1] + 1 else EIcounthilo[1]; 
  98. def EIhilo = if EISave == priceh or EISave == pricel then EIcounthilo else EIcounthilo + 1; 
  99. def EIcounthigh = if EISave == priceh then EIcount[1] else Double.NaN; 
  100. def EIcountlow = if EISave == pricel then EIcount[1] else Double.NaN; 
  101. def showBubblesbarcount = no; 
  102. AddChartBubble(showBubblesbarcount and !IsNaN(EI) and BarNumber() != 1, if isUp then priceh * (1 + bubbleoffset) else pricel * (1 - bubbleoffset) , if EISave == priceh then EIcounthigh else EIcountlow, if isUp and chghigh > 0 then Color.GREEN else if isUp and chghigh < 0 then Color.RED else if isUp then Color.YELLOW else if !isUp and chglow > 0 then Color.GREEN else if !isUp and chglow < 0 then Color.RED else Color.YELLOW, if isUp then yes else no ); 
  103. #Arrows 
  104. def EIL = if !IsNaN(EI) and !isUp then pricel else GetValue(EIL, 1); 
  105. def EIH = if !IsNaN(EI) and isUp then priceh else GetValue(EIH, 1); 
  106. def dir = CompoundValue(1, if EIL != EIL[1] or pricel == EIL[1] and pricel == EISave then 1 else if EIH != EIH[1] or priceh == EIH[1] and priceh == EISave then -1 else dir[1], 0); 
  107. def signal = CompoundValue(1, if dir > 0 and pricel > EIL then if signal[1] <= 0 then 1 else signal[1] else if dir < 0 and priceh < EIH then if signal[1] >= 0 then -1 else signal[1] else signal[1], 0); 
  108. def showarrows = yes; 
  109. def U1 = showarrows and signal > 0 and signal[1] <= 0; 
  110. #U1.SetPaintingStrategy(PaintingStrategy.BOOLEAN_ARROW_UP); 
  111. #U1.SetDefaultColor(Color.GREEN); 
  112. #U1.SetLineWeight(4); 
  113. def D1 = showarrows and signal < 0 and signal[1] >= 0; 
  114. #D1.SetPaintingStrategy(PaintingStrategy.BOOLEAN_ARROW_DOWN); 
  115. #D1.SetDefaultColor(Color.RED); 
  116. #D1.SetLineWeight(4); 
  117. def barnumber = BarNumber();
  118.  
  119. #AddChartBubble((barnumber and U1),if isUp then low else high, if showarrows and signal > 0 and signal[1] <= 0 then "Reversal:" + low else ""  , if colorbars == 3 then color.plum else Color.uptick, no);
  120. #AddChartBubble((barnumber and D1),if isUp then low else high, if showarrows and signal < 0 and signal[1] >= 0 then "Reversal:" + high else ""  , if colorbars == 3 then color.plum else Color.downtick, yes);
  121.  
  122. plot bubblerep = barnumber and U1;
  123. plot bubblerep2 = barnumber and D1;
  124. bubblerep.SetPaintingStrategy(PaintingStrategy.BOOLEAN_ARROW_UP); 
  125. bubblerep.setdefaultcolor(color.green);
  126. bubblerep2.SetPaintingStrategy(PaintingStrategy.BOOLEAN_ARROW_DOWN); 
  127. bubblerep2.setdefaultcolor(color.red);
  128.  
  129.  
  130. def revLineTop;
  131. def revLineBot;
  132.  
  133. if barnumber and D1 {
  134.     revLineBot = double.nan;
  135.     revLineTop = high[1];
  136. } else if barnumber and U1 {
  137.     revLineTop = double.nan;
  138.     revLineBot = low[1];
  139. } else if !isNaN(revLineBot[1]) and (colorbars[2] == 2 or colorbars[1] == 2) {
  140.     revlineBot = revLineBot[1];
  141.     revLineTop = double.NaN;
  142. } else if !isNaN(revLineTop[1]) and (colorbars[2] == 1 or colorbars[1] == 1) {
  143.     revLineTop = revLineTop[1];
  144.     revLineBot = double.nan;
  145. } else {
  146.     revLineTop = double.NaN;
  147.     revlineBot = double.NaN;
  148. }
  149.     
  150. plot botLine = revLineBot[-1];
  151. botLine.setDefaultColor(color.light_green);
  152. plot topLine = revLineTop[-1];
  153. topLine.setDefaultcolor(color.light_red);
  154.  
  155.  
  156. #Alerts 
  157. def usealerts = no; 
  158. #Alert(usealerts and U1, "EI-UP", Alert.BAR, Sound.Bell); 
  159. #Alert(usealerts and D1, "EI-DOWN", Alert.BAR, Sound.Chimes); 
  160. #Supply Demand Areas 
  161. rec data1 = CompoundValue(1, if (EISave == priceh or EISave == pricel) then data1[1] + 1 else data1[1], 0); 
  162. def datacount1 = (HighestAll(data1) - data1[1]); 
  163. def numbersuppdemandtoshow = 0; 
  164. input showSupplyDemand = {default Pivot, Arrow, None}; 
  165. def idx = if showSupplyDemand == showSupplyDemand.Pivot then 1 else 0; 
  166. def rLow; 
  167. def rHigh; 
  168. if signal crosses 0 { 
  169. rLow = pricel[idx]; 
  170. rHigh = priceh[idx]; 
  171. } else { 
  172. rLow = rLow[1]; 
  173. rHigh = rHigh[1]; 
  174. def HighLine = if datacount1 <= numbersuppdemandtoshow and showSupplyDemand != showSupplyDemand.None and !IsNaN(close) and rHigh != 0 then rHigh else Double.NaN; 
  175.  
  176.  
  177. def LowLine = if datacount1 <= numbersuppdemandtoshow and showSupplyDemand != showSupplyDemand.None and !IsNaN(close) and rLow != 0 then rLow else Double.NaN; 
  178.  
  179.  
  180. def hlUp = if signal > 0 then HighLine else Double.NaN; 
  181. def hlDn = if signal < 0 then HighLine else Double.NaN; 
  182.  
  183. def showsupplydemandcloud = no; 
  184. AddCloud(if showsupplydemandcloud then hlUp else Double.NaN, LowLine, Color.LIGHT_GREEN, Color.LIGHT_GREEN); 
  185. AddCloud(if showsupplydemandcloud then hlDn else Double.NaN, LowLine, Color.LIGHT_RED, Color.LIGHT_RED); 
  186. #Store Previous Data 
  187. def EIsave1 = if !IsNaN(EISave) then EISave else EIsave1[1]; 
  188. def EIsave2 = EIsave1; 
  189. rec priorEI1 = if EIsave2 != EIsave2[1] then EIsave2[1] else priorEI1[1]; 
  190. rec priorEI2 = if priorEI1 != priorEI1[1] then priorEI1[1] else priorEI2[1]; 
  191. rec priorEI3 = if priorEI2 != priorEI2[1] then priorEI2[1] else priorEI3[1]; 
  192. #Fibonacci Extensions 
  193. rec data = CompoundValue(1, if (EISave == priceh or EISave == pricel) then data[1] + 1 else data[1], 0); 
  194. def datacount = (HighestAll(data) - data[1]); 
  195. def numberextfibstoshow = 2; 
  196. rec cpo = if dir[1] != dir then 0 else 1; 
  197. def showFibExtLines = no; 
  198. def showtodayonly = no; 
  199. def today = if showtodayonly == yes then GetDay() == GetLastDay() else GetDay(); 
  200. def extfib1 = if EISave == priceh then priceh - AbsValue(priorEI2 - priorEI1) * 1 
  201. else extfib1[1]; 
  202. def extfib100 = if datacount <= numberextfibstoshow and today and showFibExtLines and !IsNaN(extfib1) and dir < 0 and cpo != 0 then extfib1[1] else Double.NaN; 
  203.  
  204. def extfib1a = if EISave == priceh then priceh - AbsValue(priorEI2 - priorEI1) * 0.382 
  205. else extfib1a[1]; 
  206. def extfib382 = if datacount <= numberextfibstoshow and today and showFibExtLines and !IsNaN(extfib1a) and dir < 0 and cpo != 0 then extfib1a[1] else Double.NaN; 
  207.  
  208. def extfib2 = if EISave == priceh then priceh - AbsValue(priorEI2 - priorEI1) * 
  209. 0.618 else extfib2[1]; 
  210. def extfib618 = if datacount <= numberextfibstoshow and today and showFibExtLines and !IsNaN(extfib2) and dir < 0 and cpo != 0 then extfib2[1] else Double.NaN; 
  211.  
  212. def extfib3 = if EISave == priceh then priceh - AbsValue(priorEI2 - priorEI1) * 
  213. 1.618 else extfib3[1]; 
  214. def extfib1618 = if datacount <= numberextfibstoshow and today and showFibExtLines and !IsNaN(extfib3) and dir < 0 and cpo != 0 then extfib3[1] else Double.NaN; 
  215.  
  216. def extfib3a = if EISave == priceh then priceh - AbsValue(priorEI2 - priorEI1) * 
  217. 2.000 else extfib3a[1]; 
  218. def extfib2000 = if datacount <= numberextfibstoshow and today and showFibExtLines and !IsNaN(extfib3a) and dir < 0 and cpo != 0 then extfib3a[1] else Double.NaN; 
  219.  
  220. def extfib4 = if EISave == priceh then priceh - AbsValue(priorEI2 - priorEI1) * 
  221. 2.618 else extfib4[1]; 
  222. def extfib2618 = if datacount <= numberextfibstoshow and today and showFibExtLines and !IsNaN(extfib4) and dir < 0 and cpo != 0 then extfib4[1] else Double.NaN; 
  223.  
  224. def extfib5 = if EISave == priceh then priceh - AbsValue(priorEI2 - priorEI1) * 
  225. 3.618 else extfib5[1]; 
  226. def extfib3618 = if datacount <= numberextfibstoshow and today and showFibExtLines and !IsNaN(extfib5) and dir < 0 and cpo != 0 then extfib5[1] else Double.NaN; 
  227.  
  228. def extfib1_ = if EISave == pricel then pricel + AbsValue(priorEI2 - priorEI1) * 1 
  229. else extfib1_[1]; 
  230. def extfib100_ = if datacount <= numberextfibstoshow and today and showFibExtLines and !IsNaN(extfib1_) and dir > 0 and cpo != 0 then extfib1_[1] else Double.NaN; 
  231.  
  232. def extfib1a_ = if EISave == pricel then pricel + AbsValue(priorEI2 - priorEI1) * 0.382 
  233. else extfib1a_[1]; 
  234. def extfib382_ = if datacount <= numberextfibstoshow and today and showFibExtLines and !IsNaN(extfib1a_) and dir > 0 and cpo != 0 then extfib1a_[1] else Double.NaN; 
  235.  
  236. def extfib2_ = if EISave == pricel then pricel + AbsValue(priorEI2 - priorEI1) * 
  237. 0.618 else extfib2_[1]; 
  238. def extfib618_ = if datacount <= numberextfibstoshow and today and showFibExtLines and !IsNaN(extfib2_) and dir > 0 and cpo != 0 then extfib2_[1] else Double.NaN; 
  239.  
  240. def extfib3_ = if EISave == pricel then pricel + AbsValue(priorEI2 - priorEI1) * 
  241. 1.618 else extfib3_[1]; 
  242. def extfib1618_ = if datacount <= numberextfibstoshow and today and showFibExtLines and !IsNaN(extfib3_) and dir > 0 and cpo != 0 then extfib3_[1] else Double.NaN; 
  243.  
  244. def extfib3a_ = if EISave == pricel then pricel + AbsValue(priorEI2 - priorEI1) * 
  245. 2.000 else extfib3a_[1]; 
  246. def extfib2000_ = if datacount <= numberextfibstoshow and today and showFibExtLines and !IsNaN(extfib3a_) and dir > 0 and cpo != 0 then extfib3a_[1] else Double.NaN; 
  247.  
  248. def extfib4_ = if EISave == pricel then pricel + AbsValue(priorEI2 - priorEI1) * 
  249. 2.618 else extfib4_[1]; 
  250. def extfib2618_ = if datacount <= numberextfibstoshow and today and showFibExtLines and !IsNaN(extfib4_) and dir > 0 and cpo != 0 then extfib4_[1] else Double.NaN; 
  251.  
  252. def extfib5_ = if EISave == pricel then pricel + AbsValue(priorEI2 - priorEI1) * 
  253. 3.618 else extfib5_[1]; 
  254. def extfib3618_ = if datacount <= numberextfibstoshow and today and showFibExtLines and !IsNaN(extfib5_) and dir > 0 and cpo != 0 then extfib5_[1] else Double.NaN; 
  255.  
  256. def fibextbubblespacesinexpansion = 8; 
  257. def b = fibextbubblespacesinexpansion; 
  258. def direction = if !isUp then 1 else 0; 
  259. AddChartBubble( direction[b + 1] == 1 and showFibExtLines and !IsNaN(close[b + 1]) and IsNaN(close), extfib1[b + 2], "100%", Color.RED, no); 
  260. AddChartBubble( direction[b + 1] == 1 and showFibExtLines and !IsNaN(close[b + 1]) and IsNaN(close), extfib1a[b + 2], "38.2%", Color.RED, no); 
  261. AddChartBubble( direction[b + 1] == 1 and showFibExtLines and !IsNaN(close[b + 1]) and IsNaN(close), extfib2[b + 2], "61.8%", Color.RED, no); 
  262. AddChartBubble( direction[b + 1] == 1 and showFibExtLines and !IsNaN(close[b + 1]) and IsNaN(close), extfib3[b + 2], "161.8%", Color.RED, no); 
  263. AddChartBubble( direction[b + 1] == 1 and showFibExtLines and !IsNaN(close[b + 1]) and IsNaN(close), extfib3a[b + 2], "200%", Color.RED, no); 
  264. AddChartBubble( direction[b + 1] == 1 and showFibExtLines and !IsNaN(close[b + 1]) and IsNaN(close), extfib4[b + 2], "261.8%", Color.RED, no); 
  265. AddChartBubble( direction[b + 1] == 1 and showFibExtLines and !IsNaN(close[b + 1]) and IsNaN(close), extfib5[b + 2], "361.8%", Color.RED, no); 
  266. AddChartBubble( direction[b + 1] == 0 and showFibExtLines and !IsNaN(close[b + 1]) and IsNaN(close), extfib1_[b + 2], "100%", Color.GREEN, yes); 
  267. AddChartBubble( direction[b + 1] == 0 and showFibExtLines and !IsNaN(close[b + 1]) and IsNaN(close), extfib1a_[b + 2], "38.2%", Color.GREEN, yes); 
  268. AddChartBubble( direction[b + 1] == 0 and showFibExtLines and !IsNaN(close[b + 1]) and IsNaN(close), extfib2_[b + 2], "61.8%", Color.GREEN, yes); 
  269. AddChartBubble( direction[b + 1] == 0 and showFibExtLines and !IsNaN(close[b + 1]) and IsNaN(close), extfib3_[b + 2], "161.8%", Color.GREEN, yes); 
  270. AddChartBubble( direction[b + 1] == 0 and showFibExtLines and !IsNaN(close[b + 1]) and IsNaN(close), extfib3a_[b + 2], "200%", Color.GREEN, yes); 
  271. AddChartBubble( direction[b + 1] == 0 and showFibExtLines and !IsNaN(close[b + 1]) and IsNaN(close), extfib4_[b + 2], "261.8%", Color.GREEN, yes); 
  272. AddChartBubble( direction[b + 1] == 0 and showFibExtLines and !IsNaN(close[b + 1]) and IsNaN(close), extfib5_[b + 2], "361.8%", Color.GREEN, yes); 
  273. #Volume at Reversals 
  274. def vol = if BarNumber() == 0 then 0 else volume + vol[1]; 
  275. def vol1 = if BarNumber() == 1 then volume else vol1[1]; 
  276. def xxvol = if EISave == priceh or EISave == pricel then TotalSum(volume) else xxvol[1]; 
  277. def chgvol = if xxvol - xxvol[1] + vol1 == vol then vol else xxvol - xxvol[1]; 
  278. def showBubblesVolume = no; 
  279. AddChartBubble(showBubblesVolume and !IsNaN(EI) and BarNumber() != 1, if isUp then priceh * (1 + bubbleoffset) else pricel * (1 - bubbleoffset), chgvol, if isUp and chghigh > 0 then Color.GREEN else if isUp and chghigh < 0 then Color.RED else if isUp then Color.YELLOW else if !isUp and chglow > 0 then Color.GREEN else if !isUp and chglow < 0 then Color.RED else Color.YELLOW, if isUp then yes else no ); 
  280.  
  281. input usemanualfibskip = no;#Hint usemanualfibskip: Select no to use preprogrammed fibskip amounts. Select no, to use the amount entered at input fibskip. 
  282. input fibskip = .50;#Hint fibskip: Set input usemanualfibskip == yes to use this amount versus preprogrammed amounts. Standard is 1.0. This is percentage difference between fib high and low before a new fib grid created. 
  283. def showBubblesfibratio = no; 
  284. def showFibLabel = no;#Hint showfibLabel: Select yes to show label of current fib level as of last price 
  285. def showfiblines = no; 
  286. def fib1level = .236; 
  287. def fib2level = .382; 
  288. def fibMlevel = .500; 
  289. def fib3level = .618; 
  290. def fib4level = .786; 
  291. #Fibs 
  292. def datacount2 = (HighestAll(data1) - data1[1]); 
  293. def numberfibretracementstoshow = 2; 
  294. def fibskipit = if usemanualfibskip == no then if close > 800 then .25 else .5 else fibskip; 
  295. def EIfibh = if EISave == priceh and AbsValue(EISave - EISave[1]) > priceh * fibskipit * .01 then priceh else EIfibh[1]; 
  296. def EIfibl = if EISave == pricel and AbsValue(EISave - EISave[1]) > priceh * fibskipit * .01 then pricel else EIfibl[1]; 
  297. def range = EIfibh - EIfibl; 
  298. def fibH = if showfiblines == no then Double.NaN else if datacount2 <= numberfibretracementstoshow then EIfibh else Double.NaN; 
  299. def fibL = if showfiblines == no then Double.NaN else if datacount2 <= numberfibretracementstoshow then EIfibl else Double.NaN; 
  300. def fibM = if showfiblines == no then Double.NaN else if datacount2 <= numberfibretracementstoshow then EIfibl + range * fibMlevel else Double.NaN; 
  301. def fib1 = if showfiblines == no then Double.NaN else if datacount2 <= numberfibretracementstoshow then EIfibl + range * fib1level else Double.NaN; 
  302. def fib2 = if showfiblines == no then Double.NaN else if datacount2 <= numberfibretracementstoshow then EIfibl + range * fib2level else Double.NaN; 
  303. def fib3 = if showfiblines == no then Double.NaN else if datacount2 <= numberfibretracementstoshow then EIfibl + range * fib3level else Double.NaN; 
  304. def fib4 = if showfiblines == no then Double.NaN else if datacount2 <= numberfibretracementstoshow then EIfibl + range * fib4level else Double.NaN; 
  305.  
  306. AddLabel(showFibLabel, Concat( "Current Fib Level ", AsPercent((close - EIfibl) / (range))), if close > EIfibl then Color.GREEN else if EIfibh == close then Color.WHITE else Color.RED); 
  307.  
  308. AddChartBubble(showBubblesfibratio and !IsNaN(EI) and BarNumber() != 1, if isUp then priceh * (1 + bubbleoffset) else pricel * (1 - bubbleoffset) , if isUp then AsPercent((priceh - EIfibl) / (range)) else AsPercent((pricel - EIfibl) / range), if isUp and chghigh > 0 then Color.GREEN else if isUp and chghigh < 0 then Color.RED else if isUp then Color.GREEN else if !isUp and chglow > 0 then Color.GREEN else if !isUp and chglow < 0 then Color.RED else Color.RED, isUp);
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