@pipsend/charts 1.0.0 → 1.1.0
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 +63 -30
- package/dist/pipsend-charts.production.mjs +2 -2
- package/dist/pipsend-charts.standalone.development.js +63 -30
- package/dist/pipsend-charts.standalone.development.mjs +63 -30
- package/dist/pipsend-charts.standalone.production.js +2 -2
- package/dist/pipsend-charts.standalone.production.mjs +2 -2
- package/dist/typings.d.ts +9 -9
- package/package.json +1 -1
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/*!
|
|
2
2
|
* @license
|
|
3
|
-
* Pipsend Charts v1.
|
|
3
|
+
* Pipsend Charts v1.1.0
|
|
4
4
|
* Copyright (c) 2026 Pipsend
|
|
5
5
|
* Licensed under MIT License
|
|
6
6
|
* Built on TradingView Lightweight Charts™ (Apache 2.0)
|
|
@@ -18133,33 +18133,67 @@ class PositionCalculator {
|
|
|
18133
18133
|
}
|
|
18134
18134
|
}
|
|
18135
18135
|
/**
|
|
18136
|
-
*
|
|
18136
|
+
* Automatically calculate pip configuration based on price
|
|
18137
|
+
* This is completely generic and works for any instrument
|
|
18137
18138
|
*/
|
|
18138
|
-
|
|
18139
|
-
//
|
|
18140
|
-
|
|
18141
|
-
|
|
18142
|
-
|
|
18143
|
-
|
|
18144
|
-
|
|
18145
|
-
|
|
18146
|
-
//
|
|
18147
|
-
|
|
18148
|
-
|
|
18149
|
-
|
|
18150
|
-
|
|
18151
|
-
|
|
18152
|
-
|
|
18153
|
-
|
|
18154
|
-
|
|
18155
|
-
|
|
18156
|
-
}
|
|
18139
|
+
function calculatePipConfig(price) {
|
|
18140
|
+
// Convert price to string to analyze decimal places
|
|
18141
|
+
const priceStr = price.toString();
|
|
18142
|
+
const parts = priceStr.split('.');
|
|
18143
|
+
// Count decimal places
|
|
18144
|
+
const decimals = parts.length > 1 ? parts[1].length : 0;
|
|
18145
|
+
// Calculate pip value based on decimal places
|
|
18146
|
+
// Strategy: 1 pip = smallest meaningful price movement
|
|
18147
|
+
// For prices with many decimals, use 0.0001 (FX style)
|
|
18148
|
+
// For prices with few decimals, use 0.1 or 1
|
|
18149
|
+
let pipValue;
|
|
18150
|
+
if (decimals >= 5) {
|
|
18151
|
+
// Very high precision (rare, but handle it)
|
|
18152
|
+
pipValue = 0.00001;
|
|
18153
|
+
}
|
|
18154
|
+
else if (decimals === 4) {
|
|
18155
|
+
// FX majors: 1.2345 → pip = 0.0001
|
|
18156
|
+
pipValue = 0.0001;
|
|
18157
|
+
}
|
|
18158
|
+
else if (decimals === 3) {
|
|
18159
|
+
// JPY pairs or some commodities: 123.456 → pip = 0.001
|
|
18160
|
+
pipValue = 0.001;
|
|
18161
|
+
}
|
|
18162
|
+
else if (decimals === 2) {
|
|
18163
|
+
// Most commodities/indices: 1234.56 → pip = 0.01
|
|
18164
|
+
pipValue = 0.01;
|
|
18165
|
+
}
|
|
18166
|
+
else if (decimals === 1) {
|
|
18167
|
+
// Some indices: 12345.6 → pip = 0.1
|
|
18168
|
+
pipValue = 0.1;
|
|
18169
|
+
}
|
|
18170
|
+
else {
|
|
18171
|
+
// Whole numbers: 12345 → pip = 1
|
|
18172
|
+
pipValue = 1;
|
|
18173
|
+
}
|
|
18174
|
+
return {
|
|
18175
|
+
pipValue,
|
|
18176
|
+
decimals
|
|
18177
|
+
};
|
|
18178
|
+
}
|
|
18157
18179
|
/**
|
|
18158
|
-
* Helper function
|
|
18180
|
+
* Helper function for backward compatibility
|
|
18181
|
+
* Now ignores symbol and uses price-based detection
|
|
18159
18182
|
*/
|
|
18160
|
-
function getPipConfig(
|
|
18161
|
-
|
|
18162
|
-
|
|
18183
|
+
function getPipConfig(symbolOrPrice, price) {
|
|
18184
|
+
// If first argument is a number, use it as price
|
|
18185
|
+
if (typeof symbolOrPrice === 'number') {
|
|
18186
|
+
return calculatePipConfig(symbolOrPrice);
|
|
18187
|
+
}
|
|
18188
|
+
// If price is provided, use it
|
|
18189
|
+
if (price !== undefined) {
|
|
18190
|
+
return calculatePipConfig(price);
|
|
18191
|
+
}
|
|
18192
|
+
// Fallback: return default config (will be recalculated when price is known)
|
|
18193
|
+
return {
|
|
18194
|
+
pipValue: 0.1,
|
|
18195
|
+
decimals: 1
|
|
18196
|
+
};
|
|
18163
18197
|
}
|
|
18164
18198
|
|
|
18165
18199
|
class PositionPaneRenderer {
|
|
@@ -18210,11 +18244,10 @@ class PositionTool extends DrawingToolBase {
|
|
|
18210
18244
|
entryLineColor: '#ffffff',
|
|
18211
18245
|
opacity: 0.3,
|
|
18212
18246
|
showTooltips: true,
|
|
18213
|
-
symbol: 'DEFAULT',
|
|
18214
18247
|
...options,
|
|
18215
18248
|
};
|
|
18216
|
-
// Initialize calculator
|
|
18217
|
-
const pipConfig = this._private__positionOptions.pipConfig || getPipConfig(this._private__positionOptions.
|
|
18249
|
+
// Initialize calculator with automatic pip detection based on entry price
|
|
18250
|
+
const pipConfig = this._private__positionOptions.pipConfig || getPipConfig(this._private__positionOptions.entryPrice);
|
|
18218
18251
|
this._private__calculator = new PositionCalculator(pipConfig);
|
|
18219
18252
|
// Create primitive and setup
|
|
18220
18253
|
this._private__createPrimitive();
|
|
@@ -23736,7 +23769,7 @@ const customSeriesDefaultOptions = {
|
|
|
23736
23769
|
* Returns the current version as a string. For example `'1.0.0'`.
|
|
23737
23770
|
*/
|
|
23738
23771
|
function version() {
|
|
23739
|
-
return "1.
|
|
23772
|
+
return "1.1.0";
|
|
23740
23773
|
}
|
|
23741
23774
|
|
|
23742
|
-
export { areaSeries as AreaSeries, ArrowTool, barSeries as BarSeries, baselineSeries as BaselineSeries, BrushTool, candlestickSeries as CandlestickSeries, CircleTool, ColorType, CrosshairMode,
|
|
23775
|
+
export { areaSeries as AreaSeries, ArrowTool, barSeries as BarSeries, baselineSeries as BaselineSeries, BrushTool, candlestickSeries as CandlestickSeries, CircleTool, ColorType, CrosshairMode, DEFAULT_SESSIONS, DraggablePriceLine, DrawingToolsManager, EXTENDED_FIBONACCI_RATIOS, FibonacciCalculator, FibonacciExtensionTool, FibonacciFanTool, FibonacciTool, GanttTool, histogramSeries as HistogramSeries, HorizontalLineTool, InteractiveLineManager, LastPriceAnimationMode, lineSeries as LineSeries, LineStyle, LineType, MismatchDirection, PositionCalculator, PositionMarkersManager, PositionTool, PriceLineSource, PriceScaleMode, RectangleTool, RulerCalculator, RulerTool, STANDARD_FIBONACCI_RATIOS, TextTool, TickMarkType, TrackingModeExitMode, TradingSessionsIndicator, TrendLineTool, VerticalLineTool, VolumeProfileIndicator, applyATR, applyBollingerBands, applyEMA, applyMACD, applyOBV, applyRSI, applySMA, applyStochastic, applyVolume, applyWMA, calculatePipConfig, createArrowTool, createBrushTool, createChart, createChartEx, createCircleTool, createFibonacciExtensionTool, createFibonacciFanTool, createFibonacciTool, createGanttTool, createHorizontalLineTool, createImageWatermark, createInteractiveLineManager, createOptionsChart, createPositionMarkers, createPositionTool, createRectangleTool, createRulerTool, createSeriesMarkers, createTextTool, createTextWatermark, createTradingLine, createTradingSessionsIndicator, createTrendLineTool, createUpDownMarkers, createVerticalLineTool, createVolumeProfileIndicator, createYieldCurveChart, customSeriesDefaultOptions, defaultHorzScaleBehavior, getPipConfig, isBusinessDay, isUTCTimestamp, setOBVVolumeData, setVolumeData, setVolumeProfileData, version };
|