charton API / @chart-on/core / index / TradeLineOptions
Interface: TradeLineOptions
Defined in: packages/core/src/annotations/types.ts:245
Options of an order or position line. Interaction is opt-in: a line can be dragged only with onDrag or onChange, and buttons appear only with onAction.
Extends
Properties
actions
actions:
TradeAction[]
Defined in: packages/core/src/annotations/types.ts:271
Buttons on the entry block, left to right. Default: ['cancel'] for orders, ['reverse', 'close'] for positions.
actionsReadOnly?
optionalactionsReadOnly?:boolean
Defined in: packages/core/src/annotations/types.ts:237
No action buttons.
Inherited from
TradeLineReadOnly.actionsReadOnly
bracketActions
bracketActions:
TradeAction[]
Defined in: packages/core/src/annotations/types.ts:273
Buttons on the take-profit and stop-loss blocks. Default: ['cancel'].
bracketReadOnly?
optionalbracketReadOnly?:boolean
Defined in: packages/core/src/annotations/types.ts:235
No bracket handle.
Inherited from
TradeLineReadOnly.bracketReadOnly
color?
optionalcolor?:string
Defined in: packages/core/src/annotations/types.ts:254
Default: the theme's up colour for buys, down for sells.
confirmChanges?
optionalconfirmChanges?:boolean
Defined in: packages/core/src/annotations/types.ts:282
A drag released at a new price waits for confirmation: the part shows the new price with confirm and discard buttons, and onChange fires only on confirm. Discard or Escape restores the price. Default: true for orders, false for positions.
dragReadOnly?
optionaldragReadOnly?:boolean
Defined in: packages/core/src/annotations/types.ts:233
No dragging of the entry, take-profit or stop-loss.
Inherited from
TradeLineReadOnly.dragReadOnly
formatPnl?
optionalformatPnl?: (pnl) =>string
Defined in: packages/core/src/annotations/types.ts:269
Format the P&L, e.g. to apply a contract multiplier or a currency. Default: signed price format.
Parameters
pnl
number
Returns
string
kind
kind:
TradeLineKind
Defined in: packages/core/src/annotations/types.ts:246
label?
optionallabel?:string
Defined in: packages/core/src/annotations/types.ts:252
First segment of the label block. Default: Buy / Sell for orders, Long / Short for positions.
labelAnchor?
optionallabelAnchor?:LabelAnchor
Defined in: packages/core/src/annotations/types.ts:160
Where the label block sits: right (default, next to the price axis), center or left. Brackets follow their order.
Inherited from
lineOnly?
optionallineOnly?:boolean
Defined in: packages/core/src/annotations/types.ts:164
Only the line: no label block, no hit testing. For dense ladders of many orders.
Inherited from
lineStyle
lineStyle:
LineStyle
Defined in: packages/core/src/annotations/types.ts:257
Default: dashed for orders, solid for positions.
lineWidth
lineWidth:
number
Defined in: packages/core/src/annotations/types.ts:255
onAction?
optionalonAction?: (e) =>void
Defined in: packages/core/src/annotations/types.ts:289
A button was pressed. Without it, no buttons are shown.
Parameters
e
Returns
void
onBracketCreate?
optionalonBracketCreate?: (e) =>void
Defined in: packages/core/src/annotations/types.ts:296
The entry block gets a handle while a take-profit or stop-loss is unset: dragging it away from the entry proposes one (above a buy is a take-profit, below a stop-loss; the other way round for a sell). The proposal shows until the next applyOptions on the line, which answers it.
Parameters
e
Returns
void
onChange?
optionalonChange?: (e) =>void
Defined in: packages/core/src/annotations/types.ts:287
Drag released at a new price (confirmed, with confirmChanges). The line keeps the new price.
Parameters
e
Returns
void
onClick?
optionalonClick?: (e) =>void
Defined in: packages/core/src/annotations/types.ts:152
Pressed and released on the line or its block without dragging it. Never after a drag.
Parameters
e
Returns
void
Inherited from
LineInteractionOptions.onClick
onDrag?
optionalonDrag?: (e) =>void
Defined in: packages/core/src/annotations/types.ts:275
While dragging, whenever the snapped price changes (and once more after Escape).
Parameters
e
Returns
void
onHover?
optionalonHover?: (e) =>void
Defined in: packages/core/src/annotations/types.ts:148
The pointer moved onto the line or its label block. Once per enter.
Parameters
e
Returns
void
Inherited from
LineInteractionOptions.onHover
onHoverEnd?
optionalonHoverEnd?: () =>void
Defined in: packages/core/src/annotations/types.ts:150
The pointer left the line and its block. Once per leave.
Returns
void
Inherited from
LineInteractionOptions.onHoverEnd
pnl
pnl:
boolean
Defined in: packages/core/src/annotations/types.ts:267
Positions: show profit / loss against the series' last price.
price
price:
number
Defined in: packages/core/src/annotations/types.ts:247
priceAxisLabel?
optionalpriceAxisLabel?:boolean
Defined in: packages/core/src/annotations/types.ts:162
The price label on the axis. Default true.
Inherited from
LineLabelOptions.priceAxisLabel
quantity?
optionalquantity?:string|number
Defined in: packages/core/src/annotations/types.ts:250
Shown in the label block; a number also feeds the position P&L.
readOnly?
optionalreadOnly?:boolean
Defined in: packages/core/src/annotations/types.ts:231
No dragging, no buttons and no bracket handle.
Inherited from
series?
optionalseries?:Series<object>
Defined in: packages/core/src/annotations/types.ts:263
Series whose price scale and pane the line follows. Default: the main series.
side
side:
OrderSide
Defined in: packages/core/src/annotations/types.ts:248
stopLoss?
optionalstopLoss?:number|null
Defined in: packages/core/src/annotations/types.ts:261
Linked stop-loss price; null or omitted hides the line.
takeProfit?
optionaltakeProfit?:number|null
Defined in: packages/core/src/annotations/types.ts:259
Linked take-profit price; null or omitted hides the line.
tickSize?
optionaltickSize?:number
Defined in: packages/core/src/annotations/types.ts:265
Dragged prices snap to multiples of this. Default: one unit of the series precision.
tooltip?
optionaltooltip?:string|string[]
Defined in: packages/core/src/annotations/types.ts:154
Text shown while hovering the line; several strings are several lines.