PINE LIBRARY
已更新 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
發行說明
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
Pine腳本庫
秉持TradingView一貫精神,作者已將此Pine代碼以開源函式庫形式發佈,方便我們社群中的其他Pine程式設計師重複使用。向作者致敬!您可以在私人專案或其他開源發表中使用此函式庫,但在公開發表中重用此代碼須遵守社群規範。
免責聲明
這些資訊和出版物並非旨在提供,也不構成TradingView提供或認可的任何形式的財務、投資、交易或其他類型的建議或推薦。請閱讀使用條款以了解更多資訊。
Pine腳本庫
秉持TradingView一貫精神,作者已將此Pine代碼以開源函式庫形式發佈,方便我們社群中的其他Pine程式設計師重複使用。向作者致敬!您可以在私人專案或其他開源發表中使用此函式庫,但在公開發表中重用此代碼須遵守社群規範。
免責聲明
這些資訊和出版物並非旨在提供,也不構成TradingView提供或認可的任何形式的財務、投資、交易或其他類型的建議或推薦。請閱讀使用條款以了解更多資訊。