Hola, ¿alguien podría ayudarme a convertir este código de indicador para que sea compatible con la plataforma ProRealTime?
// Saty Phase Oscillator
// Copyright (C) 2022-2024 Saty Mahajan
// A useful range-based signal to monitor various phases of the market.
//@version=5
indicator("Saty Phase Oscillator")
// Standard Colors
green = color.rgb(0,255,0)
red = color.rgb(255,0,0)
magenta = color.rgb(255,0,255)
light_gray = color.rgb(200,200,200)
gray = color.rgb(150,150,150)
dark_gray = color.rgb(100,100,100)
// Pivot Data
pivot = ta.ema(close, 21)
above_pivot = close >= pivot
// Phases
extended_up_zone = plot(100.0, color = light_gray, linewidth = 1)
distribution_zone = plot(61.8, color = gray, linewidth = 1)
neutral_up_zone = plot(23.6, color = dark_gray, linewidth = 1)
neutral_down_zone = plot(-23.6, color = dark_gray, linewidth = 1)
accumulation_zone = plot(-61.8, color = gray, linewidth = 1)
extended_down_zone = plot(-100.0, color = light_gray, linewidth = 1)
// # Bollinger Band Compression Signal
bband_offset = 2.0 * ta.stdev(close, 21)
bband_up = pivot + bband_offset
bband_down = pivot - bband_offset
compression_threshold_up = pivot + (2.0 * ta.atr(14))
compression_threshold_down = pivot - (2.0 * ta.atr(14))
expansion_threshold_up = pivot + (1.854 * ta.atr(14))
expansion_threshold_down = pivot - (1.854 * ta.atr(14))
compression = above_pivot ? (bband_up - compression_threshold_up) : (compression_threshold_down - bband_down)
in_expansion_zone = above_pivot ? (bband_up - expansion_threshold_up) : (expansion_threshold_down - bband_down)
expansion = compression[1] <= compression[0]
compression_tracker = false
if expansion and in_expansion_zone > 0
compression_tracker := false
else if compression <= 0
compression_tracker := true
else
compression_tracker := false
compression_signal = plot(0, color = compression_tracker ? magenta : dark_gray, linewidth = 2)
// # Compressing / Expanding / Expanded
var tbl = table.new(position.top_right, 1, 1)
if barstate.islast
table.cell(tbl, 0, 0, 'Compression', bgcolor = magenta)
if compression_tracker == false
table.clear(tbl,0,0,0,0)
// Saty Phase Oscillator Signal
raw_signal = ((close - pivot) / (3.0 * ta.atr(14))) * 100
oscillator = ta.ema(raw_signal, 3)
phase_oscillator = plot(oscillator, linewidth = 2, color = compression_tracker ? magenta : (oscillator >= 0.0 ? green : red), title = "Phase Oscillator")