NKactive

Untitled

Oct 22nd, 2023
37
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.04 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. // © Ontra02
  3.  
  4. //@version=5
  5. indicator("Coin 2512 ratio", precision = 8, overlay = false)
  6. firstsymbol = input.symbol("Btcusdt")
  7. secondsymbol = input.symbol("Ethusdt")
  8. Linechart = input.bool(false, "Use Line, not Candles")
  9.  
  10. Entrypricelong = input.float(1, "Entry Price of Long Asset", tooltip = "Type in the Entry Price of the Long asset to get the Entry on the Chart", group = "Entry Price")
  11. Entrypriceshort = input.float(1, "Entry Price of Short Asset", tooltip = "Type in the Entry Price of the Short asset to get the Entry on the Chart", group = "Entry Price")
  12. ShowEntry = input.bool(true, "Show Entry", "Show the Entry Price based on the Netry prices above", group = "Entry Price")
  13. plotEma = input.bool(true, "Show EMAs", group = "Ema")
  14. LengthEmaone = input.int(21, "Length of Slow EMA", group = "Ema")
  15. LengthEmatwo = input.int(12, "Length of Fast EMA", group = "Ema")
  16. Rsishow = input.bool(true, "Show RSI", group = "table")
  17. PositionofTable = input.string(position.top_right, "table position", options = [position.bottom_center, position.bottom_left, position.bottom_right, position.middle_center,
  18. position.middle_left, position.middle_right, position.top_center, position.top_left, position.top_right], group = "table")
  19.  
  20.  
  21. firstAssetopen= request.security(firstsymbol, timeframe.period, open)
  22. firstAssetclose = request.security(firstsymbol, timeframe.period, close)
  23. firstAssethigh = request.security(firstsymbol, timeframe.period, high)
  24. firstAssetlow = request.security(firstsymbol, timeframe.period, low)
  25.  
  26. secondAssetopen = request.security(secondsymbol, timeframe.period, open)
  27. secondAssetclose = request.security(secondsymbol, timeframe.period, close)
  28. secondAssetlow = request.security(secondsymbol, timeframe.period, low)
  29. secondAssethigh = request.security(secondsymbol, timeframe.period, high )
  30.  
  31.  
  32.  
  33. openforboth = firstAssetopen / secondAssetopen
  34. closeforboth = firstAssetclose / secondAssetclose
  35. highforboth = firstAssethigh / secondAssetlow
  36. lowforboth = firstAssetlow / secondAssethigh
  37.  
  38. //RSi
  39. RSI = ta.rsi(closeforboth, 14)
  40. table = table.new(PositionofTable, 2, 2, color.black, color.black, frame_width = 1)
  41. table.cell( table, 0, 1, "RSI : ", 0,0,color.red, text.align_center, text.align_center, size.auto)
  42. table.delete(Rsishow ? na : table)
  43. table.cell( table, 1, 1, str.tostring(math.round(RSI, 1)), 0,0,color.red, text.align_center, text.align_center, size.auto )
  44.  
  45. Entryprice = Entrypricelong / Entrypriceshort
  46.  
  47. //EMAs
  48. SlowEMA = ta.ema(closeforboth, LengthEmaone)
  49. FastEMA = ta.ema(closeforboth, LengthEmatwo)
  50.  
  51. plot(not plotEma ? na : SlowEMA, "Slow EMA plot", color.blue)
  52. plot(not plotEma ? na : FastEMA, "Slow EMA plot", color.green)
  53. plot(not ShowEntry or Entryprice == 1 ? na : Entryprice, "Entry Price", color.blue, linewidth = 3)
  54. plotcandle(Linechart ? na : openforboth , highforboth, lowforboth, closeforboth, "candles", openforboth > closeforboth ? #000000 : color.white)
  55. plot(not Linechart? na : closeforboth, "Line", color.aqua)
Add Comment
Please, Sign In to add comment