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/
- // © Ontra02
- //@version=5
- indicator("Coin 2512 ratio", precision = 8, overlay = false)
- firstsymbol = input.symbol("Btcusdt")
- secondsymbol = input.symbol("Ethusdt")
- Linechart = input.bool(false, "Use Line, not Candles")
- 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")
- 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")
- ShowEntry = input.bool(true, "Show Entry", "Show the Entry Price based on the Netry prices above", group = "Entry Price")
- plotEma = input.bool(true, "Show EMAs", group = "Ema")
- LengthEmaone = input.int(21, "Length of Slow EMA", group = "Ema")
- LengthEmatwo = input.int(12, "Length of Fast EMA", group = "Ema")
- Rsishow = input.bool(true, "Show RSI", group = "table")
- PositionofTable = input.string(position.top_right, "table position", options = [position.bottom_center, position.bottom_left, position.bottom_right, position.middle_center,
- position.middle_left, position.middle_right, position.top_center, position.top_left, position.top_right], group = "table")
- firstAssetopen= request.security(firstsymbol, timeframe.period, open)
- firstAssetclose = request.security(firstsymbol, timeframe.period, close)
- firstAssethigh = request.security(firstsymbol, timeframe.period, high)
- firstAssetlow = request.security(firstsymbol, timeframe.period, low)
- secondAssetopen = request.security(secondsymbol, timeframe.period, open)
- secondAssetclose = request.security(secondsymbol, timeframe.period, close)
- secondAssetlow = request.security(secondsymbol, timeframe.period, low)
- secondAssethigh = request.security(secondsymbol, timeframe.period, high )
- openforboth = firstAssetopen / secondAssetopen
- closeforboth = firstAssetclose / secondAssetclose
- highforboth = firstAssethigh / secondAssetlow
- lowforboth = firstAssetlow / secondAssethigh
- //RSi
- RSI = ta.rsi(closeforboth, 14)
- table = table.new(PositionofTable, 2, 2, color.black, color.black, frame_width = 1)
- table.cell( table, 0, 1, "RSI : ", 0,0,color.red, text.align_center, text.align_center, size.auto)
- table.delete(Rsishow ? na : table)
- table.cell( table, 1, 1, str.tostring(math.round(RSI, 1)), 0,0,color.red, text.align_center, text.align_center, size.auto )
- Entryprice = Entrypricelong / Entrypriceshort
- //EMAs
- SlowEMA = ta.ema(closeforboth, LengthEmaone)
- FastEMA = ta.ema(closeforboth, LengthEmatwo)
- plot(not plotEma ? na : SlowEMA, "Slow EMA plot", color.blue)
- plot(not plotEma ? na : FastEMA, "Slow EMA plot", color.green)
- plot(not ShowEntry or Entryprice == 1 ? na : Entryprice, "Entry Price", color.blue, linewidth = 3)
- plotcandle(Linechart ? na : openforboth , highforboth, lowforboth, closeforboth, "candles", openforboth > closeforboth ? #000000 : color.white)
- plot(not Linechart? na : closeforboth, "Line", color.aqua)
Add Comment
Please, Sign In to add comment