@pipsend/charts 2.3.1 → 2.3.3
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.
- package/dist/pipsend-charts.development.mjs +87 -127
- package/dist/pipsend-charts.production.mjs +2 -2
- package/dist/pipsend-charts.standalone.development.js +87 -127
- package/dist/pipsend-charts.standalone.development.mjs +87 -127
- package/dist/pipsend-charts.standalone.production.js +2 -2
- package/dist/pipsend-charts.standalone.production.mjs +2 -2
- package/dist/typings.d.ts +36 -155
- package/package.json +83 -1
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/*!
|
|
2
2
|
* @license
|
|
3
|
-
* Pipsend Charts v2.3.
|
|
3
|
+
* Pipsend Charts v2.3.3
|
|
4
4
|
* Copyright (c) 2026 Pipsend
|
|
5
5
|
* Licensed under MIT License
|
|
6
6
|
* Built on TradingView Lightweight Charts™ (Apache 2.0)
|
|
@@ -2485,6 +2485,22 @@
|
|
|
2485
2485
|
// Used to avoid binary search if bars are already known
|
|
2486
2486
|
return this._private__styleGetter(this._private__findBar, this._private__series._internal_options(), barIndex, precomputedBars);
|
|
2487
2487
|
}
|
|
2488
|
+
/**
|
|
2489
|
+
* Like `barStyle`, but returns null instead of throwing when the bar is
|
|
2490
|
+
* gone.
|
|
2491
|
+
*
|
|
2492
|
+
* Recolouring walks items that were laid out against the data as it was. A
|
|
2493
|
+
* bar that has since disappeared is not an error there: the view is about
|
|
2494
|
+
* to be rebuilt from the new data anyway. Letting it throw took down
|
|
2495
|
+
* whatever asked for the repaint — including `setData`, which left the
|
|
2496
|
+
* series without its data and the pane empty until the page was reloaded.
|
|
2497
|
+
*/
|
|
2498
|
+
_internal_barStyleOrNull(barIndex, precomputedBars) {
|
|
2499
|
+
if (precomputedBars === undefined && this._private__series._internal_bars()._internal_valueAt(barIndex) === null) {
|
|
2500
|
+
return null;
|
|
2501
|
+
}
|
|
2502
|
+
return this._internal_barStyle(barIndex, precomputedBars);
|
|
2503
|
+
}
|
|
2488
2504
|
}
|
|
2489
2505
|
|
|
2490
2506
|
/**
|
|
@@ -11428,10 +11444,14 @@
|
|
|
11428
11444
|
return this._internal__itemsVisibleRange === null ? null : this._internal__renderer;
|
|
11429
11445
|
}
|
|
11430
11446
|
_internal__updateOptions() {
|
|
11431
|
-
|
|
11432
|
-
|
|
11433
|
-
|
|
11434
|
-
|
|
11447
|
+
const colorer = this._internal__series._internal_barColorer();
|
|
11448
|
+
this._internal__items = this._internal__items.map((item) => {
|
|
11449
|
+
// An item whose bar is gone keeps the colour it had. Throwing here
|
|
11450
|
+
// took down whatever asked for the repaint — `setData` among them,
|
|
11451
|
+
// which left the series without its data and the pane empty.
|
|
11452
|
+
const style = colorer._internal_barStyleOrNull(item._internal_time);
|
|
11453
|
+
return style === null ? item : { ...item, ...style };
|
|
11454
|
+
});
|
|
11435
11455
|
}
|
|
11436
11456
|
_internal__clearVisibleRange() {
|
|
11437
11457
|
this._internal__itemsVisibleRange = null;
|
|
@@ -15860,9 +15880,6 @@
|
|
|
15860
15880
|
return wrapper;
|
|
15861
15881
|
}
|
|
15862
15882
|
|
|
15863
|
-
/**
|
|
15864
|
-
* Gestor de marcadores de posiciones de trading
|
|
15865
|
-
*/
|
|
15866
15883
|
class PositionMarkersManager {
|
|
15867
15884
|
constructor(series, options) {
|
|
15868
15885
|
this._private__markersPlugin = null;
|
|
@@ -15882,30 +15899,20 @@
|
|
|
15882
15899
|
};
|
|
15883
15900
|
this._private__markersPlugin = createSeriesMarkers(series);
|
|
15884
15901
|
}
|
|
15885
|
-
/**
|
|
15886
|
-
* Agrega una posición al gráfico
|
|
15887
|
-
*/
|
|
15888
15902
|
addPosition(position) {
|
|
15889
15903
|
this._private__positions.push(position);
|
|
15890
15904
|
this._private__updateMarkers();
|
|
15891
15905
|
}
|
|
15892
|
-
/**
|
|
15893
|
-
* Agrega múltiples posiciones al gráfico
|
|
15894
|
-
*/
|
|
15895
15906
|
addPositions(positions) {
|
|
15896
15907
|
this._private__positions.push(...positions);
|
|
15897
15908
|
this._private__updateMarkers();
|
|
15898
15909
|
}
|
|
15899
|
-
/**
|
|
15900
|
-
* Establece las posiciones (reemplaza las existentes)
|
|
15901
|
-
*/
|
|
15910
|
+
/** Replaces every position currently on the chart. */
|
|
15902
15911
|
setPositions(positions) {
|
|
15903
15912
|
this._private__positions = [...positions];
|
|
15904
15913
|
this._private__updateMarkers();
|
|
15905
15914
|
}
|
|
15906
|
-
/**
|
|
15907
|
-
* Cierra una posición abierta agregando el punto de salida
|
|
15908
|
-
*/
|
|
15915
|
+
/** Closes an open position by giving it an exit point. */
|
|
15909
15916
|
closePosition(id, exit, exitText) {
|
|
15910
15917
|
const position = this._private__positions.find(p => p.id === id);
|
|
15911
15918
|
if (position) {
|
|
@@ -15919,29 +15926,17 @@
|
|
|
15919
15926
|
this._private__updateMarkers();
|
|
15920
15927
|
}
|
|
15921
15928
|
}
|
|
15922
|
-
/**
|
|
15923
|
-
* Elimina una posición por ID
|
|
15924
|
-
*/
|
|
15925
15929
|
removePosition(id) {
|
|
15926
15930
|
this._private__positions = this._private__positions.filter(p => p.id !== id);
|
|
15927
15931
|
this._private__updateMarkers();
|
|
15928
15932
|
}
|
|
15929
|
-
/**
|
|
15930
|
-
* Limpia todas las posiciones
|
|
15931
|
-
*/
|
|
15932
15933
|
clearPositions() {
|
|
15933
15934
|
this._private__positions = [];
|
|
15934
15935
|
this._private__updateMarkers();
|
|
15935
15936
|
}
|
|
15936
|
-
/**
|
|
15937
|
-
* Obtiene todas las posiciones actuales
|
|
15938
|
-
*/
|
|
15939
15937
|
getPositions() {
|
|
15940
15938
|
return this._private__positions;
|
|
15941
15939
|
}
|
|
15942
|
-
/**
|
|
15943
|
-
* Actualiza las opciones del gestor
|
|
15944
|
-
*/
|
|
15945
15940
|
applyOptions(options) {
|
|
15946
15941
|
if (options.longColors) {
|
|
15947
15942
|
this._private__options.longColors = {
|
|
@@ -15966,9 +15961,6 @@
|
|
|
15966
15961
|
}
|
|
15967
15962
|
this._private__updateMarkers();
|
|
15968
15963
|
}
|
|
15969
|
-
/**
|
|
15970
|
-
* Convierte las posiciones a marcadores de serie
|
|
15971
|
-
*/
|
|
15972
15964
|
_private__positionsToMarkers() {
|
|
15973
15965
|
const markers = [];
|
|
15974
15966
|
for (const position of this._private__positions) {
|
|
@@ -16015,18 +16007,12 @@
|
|
|
16015
16007
|
}
|
|
16016
16008
|
return markers;
|
|
16017
16009
|
}
|
|
16018
|
-
/**
|
|
16019
|
-
* Actualiza los marcadores en el gráfico
|
|
16020
|
-
*/
|
|
16021
16010
|
_private__updateMarkers() {
|
|
16022
16011
|
if (this._private__markersPlugin) {
|
|
16023
16012
|
const markers = this._private__positionsToMarkers();
|
|
16024
16013
|
this._private__markersPlugin.setMarkers(markers);
|
|
16025
16014
|
}
|
|
16026
16015
|
}
|
|
16027
|
-
/**
|
|
16028
|
-
* Desconecta el plugin y limpia recursos
|
|
16029
|
-
*/
|
|
16030
16016
|
detach() {
|
|
16031
16017
|
if (this._private__markersPlugin) {
|
|
16032
16018
|
this._private__markersPlugin.detach();
|
|
@@ -16036,47 +16022,18 @@
|
|
|
16036
16022
|
}
|
|
16037
16023
|
}
|
|
16038
16024
|
/**
|
|
16039
|
-
*
|
|
16040
|
-
*
|
|
16041
|
-
* @param series - Serie a la que se adjuntarán los marcadores
|
|
16042
|
-
* @param positions - Posiciones iniciales (opcional)
|
|
16043
|
-
* @param options - Opciones de configuración (opcional)
|
|
16044
|
-
* @returns Instancia del gestor de posiciones
|
|
16025
|
+
* Marks trades on a series with an arrow at the entry and, once closed, at the
|
|
16026
|
+
* exit.
|
|
16045
16027
|
*
|
|
16046
16028
|
* @example
|
|
16047
16029
|
* ```typescript
|
|
16048
|
-
*
|
|
16049
|
-
*
|
|
16050
|
-
*
|
|
16051
|
-
* // Agregar una posición long
|
|
16052
|
-
* positionMarkers.addPosition({
|
|
16053
|
-
* type: 'long',
|
|
16054
|
-
* entry: { time: '2023-01-01', price: 100.50 },
|
|
16055
|
-
* exit: { time: '2023-01-05', price: 105.20 },
|
|
16056
|
-
* id: 'pos-1'
|
|
16057
|
-
* });
|
|
16058
|
-
*
|
|
16059
|
-
* // Agregar una posición short
|
|
16060
|
-
* positionMarkers.addPosition({
|
|
16061
|
-
* type: 'short',
|
|
16062
|
-
* entry: { time: '2023-01-10', price: 110.00 },
|
|
16063
|
-
* exit: { time: '2023-01-15', price: 107.50 },
|
|
16064
|
-
* id: 'pos-2'
|
|
16065
|
-
* });
|
|
16066
|
-
*
|
|
16067
|
-
* // Agregar múltiples posiciones
|
|
16068
|
-
* positionMarkers.setPositions([
|
|
16069
|
-
* {
|
|
16030
|
+
* const markers = createPositionMarkers(candleSeries);
|
|
16031
|
+
* markers.addPosition({
|
|
16070
16032
|
* type: 'long',
|
|
16071
|
-
* entry: { time: '2023-
|
|
16072
|
-
* exit: { time: '2023-
|
|
16073
|
-
*
|
|
16074
|
-
*
|
|
16075
|
-
* type: 'short',
|
|
16076
|
-
* entry: { time: '2023-02-15', price: 102.00 },
|
|
16077
|
-
* exit: { time: '2023-02-20', price: 99.00 }
|
|
16078
|
-
* }
|
|
16079
|
-
* ]);
|
|
16033
|
+
* entry: { time: '2023-01-01', price: 100.50 },
|
|
16034
|
+
* exit: { time: '2023-01-05', price: 105.20 },
|
|
16035
|
+
* id: 'pos-1',
|
|
16036
|
+
* });
|
|
16080
16037
|
* ```
|
|
16081
16038
|
*/
|
|
16082
16039
|
function createPositionMarkers(series, positions, options) {
|
|
@@ -20327,9 +20284,6 @@
|
|
|
20327
20284
|
return new DraggablePriceLine(chart, series, lineOptions);
|
|
20328
20285
|
}
|
|
20329
20286
|
|
|
20330
|
-
/**
|
|
20331
|
-
* Interactive Line Manager - Permite crear líneas haciendo clic en el gráfico
|
|
20332
|
-
*/
|
|
20333
20287
|
class InteractiveLineManager {
|
|
20334
20288
|
constructor(chart, series) {
|
|
20335
20289
|
this._private__container = null;
|
|
@@ -20358,10 +20312,9 @@
|
|
|
20358
20312
|
return price === null ? 0 : price;
|
|
20359
20313
|
}
|
|
20360
20314
|
/**
|
|
20361
|
-
*
|
|
20362
|
-
*
|
|
20363
|
-
* @
|
|
20364
|
-
* @returns Promesa que se resuelve cuando el usuario hace clic
|
|
20315
|
+
* Arms the chart so the next click drops a line.
|
|
20316
|
+
*
|
|
20317
|
+
* @returns The line, once the user has clicked.
|
|
20365
20318
|
*/
|
|
20366
20319
|
enableClickToCreate(mode, customOptions) {
|
|
20367
20320
|
if (!this._private__container) {
|
|
@@ -20382,9 +20335,6 @@
|
|
|
20382
20335
|
this._private__container.addEventListener('click', this._private__clickHandler);
|
|
20383
20336
|
});
|
|
20384
20337
|
}
|
|
20385
|
-
/**
|
|
20386
|
-
* Desactiva el modo de creación por clic
|
|
20387
|
-
*/
|
|
20388
20338
|
disableClickToCreate() {
|
|
20389
20339
|
if (this._private__container && this._private__clickHandler) {
|
|
20390
20340
|
this._private__container.removeEventListener('click', this._private__clickHandler);
|
|
@@ -20474,31 +20424,21 @@
|
|
|
20474
20424
|
}
|
|
20475
20425
|
return new DraggablePriceLine(this._private__chart, this._private__series, options);
|
|
20476
20426
|
}
|
|
20477
|
-
/**
|
|
20478
|
-
* Obtiene el modo actual de creación
|
|
20479
|
-
*/
|
|
20480
20427
|
getCreationMode() {
|
|
20481
20428
|
return this._private__creationMode;
|
|
20482
20429
|
}
|
|
20483
|
-
/**
|
|
20484
|
-
* Verifica si está en modo de creación
|
|
20485
|
-
*/
|
|
20486
20430
|
isCreating() {
|
|
20487
20431
|
return this._private__creationMode !== null;
|
|
20488
20432
|
}
|
|
20489
20433
|
}
|
|
20490
20434
|
/**
|
|
20491
|
-
*
|
|
20492
|
-
*
|
|
20493
|
-
* @param series - Series instance
|
|
20494
|
-
* @returns InteractiveLineManager
|
|
20435
|
+
* Lets the user place draggable lines by clicking the chart.
|
|
20436
|
+
*
|
|
20495
20437
|
* @example
|
|
20496
20438
|
* ```typescript
|
|
20497
20439
|
* const manager = createInteractiveLineManager(chart, candleSeries);
|
|
20498
|
-
*
|
|
20499
|
-
* // Activar modo de creación
|
|
20500
20440
|
* const line = await manager.enableClickToCreate('stop-loss', {
|
|
20501
|
-
* onDragEnd: (price) => console.log('SL:', price)
|
|
20441
|
+
* onDragEnd: (price) => console.log('SL:', price),
|
|
20502
20442
|
* });
|
|
20503
20443
|
* ```
|
|
20504
20444
|
*/
|
|
@@ -24361,9 +24301,6 @@
|
|
|
24361
24301
|
return new VerticalLineTool(context, options);
|
|
24362
24302
|
}
|
|
24363
24303
|
|
|
24364
|
-
/**
|
|
24365
|
-
* Fibonacci Calculator - Cálculos de niveles de retroceso de Fibonacci
|
|
24366
|
-
*/
|
|
24367
24304
|
/**
|
|
24368
24305
|
* Standard Fibonacci retracement ratios
|
|
24369
24306
|
*/
|
|
@@ -24509,10 +24446,7 @@
|
|
|
24509
24446
|
}
|
|
24510
24447
|
}
|
|
24511
24448
|
|
|
24512
|
-
/**
|
|
24513
|
-
* Fibonacci Retracement Tool - Herramienta para dibujar niveles de Fibonacci
|
|
24514
|
-
* Muestra niveles estándar: 0%, 23.6%, 38.2%, 50%, 61.8%, 78.6%, 100%
|
|
24515
|
-
*/
|
|
24449
|
+
/** Draws 0, 23.6, 38.2, 50, 61.8, 78.6 and 100% unless `levels` says otherwise. */
|
|
24516
24450
|
/** A ratio and the label it is shown with, derived rather than stored. */
|
|
24517
24451
|
function toRatio(ratio) {
|
|
24518
24452
|
return { _internal_ratio: ratio, _internal_label: `${(ratio * 100).toFixed(1)}%` };
|
|
@@ -27586,7 +27520,7 @@
|
|
|
27586
27520
|
if (this._private__isOverAnotherDrawing()) {
|
|
27587
27521
|
return;
|
|
27588
27522
|
}
|
|
27589
|
-
const point = this._private__toPanePoint(event);
|
|
27523
|
+
const point = this._private__toPanePoint(event, false);
|
|
27590
27524
|
if (point === null) {
|
|
27591
27525
|
return;
|
|
27592
27526
|
}
|
|
@@ -27605,7 +27539,7 @@
|
|
|
27605
27539
|
if (!this._private__isDrawing) {
|
|
27606
27540
|
return;
|
|
27607
27541
|
}
|
|
27608
|
-
const point = this._private__toPanePoint(event);
|
|
27542
|
+
const point = this._private__toPanePoint(event, true);
|
|
27609
27543
|
if (point === null) {
|
|
27610
27544
|
return;
|
|
27611
27545
|
}
|
|
@@ -27676,13 +27610,51 @@
|
|
|
27676
27610
|
}
|
|
27677
27611
|
this._private__pointerId = null;
|
|
27678
27612
|
}
|
|
27679
|
-
|
|
27613
|
+
/**
|
|
27614
|
+
* Where a press lands relative to the drawing area, or null if it lands
|
|
27615
|
+
* outside it. `clamp` pins the point to the edge instead, for a stroke that
|
|
27616
|
+
* is already under way.
|
|
27617
|
+
*/
|
|
27618
|
+
_private__toPanePoint(event, clamp) {
|
|
27619
|
+
const area = this._private__drawArea();
|
|
27620
|
+
if (area === null) {
|
|
27621
|
+
return null;
|
|
27622
|
+
}
|
|
27623
|
+
const x = event.clientX - area._internal_left;
|
|
27624
|
+
const y = event.clientY - area._internal_top;
|
|
27625
|
+
if (clamp) {
|
|
27626
|
+
return {
|
|
27627
|
+
_internal_x: Math.max(0, Math.min(area._internal_width, x)),
|
|
27628
|
+
_internal_y: Math.max(0, Math.min(area._internal_height, y)),
|
|
27629
|
+
};
|
|
27630
|
+
}
|
|
27631
|
+
if (x < 0 || x > area._internal_width || y < 0 || y > area._internal_height) {
|
|
27632
|
+
return null;
|
|
27633
|
+
}
|
|
27634
|
+
return { _internal_x: x, _internal_y: y };
|
|
27635
|
+
}
|
|
27636
|
+
/**
|
|
27637
|
+
* The pane's element is the whole row, price axis cells included, so its
|
|
27638
|
+
* bounds are not the drawing area's. Taking them for it is what let a press
|
|
27639
|
+
* on an axis start a stroke — and be swallowed, leaving the chart unable to
|
|
27640
|
+
* be stretched while the brush was armed.
|
|
27641
|
+
*/
|
|
27642
|
+
_private__drawArea() {
|
|
27680
27643
|
const paneElement = this._private__paneElement();
|
|
27681
27644
|
if (paneElement === null) {
|
|
27682
27645
|
return null;
|
|
27683
27646
|
}
|
|
27684
27647
|
const rect = paneElement.getBoundingClientRect();
|
|
27685
|
-
|
|
27648
|
+
let left = 0;
|
|
27649
|
+
let width = rect.width;
|
|
27650
|
+
// The time scale measures the drawing area; the left axis, when shown, is
|
|
27651
|
+
// what stands between it and the row's edge.
|
|
27652
|
+
const paneWidth = this._chart.timeScale().width();
|
|
27653
|
+
if (paneWidth > 0) {
|
|
27654
|
+
left = this._chart.priceScale('left').width();
|
|
27655
|
+
width = paneWidth;
|
|
27656
|
+
}
|
|
27657
|
+
return { _internal_left: rect.left + left, _internal_top: rect.top, _internal_width: width, _internal_height: rect.height };
|
|
27686
27658
|
}
|
|
27687
27659
|
_private__paneElement() {
|
|
27688
27660
|
try {
|
|
@@ -28305,9 +28277,6 @@
|
|
|
28305
28277
|
return new TextTool(context, options);
|
|
28306
28278
|
}
|
|
28307
28279
|
|
|
28308
|
-
/**
|
|
28309
|
-
* Position Calculator - Cálculos de P&L, pips, R:R para trading
|
|
28310
|
-
*/
|
|
28311
28280
|
class PositionCalculator {
|
|
28312
28281
|
constructor(pipConfig) {
|
|
28313
28282
|
this._private__pipConfig = pipConfig;
|
|
@@ -28459,9 +28428,6 @@
|
|
|
28459
28428
|
};
|
|
28460
28429
|
}
|
|
28461
28430
|
|
|
28462
|
-
/**
|
|
28463
|
-
* Ruler Calculator - Cálculos de distancia, pips, tiempo para mediciones
|
|
28464
|
-
*/
|
|
28465
28431
|
class RulerCalculator {
|
|
28466
28432
|
constructor(pipConfig) {
|
|
28467
28433
|
this._private__pipConfig = pipConfig;
|
|
@@ -28580,10 +28546,7 @@
|
|
|
28580
28546
|
}
|
|
28581
28547
|
}
|
|
28582
28548
|
|
|
28583
|
-
/**
|
|
28584
|
-
* Measurement Ruler Tool - Herramienta para medir distancia entre dos puntos
|
|
28585
|
-
* Muestra pips, porcentaje, tiempo transcurrido y número de barras
|
|
28586
|
-
*/
|
|
28549
|
+
/** Measures two points: pips, percent, elapsed time and bar count. */
|
|
28587
28550
|
class RulerTool extends DrawingToolBase {
|
|
28588
28551
|
constructor(context, options) {
|
|
28589
28552
|
super(context, 'ruler-tool', options);
|
|
@@ -29143,10 +29106,7 @@
|
|
|
29143
29106
|
}
|
|
29144
29107
|
}
|
|
29145
29108
|
|
|
29146
|
-
/**
|
|
29147
|
-
* Position Tool - Herramienta unificada para marcar posiciones long/short
|
|
29148
|
-
* Muestra dos rectángulos ajustables (profit/loss) con línea vertical conectora
|
|
29149
|
-
*/
|
|
29109
|
+
/** Two adjustable boxes, profit and loss, joined by a vertical connector. */
|
|
29150
29110
|
class PositionTool extends DrawingToolBase {
|
|
29151
29111
|
constructor(context, options) {
|
|
29152
29112
|
super(context, 'position-tool', options);
|
|
@@ -31041,7 +31001,7 @@
|
|
|
31041
31001
|
* Returns the current version as a string. For example `'1.0.0'`.
|
|
31042
31002
|
*/
|
|
31043
31003
|
function version() {
|
|
31044
|
-
return "2.3.
|
|
31004
|
+
return "2.3.3";
|
|
31045
31005
|
}
|
|
31046
31006
|
|
|
31047
31007
|
var PipsendChartsModule = /*#__PURE__*/Object.freeze({
|