@pipsend/charts 0.0.12 → 0.0.14

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,6 @@
1
1
  /*!
2
2
  * @license
3
- * Pipsend Charts v0.0.12
3
+ * Pipsend Charts v0.0.14
4
4
  * Copyright (c) 2026 Pipsend
5
5
  * Licensed under MIT License
6
6
  * Built on TradingView Lightweight Charts™ (Apache 2.0)
@@ -15209,6 +15209,8 @@ class PositionMarkersManager {
15209
15209
  exit: options?.shortColors?.exit ?? '#26a69a',
15210
15210
  },
15211
15211
  defaultSize: options?.defaultSize ?? 1,
15212
+ entryOffset: options?.entryOffset ?? 0,
15213
+ exitOffset: options?.exitOffset ?? 0,
15212
15214
  };
15213
15215
  this._private__markersPlugin = createSeriesMarkers(series);
15214
15216
  }
@@ -15233,6 +15235,22 @@ class PositionMarkersManager {
15233
15235
  this._private__positions = [...positions];
15234
15236
  this._private__updateMarkers();
15235
15237
  }
15238
+ /**
15239
+ * Cierra una posición abierta agregando el punto de salida
15240
+ */
15241
+ closePosition(id, exit, exitText) {
15242
+ const position = this._private__positions.find(p => p.id === id);
15243
+ if (position) {
15244
+ position.exit = exit;
15245
+ if (exitText && position.text) {
15246
+ position.text.exit = exitText;
15247
+ }
15248
+ else if (exitText) {
15249
+ position.text = { exit: exitText };
15250
+ }
15251
+ this._private__updateMarkers();
15252
+ }
15253
+ }
15236
15254
  /**
15237
15255
  * Elimina una posición por ID
15238
15256
  */
@@ -15272,6 +15290,12 @@ class PositionMarkersManager {
15272
15290
  if (options.defaultSize !== undefined) {
15273
15291
  this._private__options.defaultSize = options.defaultSize;
15274
15292
  }
15293
+ if (options.entryOffset !== undefined) {
15294
+ this._private__options.entryOffset = options.entryOffset;
15295
+ }
15296
+ if (options.exitOffset !== undefined) {
15297
+ this._private__options.exitOffset = options.exitOffset;
15298
+ }
15275
15299
  this._private__updateMarkers();
15276
15300
  }
15277
15301
  /**
@@ -15286,10 +15310,11 @@ class PositionMarkersManager {
15286
15310
  (isLong ? this._private__options.longColors.entry : this._private__options.shortColors.entry);
15287
15311
  const exitColor = position.color?.exit ??
15288
15312
  (isLong ? this._private__options.longColors.exit : this._private__options.shortColors.exit);
15313
+ // Entry marker (always present)
15289
15314
  const entryMarker = {
15290
15315
  time: position.entry.time,
15291
15316
  position: 'atPriceMiddle',
15292
- price: position.entry.price,
15317
+ price: position.entry.price + this._private__options.entryOffset,
15293
15318
  shape: isLong ? 'arrowUp' : 'arrowDown',
15294
15319
  color: entryColor,
15295
15320
  size: size,
@@ -15301,21 +15326,24 @@ class PositionMarkersManager {
15301
15326
  entryMarker.id = `${position.id}-entry`;
15302
15327
  }
15303
15328
  markers.push(entryMarker);
15304
- const exitMarker = {
15305
- time: position.exit.time,
15306
- position: 'atPriceMiddle',
15307
- price: position.exit.price,
15308
- shape: isLong ? 'arrowDown' : 'arrowUp',
15309
- color: exitColor,
15310
- size: size,
15311
- };
15312
- if (position.text?.exit) {
15313
- exitMarker.text = position.text.exit;
15314
- }
15315
- if (position.id) {
15316
- exitMarker.id = `${position.id}-exit`;
15329
+ // Exit marker (only if position is closed)
15330
+ if (position.exit) {
15331
+ const exitMarker = {
15332
+ time: position.exit.time,
15333
+ position: 'atPriceMiddle',
15334
+ price: position.exit.price + this._private__options.exitOffset,
15335
+ shape: isLong ? 'arrowDown' : 'arrowUp',
15336
+ color: exitColor,
15337
+ size: size,
15338
+ };
15339
+ if (position.text?.exit) {
15340
+ exitMarker.text = position.text.exit;
15341
+ }
15342
+ if (position.id) {
15343
+ exitMarker.id = `${position.id}-exit`;
15344
+ }
15345
+ markers.push(exitMarker);
15317
15346
  }
15318
- markers.push(exitMarker);
15319
15347
  }
15320
15348
  return markers;
15321
15349
  }
@@ -16890,7 +16918,7 @@ const customSeriesDefaultOptions = {
16890
16918
  * Returns the current version as a string. For example `'1.0.0'`.
16891
16919
  */
16892
16920
  function version() {
16893
- return "0.0.12";
16921
+ return "0.0.14";
16894
16922
  }
16895
16923
 
16896
16924
  export { areaSeries as AreaSeries, barSeries as BarSeries, baselineSeries as BaselineSeries, candlestickSeries as CandlestickSeries, ColorType, CrosshairMode, DraggablePriceLine, histogramSeries as HistogramSeries, InteractiveLineManager, LastPriceAnimationMode, lineSeries as LineSeries, LineStyle, LineType, MismatchDirection, PositionMarkersManager, PriceLineSource, PriceScaleMode, TickMarkType, TrackingModeExitMode, applyATR, applyBollingerBands, applyEMA, applyMACD, applyOBV, applyRSI, applySMA, applyStochastic, applyVolume, applyWMA, createChart, createChartEx, createImageWatermark, createInteractiveLineManager, createOptionsChart, createPositionMarkers, createSeriesMarkers, createTextWatermark, createTradingLine, createUpDownMarkers, createYieldCurveChart, customSeriesDefaultOptions, defaultHorzScaleBehavior, isBusinessDay, isUTCTimestamp, setOBVVolumeData, setVolumeData, version };