Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
- //@version=5
- // © LvNThL \\
- // \\ Description //
- //
- // Swinger's Paradise Strategy
- //
- // DISCLAIMER: This strategy is most profitible on the 1 Hour Timeframe, while trading Cryptocurrency.
- // AVOID REPAINTING ALERTS: Please set your Buy Signal and Sell Signal Alerts to "Once Per Bar Close"
- //
- // This strategy is super simple. If an asset's price closes on the day [user input] % above open:
- //
- // BUY SIGNAL
- //
- // If an asset's price closes on the day [user input] % below open:
- //
- // SELL SIGNAL
- //
- // Includes a stylized EMA.
- // Enjoy
- //
- // Mr. Storm [LvNThL]
- indicator("Swinger's Paradise", "S/P Royal", overlay = true, max_bars_back = 500)
- [o,c] = request.security(syminfo.tickerid, "D", [open, close], barmerge.gaps_on, barmerge.lookahead_on)
- bool Buy = na
- bool Sell = na
- 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
- Buy := true
- 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
- Sell := true
- int Buyoffset = input.int(0, "Buy Offset", minval = -499, maxval = 499, step = 1, group = "Trade Settings")
- int Selloffset = input.int(0, "Sell Offset", minval = -499, maxval = 499, step = 1, group = "Trade Settings")
- EMA = ta.ema(close, input.int(30, "EMA Period", minval = 0, maxval = 4999, step = 1, group = "EMA Settings"))
- color emaColor = na
- if close > EMA
- emaColor := color.rgb(0,255,0,0)
- else if close < EMA
- emaColor := color.rgb(255,0,0,0)
- plot(EMA, "EMA 1", color = emaColor, linewidth = 2, style = plot.style_line)
- 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)
- 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)
- alertcondition(Buy, "Buy Signal", "Open Long Position")
- alertcondition(Sell, "Sell Signal", "Open Short Position")
Advertisement
Add Comment
Please, Sign In to add comment