Advertisement
Guest User

Untitled

a guest
Aug 23rd, 2019
98
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.17 KB | None | 0 0
  1. //@version=3
  2. study(title="Sweat Dreams", overlay=true)
  3. // strategy(title="Rêve", shorttitle="Doux rêves", overlay=true, precision=6, pyramiding=0, initial_capital=200, currency="USD", default_qty_type=strategy.percent_of_equity, default_qty_value=99.0, commission_value=0.05)
  4.  
  5.  
  6. ksrc = input(defval="open", title="Kagi Source")
  7. krev = input(defval=0.001, title="Kagi Reversal Size")
  8. ktf = input(defval="20", title="Kagi Timeframe")
  9. l = input(10,'lines wma')
  10. lsourse = input(close,'lines sourse')
  11.  
  12. //-----------------------------------------------------------------------------------------------------------------------------------------------------------------
  13. //Definitions
  14. //-----------------------------------------------------------------------------------------------------------------------------------------------------------------
  15.  
  16. //Kagi
  17. lines = wma(lsourse,l)
  18. psrc = lines
  19. kagisrc = kagi(tickerid, ksrc, krev)
  20. kagi = security(kagisrc, ktf, close)
  21.  
  22. x = psrc > kagi ? true : false
  23. y = psrc < kagi ? true : false
  24.  
  25. //Kagi Color
  26. // kagicolor = (psrc > kagi) ? lime : (psrc < kagi) ? red : na
  27. kagicolor = x ? lime : y ? red : na
  28. // k1 = (psrc > kagi) ? blue : white
  29. // k2 = (psrc < kagi) ? red : k1
  30. // kcol = k1 ? k1 : k2
  31.  
  32. //-----------------------------------------------------------------------------------------------------------------------------------------------------------------
  33. //Plots
  34. //-----------------------------------------------------------------------------------------------------------------------------------------------------------------
  35. buy = x and not x[1] ? psrc : na
  36. sell = y and not y[1] ? psrc : na
  37. //Plots
  38. kagiplot = plot(kagi, color=white, title="Time Based Kagi Plot")
  39. kagiplot1 = plot(kagi, color=white, title="Time Based Kagi Plot")
  40. priceplot = plot(close, color=black, title="Close Price")
  41.  
  42. plot(lines, color=kagicolor, linewidth=2)
  43. plotshape( buy, color=lime, style=shape.arrowdown, text=".", size=size.normal )
  44. plotshape( sell, color=red, style=shape.arrowdown, text=":", size=size.normal )
  45. plot(psrc, color=kagicolor, linewidth=2)
  46.  
  47. //Kagi Price Fill
  48. fill(kagiplot, priceplot, color=kagicolor, transp=80, title="Kagi Fill")
  49.  
  50. fromMonth = input(defval = 8, title = "From Month", minval = 1)
  51. fromDay = input(defval = 23, title = "From Day", minval = 1)
  52. fromYear = input(defval = 2019, title = "From Year", minval = 2014)
  53. toMonth = input(defval = 1, title = "To Month", minval = 1)
  54. toDay = input(defval = 1, title = "To Day", minval = 1)
  55. toYear = input(defval = 9999, title = "To Year", minval = 2014)
  56.  
  57.  
  58. // strategy.entry("Buy", true, when=(buy and (time > timestamp(fromYear, fromMonth, fromDay, 00, 00)) and (time < timestamp(toYear, toMonth, toDay, 23, 59))))
  59. // strategy.close("Buy", when=(sell and (time < timestamp(toYear, toMonth, toDay, 23, 59))))
  60.  
  61. // === ALERTS ===
  62.  
  63. plotshape( buy, color=lime, style=shape.arrowdown, text=".", size=size.small )
  64. plotshape( sell, color=blue, style=shape.arrowdown, text=":", size=size.small)
  65.  
  66. alertcondition( Buy, 'Buy', 'e=binance a=acc b=buy t=limit p=0.02% q=99.5% s=neousdt' )
  67. alertcondition( sell, 'Sell', 'e=binance a=acc b=sell t=limit p=-0.02% q=99.5% s=neousdt' )
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement