Advertisement
danucante

Untitled

Nov 24th, 2023
158
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.38 KB | None | 0 0
  1. // INPUTS
  2. //PUELL
  3. top = input.float(0.3, step=0.01, title = "Puell Top")
  4. bottom = input.float(2.13, step=0.01, title = "Puell Bottom")
  5. miningRevenue = request.security('QUANDL:BCHAIN/MIREV', 'D', close[1], barmerge.gaps_off, barmerge.lookahead_on)
  6. ma365 = request.security('QUANDL:BCHAIN/MIREV', 'D', ta.sma(close, 365)[1], barmerge.gaps_off, barmerge.lookahead_on)
  7. puellMultiple = miningRevenue / ma365
  8. puellTop = puellMultiple < top
  9. puellBottom = puellMultiple > bottom
  10.  
  11. //SUPERTREND BASIC TV
  12. atrPeriod = input(6, "ATR Length")
  13. factor = input.float(1.25, "Factor", step = 0.01)
  14. [supertrend, direction] = ta.supertrend(factor, atrPeriod)
  15. supertrendLong = direction < 0
  16. supertrendShort = direction > 0
  17.  
  18. //AROON
  19. length = input.int(14, minval=1)
  20. upper = 100 * (ta.highestbars(high, 14) + 14)/14
  21. lower = 100 * (ta.lowestbars(low, 14) + 14)/14
  22. aroonLong = upper >= lower
  23. aroonShort = upper <= lower
  24.  
  25. //DMI
  26. lensig = input.int(4, title="ADX Smoothing", minval=1, maxval=50)
  27. len2 = input.int(8, minval=1, title="DI Length")
  28. [plus, minus, adx]=ta.dmi(len2, lensig)
  29. dmiLong = plus > minus
  30. dmiShort = plus < minus
  31.  
  32. //FSVZO
  33. src0 = input.source (hlcc4 , 'Source')
  34. malen = input.int (21 , 'MA Length' , minval=1)
  35. len = 1
  36. zone(_src, _len) =>
  37. vol = volume
  38. src = ta.wma(2 * ta.wma(_src, malen / 2) - ta.wma(_src, malen), math.round(math.sqrt(malen)))
  39. vp = src > src[1] ? vol : src < src[1] ? -vol : src == src[1] ? 0 : 0
  40. z = 100 * (ta.ema(vp, _len) / ta.ema(vol, _len))
  41. vzo = request.security(syminfo.tickerid,"",zone(src0, len))
  42. fsrc = vzo
  43. MaxH = ta.highest (fsrc , 6)
  44. MinL = ta.lowest (fsrc , 6)
  45. var nValue1 = 0.0
  46. var nFish = 0.0
  47. nValue1 := 0.33 * 2 * ((fsrc - MinL) / (MaxH - MinL) - 0.5) + 0.67 * nz(nValue1[1])
  48. nValue2 = (nValue1 > 0.99 ? 0.999 : (nValue1 < -0.99 ? -0.999: nValue1))
  49. nFish := 0.5 * math.log((1 + nValue2) / (1 - nValue2)) + 0.5 * nz(nFish[1])
  50. f1 = nFish
  51. f2 = nz(nFish[1])
  52. fsvzoLong = f1 > f2
  53. fsvzoShort = not fsvzoLong
  54.  
  55.  
  56.  
  57. src= input.source(hl2, group= 'rsi')
  58. rsiLength= input.int(11, group= 'rsi')
  59. rsi = ta.rsi(src, rsiLength)
  60.  
  61. ysell= input.int(51)
  62. ybuy= input.int(61)
  63.  
  64. longRSI = rsi > ybuy
  65. shortRSI = rsi < ysell
  66.  
  67.  
  68.  
  69. //conditions
  70. buy_signal = longRSI and aroonLong and dmiLong and not puellTop and fsvzoLong
  71.  
  72. sell_signal = shortRSI and aroonShort and dmiShort and not puellBottom and fsvzoShort
  73.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement