xmd79

Swinger's Paradise

Dec 4th, 2022
244
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.80 KB | None | 0 0
  1. // This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
  2. //@version=5
  3. // © LvNThL \\
  4. // \\ Description //
  5. //
  6. // Swinger's Paradise Strategy
  7. //
  8. // DISCLAIMER: This strategy is most profitible on the 1 Hour Timeframe, while trading Cryptocurrency.
  9.  
  10. // AVOID REPAINTING ALERTS: Please set your Buy Signal and Sell Signal Alerts to "Once Per Bar Close"
  11. //
  12. // This strategy is super simple. If an asset's price closes on the day [user input] % above open:
  13. //
  14. // BUY SIGNAL
  15. //
  16. // If an asset's price closes on the day [user input] % below open:
  17. //
  18. // SELL SIGNAL
  19. //
  20. // Includes a stylized EMA.
  21.  
  22. // Enjoy
  23. //
  24. // Mr. Storm [LvNThL]
  25.  
  26.  
  27. indicator("Swinger's Paradise", "S/P Royal", overlay = true, max_bars_back = 500)
  28.  
  29. [o,c] = request.security(syminfo.tickerid, "D", [open, close], barmerge.gaps_on, barmerge.lookahead_on)
  30.  
  31. bool Buy = na
  32. bool Sell = na
  33.  
  34. if c > (((input.float(3, "Daily Percent Gain %:", minval = 0.0, maxval = 4999, step = 0.25, group = "Trade Settings") / 100) + 1) * o) and o < c
  35. Buy := true
  36.  
  37. if c < ((1 - (input.float(3, "Daily Percent Loss %:", minval = 0.0, maxval = 4999, step = 0.25, group = "Trade Settings") / 100)) * o) and o > c
  38. Sell := true
  39.  
  40. int Buyoffset = input.int(0, "Buy Offset", minval = -499, maxval = 499, step = 1, group = "Trade Settings")
  41. int Selloffset = input.int(0, "Sell Offset", minval = -499, maxval = 499, step = 1, group = "Trade Settings")
  42.  
  43. EMA = ta.ema(close, input.int(30, "EMA Period", minval = 0, maxval = 4999, step = 1, group = "EMA Settings"))
  44.  
  45. color emaColor = na
  46.  
  47. if close > EMA
  48. emaColor := color.rgb(0,255,0,0)
  49. else if close < EMA
  50. emaColor := color.rgb(255,0,0,0)
  51.  
  52. plot(EMA, "EMA 1", color = emaColor, linewidth = 2, style = plot.style_line)
  53.  
  54. plotshape(Buy, "Buy Signal", shape.triangleup, location.belowbar, color = color.rgb(0,255,0,0), text = "Long", textcolor = color.gray, offset = Buyoffset, size = size.tiny)
  55. plotshape(Sell, "Sell Signal", shape.triangledown, location.abovebar, color = color.rgb(255,0,0,0), text = "Short", textcolor = color.gray, offset = Selloffset, size = size.tiny)
  56.  
  57. alertcondition(Buy, "Buy Signal", "Open Long Position")
  58. alertcondition(Sell, "Sell Signal", "Open Short Position")
Advertisement
Add Comment
Please, Sign In to add comment