PINE LIBRARY
Actualizado GB_JSON_Lib

Library "GB_JSON_Lib"
Alert payload string builders for GB-RMBP+ strategy.
N8N JSON entries/exits, Autoview key=value strings, PineConnector CSV.
n8n_entry_json(act, mode_lower, ticker, tf, price_now, lev, sug_lev, sl_price, liq_price, order_pct, tp1, tp1p, tp1a, tp2, tp2p, tp2a, tp3, tp3p, tp3a, tp4, tp4p, tp4a, tp5, tp5p, tp5a, tp6, tp6p, tp6a)
Build the N8N entry-side JSON payload, byte-identical to v1.0.77 output.
Parameters:
act (simple string): "buy" or "sell"
mode_lower (simple string): Execution mode in lowercase (stealth/hybrid/visible)
ticker (simple string): syminfo.ticker
tf (simple string): timeframe.period
price_now (float): close
lev (float): Final effective leverage used for the order
sug_lev (float): Suggested leverage from risk-loss calculation
sl_price (float): Stop-loss price (or 0 if none)
liq_price (float): Calculated liquidation price
order_pct (float): Order size as % of equity
tp1 (float)
tp1p (float)
tp1a (bool)
tp2 (float)
tp2p (float)
tp2a (bool)
tp3 (float)
tp3p (float)
tp3a (bool)
tp4 (float)
tp4p (float)
tp4a (bool)
tp5 (float)
tp5p (float)
tp5a (bool)
tp6 (float)
tp6p (float)
tp6a (bool)
Returns: JSON string
n8n_tp_exit_json(act, ticker, tp_idx, tp_pct, pos_size)
Build per-TP exit JSON payload.
Parameters:
act (simple string): "closelong" or "closeshort"
ticker (simple string): syminfo.ticker
tp_idx (int): TP number 1..6
tp_pct (float): Exit % for this TP
pos_size (float): math.abs(strategy.position_size)
Returns: JSON string
n8n_close_json(act, ticker)
Build a full-position close JSON payload.
Parameters:
act (simple string): "closelong" or "closeshort"
ticker (simple string): syminfo.ticker
Returns: JSON string
n8n_order_pct(qty, price, lev, equity)
Compute order size as percentage of equity.
Parameters:
qty (float): Final order quantity
price (float): Current close
lev (float): Effective leverage
equity (float): strategy.equity
Returns: Rounded percentage to 4 decimals
av_entry_str(user, side, exchange, lev, symbol, ccy, testing)
Build Autoview entry command string.
Uses Pine placeholder '{{strategy.order.contracts}}' for the quantity.
Parameters:
user (simple string): Acct identifier
side (simple string): "long" or "short"
exchange (simple string): Exchange name
lev (float): Leverage value
symbol (simple string): Symbol string
ccy (simple string): "currency" or "contracts"
testing (simple string): "" or " d=1"
Returns: Autoview-formatted command string
av_exit_str(user, side, exchange, symbol, ccy, testing, is_short)
Build Autoview exit command string. Short exits append "%" to qty per v1.0.77.
Parameters:
user (simple string): Acct identifier
side (simple string): "long" or "short"
exchange (simple string): Exchange name
symbol (simple string): Symbol string
ccy (simple string): "currency" or "contracts"
testing (simple string): "" or " d=1"
is_short (simple bool): True if this is a short exit (appends "%")
Returns: Autoview-formatted command string
pc_alert_str(licence_id, symbol)
Build PineConnector CSV alert payload.
Uses Pine placeholders for action and contracts.
Parameters:
licence_id (int): Numeric license ID
symbol (simple string): Symbol with optional suffix (e.g. "EURUSD.a")
Returns: CSV-formatted command string
Alert payload string builders for GB-RMBP+ strategy.
N8N JSON entries/exits, Autoview key=value strings, PineConnector CSV.
n8n_entry_json(act, mode_lower, ticker, tf, price_now, lev, sug_lev, sl_price, liq_price, order_pct, tp1, tp1p, tp1a, tp2, tp2p, tp2a, tp3, tp3p, tp3a, tp4, tp4p, tp4a, tp5, tp5p, tp5a, tp6, tp6p, tp6a)
Build the N8N entry-side JSON payload, byte-identical to v1.0.77 output.
Parameters:
act (simple string): "buy" or "sell"
mode_lower (simple string): Execution mode in lowercase (stealth/hybrid/visible)
ticker (simple string): syminfo.ticker
tf (simple string): timeframe.period
price_now (float): close
lev (float): Final effective leverage used for the order
sug_lev (float): Suggested leverage from risk-loss calculation
sl_price (float): Stop-loss price (or 0 if none)
liq_price (float): Calculated liquidation price
order_pct (float): Order size as % of equity
tp1 (float)
tp1p (float)
tp1a (bool)
tp2 (float)
tp2p (float)
tp2a (bool)
tp3 (float)
tp3p (float)
tp3a (bool)
tp4 (float)
tp4p (float)
tp4a (bool)
tp5 (float)
tp5p (float)
tp5a (bool)
tp6 (float)
tp6p (float)
tp6a (bool)
Returns: JSON string
n8n_tp_exit_json(act, ticker, tp_idx, tp_pct, pos_size)
Build per-TP exit JSON payload.
Parameters:
act (simple string): "closelong" or "closeshort"
ticker (simple string): syminfo.ticker
tp_idx (int): TP number 1..6
tp_pct (float): Exit % for this TP
pos_size (float): math.abs(strategy.position_size)
Returns: JSON string
n8n_close_json(act, ticker)
Build a full-position close JSON payload.
Parameters:
act (simple string): "closelong" or "closeshort"
ticker (simple string): syminfo.ticker
Returns: JSON string
n8n_order_pct(qty, price, lev, equity)
Compute order size as percentage of equity.
Parameters:
qty (float): Final order quantity
price (float): Current close
lev (float): Effective leverage
equity (float): strategy.equity
Returns: Rounded percentage to 4 decimals
av_entry_str(user, side, exchange, lev, symbol, ccy, testing)
Build Autoview entry command string.
Uses Pine placeholder '{{strategy.order.contracts}}' for the quantity.
Parameters:
user (simple string): Acct identifier
side (simple string): "long" or "short"
exchange (simple string): Exchange name
lev (float): Leverage value
symbol (simple string): Symbol string
ccy (simple string): "currency" or "contracts"
testing (simple string): "" or " d=1"
Returns: Autoview-formatted command string
av_exit_str(user, side, exchange, symbol, ccy, testing, is_short)
Build Autoview exit command string. Short exits append "%" to qty per v1.0.77.
Parameters:
user (simple string): Acct identifier
side (simple string): "long" or "short"
exchange (simple string): Exchange name
symbol (simple string): Symbol string
ccy (simple string): "currency" or "contracts"
testing (simple string): "" or " d=1"
is_short (simple bool): True if this is a short exit (appends "%")
Returns: Autoview-formatted command string
pc_alert_str(licence_id, symbol)
Build PineConnector CSV alert payload.
Uses Pine placeholders for action and contracts.
Parameters:
licence_id (int): Numeric license ID
symbol (simple string): Symbol with optional suffix (e.g. "EURUSD.a")
Returns: CSV-formatted command string
Notas de prensa
v2Updated:
n8n_entry_json(act, mode_lower, ticker, tf, price_now, lev, sug_lev, sl_price, liq_price, order_pct, tp1, tp1p, tp1a, tp2, tp2p, tp2a, tp3, tp3p, tp3a, tp4, tp4p, tp4a, tp5, tp5p, tp5a, tp6, tp6p, tp6a)
Build the N8N entry-side JSON payload, byte-identical to v1.0.77 output.
Parameters:
act (string): "buy" or "sell"
mode_lower (string): Execution mode in lowercase (stealth/hybrid/visible)
ticker (string): syminfo.ticker
tf (string): timeframe.period
price_now (float): close
lev (float): Final effective leverage used for the order
sug_lev (float): Suggested leverage from risk-loss calculation
sl_price (float): Stop-loss price (or 0 if none)
liq_price (float): Calculated liquidation price
order_pct (float): Order size as % of equity
tp1 (float)
tp1p (float)
tp1a (bool)
tp2 (float)
tp2p (float)
tp2a (bool)
tp3 (float)
tp3p (float)
tp3a (bool)
tp4 (float)
tp4p (float)
tp4a (bool)
tp5 (float)
tp5p (float)
tp5a (bool)
tp6 (float)
tp6p (float)
tp6a (bool)
Returns: JSON string
n8n_tp_exit_json(act, ticker, tp_idx, tp_pct, pos_size)
Build per-TP exit JSON payload.
Parameters:
act (string): "closelong" or "closeshort"
ticker (string): syminfo.ticker
tp_idx (int): TP number 1..6
tp_pct (float): Exit % for this TP
pos_size (float): math.abs(strategy.position_size)
Returns: JSON string
n8n_close_json(act, ticker)
Build a full-position close JSON payload.
Parameters:
act (string): "closelong" or "closeshort"
ticker (string): syminfo.ticker
Returns: JSON string
av_entry_str(user, side, exchange, lev, symbol, ccy, testing)
Build Autoview entry command string.
Uses Pine placeholder '{{strategy.order.contracts}}' for the quantity.
Parameters:
user (string): Acct identifier
side (string): "long" or "short"
exchange (string): Exchange name
lev (float): Leverage value
symbol (string): Symbol string
ccy (string): "currency" or "contracts"
testing (string): "" or " d=1"
Returns: Autoview-formatted command string
av_exit_str(user, side, exchange, symbol, ccy, testing, is_short)
Build Autoview exit command string. Short exits append "%" to qty per v1.0.77.
Parameters:
user (string): Acct identifier
side (string): "long" or "short"
exchange (string): Exchange name
symbol (string): Symbol string
ccy (string): "currency" or "contracts"
testing (string): "" or " d=1"
is_short (bool): True if this is a short exit (appends "%")
Returns: Autoview-formatted command string
pc_alert_str(licence_id, symbol)
Build PineConnector CSV alert payload.
Uses Pine placeholders for action and contracts.
Parameters:
licence_id (int): Numeric license ID
symbol (string): Symbol with optional suffix (e.g. "EURUSD.a")
Returns: CSV-formatted command string
Biblioteca Pine
Fiel al espíritu de TradingView, el autor ha publicado este código de Pine como biblioteca de código abierto, para que otros programadores de nuestra comunidad puedan reutilizarlo. ¡Enhorabuena al autor! Puede usar esta biblioteca de forma privada o en otras publicaciones de código abierto, pero su reutilización en publicaciones está sujeta a nuestras Normas internas.
Exención de responsabilidad
La información y las publicaciones no constituyen, ni deben considerarse como, asesoramiento o recomendaciones financieras, de inversión, de trading u otro tipo, proporcionadas o respaldadas por TradingView. Obtenga más información en Condiciones de uso.
Biblioteca Pine
Fiel al espíritu de TradingView, el autor ha publicado este código de Pine como biblioteca de código abierto, para que otros programadores de nuestra comunidad puedan reutilizarlo. ¡Enhorabuena al autor! Puede usar esta biblioteca de forma privada o en otras publicaciones de código abierto, pero su reutilización en publicaciones está sujeta a nuestras Normas internas.
Exención de responsabilidad
La información y las publicaciones no constituyen, ni deben considerarse como, asesoramiento o recomendaciones financieras, de inversión, de trading u otro tipo, proporcionadas o respaldadas por TradingView. Obtenga más información en Condiciones de uso.