VectorTrading

394
VectorTrading

Vector Trading signal-building library for Pine Script v6.

Builds JSON messages for Vector Trading webhook alerts. The consuming script controls signal timing, alert conditions, and alert frequency. This library constructs messages; it does not send alerts or execute trades.

SDK source version: 0.1.0.
TradingView library publication versions are numbered separately.
The version parameter in signal builders identifies the user's strategy version, independently of SDK and library publication versions.

Signal builders

openSignal(version, marketPrice, side, timestamp, hashtag, price, triggerPrice, stopPrice, takeProfits, amountPerc, force, includeHashtag)
Build an open signal.
Parameters:
version (float): Positive finite strategy version.
marketPrice (float): Current positive finite market price.
side (string): buy or sell.
timestamp (string): Decimal milliseconds; "auto" selects timenow. An empty string is invalid.
hashtag (string): Optional ASCII hashtag.
price (float): Optional limit price.
triggerPrice (float): Optional trigger price.
stopPrice (float): Optional protective stop.
takeProfits (array<TakeProfit>): na omits the field; an empty array clears targets; a non-empty array replaces targets.
amountPerc (float): Optional positive percentage, at most 100.
force (series Force): Omitted, explicitly false, or explicitly true; available only for open signals.
includeHashtag (bool): Include an explicitly empty hashtag. Non-empty hashtags are always included.
Returns: JSON; does not send an alert.
Optional na scalars and arrays omit their fields.

updateSignal(version, marketPrice, side, timestamp, hashtag, price, triggerPrice, stopPrice, takeProfits, includeHashtag)
Build an update signal. Amount changes and force are unavailable.
Parameters follow the corresponding openSignal definitions.
Returns: JSON; omitted, empty, and non-empty target arrays remain distinct.

cancelSignal(version, timestamp, hashtag, marketPrice, includeHashtag)
Build a cancellation message.
Returns: JSON; does not send an alert.

closeSignal(version, timestamp, hashtag, marketPrice, includeHashtag)
Build a close message.
Returns: JSON; does not send an alert.

startSignal(version, timestamp, hashtag, includeHashtag)
Build a strategy start message.
Returns: JSON; does not send an alert.

pauseSignal(version, timestamp, hashtag, includeHashtag)
Build a strategy pause message.
Returns: JSON; does not send an alert.

stopSignal(version, timestamp, hashtag, includeHashtag)
Build a strategy stop message.
Returns: JSON; does not send an alert.

deleteSignal(version, timestamp, hashtag, includeHashtag)
Build a strategy deletion message.
Returns: JSON; does not send an alert.

For these builders, version, timestamp, hashtag, and includeHashtag follow the corresponding openSignal definitions.

Types

TakeProfit
A target price and percentage of the position.
Fields:
price (series float): Positive target price.
percent (series float): Positive percentage, at most 100.

Force
Controls whether the force field is included in an open signal:
Force.omitted: Omit the field.
Force.disabled: Include false.
Force.enabled: Include true.

JSON helpers

jsonNumber(value)
Encode a positive finite number without tick-size or decimal rounding.
Parameters:
value (float): Positive finite value.
Returns: A JSON number, retaining Pine's available floating-point precision.

jsonString(value)
Quote a JSON string, preserving Unicode and escaping supported controls.
Parameters:
value (string): String; Pine represents na strings as empty strings. Unsupported C0 controls are rejected.
Returns: A quoted JSON string.

Webhook configuration

Configure the Vector Trading webhook URL in the consuming script's TradingView alert. Keep the strategy API key out of public source code and signal JSON.

Webhook acceptance does not confirm trade execution.

Declinazione di responsabilità

Le informazioni e le pubblicazioni non sono intese come, e non costituiscono, consulenza o raccomandazioni finanziarie, di investimento, di trading o di altro tipo fornite o approvate da TradingView. Per ulteriori informazioni, consultare i Termini di utilizzo.