Advertisement
PineCoders

New Daily Range

Oct 5th, 2019
212
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.11 KB | None | 0 0
  1. //@version = 4
  2. //@author = Andre Solbach
  3.  
  4. study("New Daily Range", precision=2, overlay=true)
  5.  
  6. f_tickSize() =>
  7. tk = syminfo.mintick
  8. blockMult = tk < 0.1 and (tk != 0.01 or syminfo.pointvalue < 10 or syminfo.pointvalue * tk <= 1) and (tk != 0.001 or syminfo.pointvalue <= 1) and tk != 0.005 and tk != 0.0001 and tk != 0.0005 and tk != 0.03125 and tk != 0.015625 ? tk == 0.00005 or tk * 100 == 0.00005 ? 2 : 10 : 1
  9. tk * blockMult
  10.  
  11. calcResult_ = 1 / f_tickSize() * sum(high-low, 70) / 70
  12. calcResult = security(syminfo.tickerid, "D", calcResult_[0] , barmerge.gaps_off, barmerge.lookahead_on)
  13.  
  14. other = if timeframe.period != "W" and timeframe.period != "M" and syminfo.ticker != "US30USD" and syminfo.ticker != "GRXEUR" and syminfo.ticker != "BTCUSD" and syminfo.ticker != "BTCEUR" and syminfo.ticker != "EOSUSD" and syminfo.ticker != "USOIL" and syminfo.ticker != "DAX" and syminfo.ticker != "BTCGBP" and syminfo.ticker != "XAGUSD" and syminfo.ticker != "XAGEUR" and syminfo.ticker != "USDWTI" and syminfo.ticker != "UKOIL" and syminfo.ticker != "USDBRO" and syminfo.ticker != "XAGGBP"
  15. true
  16. else
  17. false
  18.  
  19. special1 = if timeframe.period != "W" and timeframe.period != "M" and syminfo.ticker != "USOIL" and syminfo.ticker != "XAGUSD" and syminfo.ticker != "USDWTI" and syminfo.ticker != "UKOIL" and syminfo.ticker != "USDBRO" and syminfo.ticker != "XAGGBP"
  20. special1_ = if syminfo.ticker == "US30USD" or syminfo.ticker == "GRXEUR" or syminfo.ticker == "BTCEUR" or syminfo.ticker == "EOSUSD" or syminfo.ticker == "DAX" or syminfo.ticker == "BTCUSD" or syminfo.ticker == "BTCGBP" or syminfo.ticker == "XAGEUR"
  21. true
  22. else
  23. false
  24. else
  25. false
  26.  
  27. special2 = if timeframe.period != "W" and timeframe.period != "M"
  28. special2_ = if syminfo.ticker == "USOIL" or syminfo.ticker == "XAGUSD" or syminfo.ticker == "USDWTI" or syminfo.ticker == "UKOIL" or syminfo.ticker == "USDBRO" or syminfo.ticker == "XAGGBP"
  29. true
  30. else
  31. false
  32. else
  33. false
  34.  
  35. plot(other ? calcResult : special1 ? calcResult / 10 : special2 ? calcResult * 10 : na, title="Color", color=#FFCB04, transp=100)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement