@forgecharts/sdk 1.1.23 → 1.1.28
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/__tests__/backwardCompatibility.test.d.ts +14 -0
- package/dist/__tests__/backwardCompatibility.test.d.ts.map +1 -0
- package/dist/__tests__/backwardCompatibility.test.js +159 -0
- package/dist/__tests__/backwardCompatibility.test.js.map +1 -0
- package/dist/__tests__/candleInvariant.test.d.ts +20 -0
- package/dist/__tests__/candleInvariant.test.d.ts.map +1 -0
- package/dist/__tests__/candleInvariant.test.js +415 -0
- package/dist/__tests__/candleInvariant.test.js.map +1 -0
- package/dist/__tests__/public-api-surface.d.ts +13 -0
- package/dist/__tests__/public-api-surface.d.ts.map +1 -0
- package/{src/__tests__/public-api-surface.ts → dist/__tests__/public-api-surface.js} +4 -42
- package/dist/__tests__/public-api-surface.js.map +1 -0
- package/dist/__tests__/timeframeBoundary.test.d.ts +17 -0
- package/dist/__tests__/timeframeBoundary.test.d.ts.map +1 -0
- package/dist/__tests__/timeframeBoundary.test.js +452 -0
- package/dist/__tests__/timeframeBoundary.test.js.map +1 -0
- package/dist/api/DrawingManager.d.ts +20 -0
- package/dist/api/DrawingManager.d.ts.map +1 -0
- package/dist/api/DrawingManager.js +190 -0
- package/dist/api/DrawingManager.js.map +1 -0
- package/dist/api/EventBus.d.ts +19 -0
- package/dist/api/EventBus.d.ts.map +1 -0
- package/dist/api/EventBus.js +44 -0
- package/dist/api/EventBus.js.map +1 -0
- package/dist/api/IndicatorDAG.d.ts +85 -0
- package/dist/api/IndicatorDAG.d.ts.map +1 -0
- package/dist/api/IndicatorDAG.js +316 -0
- package/dist/api/IndicatorDAG.js.map +1 -0
- package/dist/api/IndicatorRegistry.d.ts +22 -0
- package/dist/api/IndicatorRegistry.d.ts.map +1 -0
- package/dist/api/IndicatorRegistry.js +39 -0
- package/dist/api/IndicatorRegistry.js.map +1 -0
- package/dist/api/LayoutManager.d.ts +30 -0
- package/dist/api/LayoutManager.d.ts.map +1 -0
- package/dist/api/LayoutManager.js +51 -0
- package/dist/api/LayoutManager.js.map +1 -0
- package/dist/api/PaneManager.d.ts +42 -0
- package/dist/api/PaneManager.d.ts.map +1 -0
- package/dist/api/PaneManager.js +119 -0
- package/dist/api/PaneManager.js.map +1 -0
- package/dist/api/ReferenceAPI.d.ts +78 -0
- package/dist/api/ReferenceAPI.d.ts.map +1 -0
- package/dist/api/ReferenceAPI.js +153 -0
- package/dist/api/ReferenceAPI.js.map +1 -0
- package/dist/api/TChart.d.ts +345 -0
- package/dist/api/TChart.d.ts.map +1 -0
- package/dist/api/TChart.js +765 -0
- package/dist/api/TChart.js.map +1 -0
- package/{src/api/createChart.ts → dist/api/createChart.d.ts} +2 -7
- package/dist/api/createChart.d.ts.map +1 -0
- package/dist/api/createChart.js +42 -0
- package/dist/api/createChart.js.map +1 -0
- package/dist/api/drawing tools/fib gann menu/fibRetracement.d.ts +4 -0
- package/dist/api/drawing tools/fib gann menu/fibRetracement.d.ts.map +1 -0
- package/dist/api/drawing tools/fib gann menu/fibRetracement.js +22 -0
- package/dist/api/drawing tools/fib gann menu/fibRetracement.js.map +1 -0
- package/dist/api/drawing tools/lines menu/crossLine.d.ts +4 -0
- package/dist/api/drawing tools/lines menu/crossLine.d.ts.map +1 -0
- package/dist/api/drawing tools/lines menu/crossLine.js +16 -0
- package/dist/api/drawing tools/lines menu/crossLine.js.map +1 -0
- package/dist/api/drawing tools/lines menu/disjointChannel.d.ts +17 -0
- package/dist/api/drawing tools/lines menu/disjointChannel.d.ts.map +1 -0
- package/dist/api/drawing tools/lines menu/disjointChannel.js +59 -0
- package/dist/api/drawing tools/lines menu/disjointChannel.js.map +1 -0
- package/dist/api/drawing tools/lines menu/extendedLine.d.ts +4 -0
- package/dist/api/drawing tools/lines menu/extendedLine.d.ts.map +1 -0
- package/dist/api/drawing tools/lines menu/extendedLine.js +17 -0
- package/dist/api/drawing tools/lines menu/extendedLine.js.map +1 -0
- package/dist/api/drawing tools/lines menu/flatTopBottom.d.ts +4 -0
- package/dist/api/drawing tools/lines menu/flatTopBottom.d.ts.map +1 -0
- package/dist/api/drawing tools/lines menu/flatTopBottom.js +41 -0
- package/dist/api/drawing tools/lines menu/flatTopBottom.js.map +1 -0
- package/dist/api/drawing tools/lines menu/horizontal.d.ts +4 -0
- package/dist/api/drawing tools/lines menu/horizontal.d.ts.map +1 -0
- package/dist/api/drawing tools/lines menu/horizontal.js +19 -0
- package/dist/api/drawing tools/lines menu/horizontal.js.map +1 -0
- package/dist/api/drawing tools/lines menu/horizontalRay.d.ts +4 -0
- package/dist/api/drawing tools/lines menu/horizontalRay.d.ts.map +1 -0
- package/dist/api/drawing tools/lines menu/horizontalRay.js +20 -0
- package/dist/api/drawing tools/lines menu/horizontalRay.js.map +1 -0
- package/dist/api/drawing tools/lines menu/infoLine.d.ts +4 -0
- package/dist/api/drawing tools/lines menu/infoLine.d.ts.map +1 -0
- package/dist/api/drawing tools/lines menu/infoLine.js +107 -0
- package/dist/api/drawing tools/lines menu/infoLine.js.map +1 -0
- package/dist/api/drawing tools/lines menu/insidePitchfork.d.ts +4 -0
- package/dist/api/drawing tools/lines menu/insidePitchfork.d.ts.map +1 -0
- package/dist/api/drawing tools/lines menu/insidePitchfork.js +31 -0
- package/dist/api/drawing tools/lines menu/insidePitchfork.js.map +1 -0
- package/dist/api/drawing tools/lines menu/modifiedSchiffPitchfork.d.ts +4 -0
- package/dist/api/drawing tools/lines menu/modifiedSchiffPitchfork.d.ts.map +1 -0
- package/dist/api/drawing tools/lines menu/modifiedSchiffPitchfork.js +15 -0
- package/dist/api/drawing tools/lines menu/modifiedSchiffPitchfork.js.map +1 -0
- package/dist/api/drawing tools/lines menu/parallelChannel.d.ts +4 -0
- package/dist/api/drawing tools/lines menu/parallelChannel.d.ts.map +1 -0
- package/dist/api/drawing tools/lines menu/parallelChannel.js +43 -0
- package/dist/api/drawing tools/lines menu/parallelChannel.js.map +1 -0
- package/dist/api/drawing tools/lines menu/pitchfork.d.ts +4 -0
- package/dist/api/drawing tools/lines menu/pitchfork.d.ts.map +1 -0
- package/dist/api/drawing tools/lines menu/pitchfork.js +12 -0
- package/dist/api/drawing tools/lines menu/pitchfork.js.map +1 -0
- package/dist/api/drawing tools/lines menu/ray.d.ts +4 -0
- package/dist/api/drawing tools/lines menu/ray.d.ts.map +1 -0
- package/dist/api/drawing tools/lines menu/ray.js +23 -0
- package/dist/api/drawing tools/lines menu/ray.js.map +1 -0
- package/dist/api/drawing tools/lines menu/regressionTrend.d.ts +4 -0
- package/dist/api/drawing tools/lines menu/regressionTrend.d.ts.map +1 -0
- package/dist/api/drawing tools/lines menu/regressionTrend.js +127 -0
- package/dist/api/drawing tools/lines menu/regressionTrend.js.map +1 -0
- package/dist/api/drawing tools/lines menu/schiffPitchfork.d.ts +4 -0
- package/dist/api/drawing tools/lines menu/schiffPitchfork.d.ts.map +1 -0
- package/dist/api/drawing tools/lines menu/schiffPitchfork.js +15 -0
- package/dist/api/drawing tools/lines menu/schiffPitchfork.js.map +1 -0
- package/dist/api/drawing tools/lines menu/trendAngle.d.ts +4 -0
- package/dist/api/drawing tools/lines menu/trendAngle.d.ts.map +1 -0
- package/dist/api/drawing tools/lines menu/trendAngle.js +51 -0
- package/dist/api/drawing tools/lines menu/trendAngle.js.map +1 -0
- package/dist/api/drawing tools/lines menu/trendline.d.ts +4 -0
- package/dist/api/drawing tools/lines menu/trendline.d.ts.map +1 -0
- package/dist/api/drawing tools/lines menu/trendline.js +11 -0
- package/dist/api/drawing tools/lines menu/trendline.js.map +1 -0
- package/dist/api/drawing tools/lines menu/vertical.d.ts +4 -0
- package/dist/api/drawing tools/lines menu/vertical.d.ts.map +1 -0
- package/dist/api/drawing tools/lines menu/vertical.js +11 -0
- package/dist/api/drawing tools/lines menu/vertical.js.map +1 -0
- package/dist/api/drawing tools/pointers menu/crosshair.d.ts +16 -0
- package/dist/api/drawing tools/pointers menu/crosshair.d.ts.map +1 -0
- package/{src/api/drawing tools/pointers menu/crosshair.ts → dist/api/drawing tools/pointers menu/crosshair.js } +6 -7
- package/dist/api/drawing tools/pointers menu/crosshair.js.map +1 -0
- package/dist/api/drawing tools/pointers menu/cursor.d.ts +15 -0
- package/dist/api/drawing tools/pointers menu/cursor.d.ts.map +1 -0
- package/{src/api/drawing tools/pointers menu/cursor.ts → dist/api/drawing tools/pointers menu/cursor.js } +7 -8
- package/dist/api/drawing tools/pointers menu/cursor.js.map +1 -0
- package/dist/api/drawing tools/pointers menu/demonstration.d.ts +30 -0
- package/dist/api/drawing tools/pointers menu/demonstration.d.ts.map +1 -0
- package/{src/api/drawing tools/pointers menu/demonstration.ts → dist/api/drawing tools/pointers menu/demonstration.js } +9 -14
- package/dist/api/drawing tools/pointers menu/demonstration.js.map +1 -0
- package/dist/api/drawing tools/pointers menu/dot.d.ts +23 -0
- package/dist/api/drawing tools/pointers menu/dot.d.ts.map +1 -0
- package/{src/api/drawing tools/pointers menu/dot.ts → dist/api/drawing tools/pointers menu/dot.js } +8 -11
- package/dist/api/drawing tools/pointers menu/dot.js.map +1 -0
- package/dist/api/drawing tools/shapes menu/rectangle.d.ts +4 -0
- package/dist/api/drawing tools/shapes menu/rectangle.d.ts.map +1 -0
- package/dist/api/drawing tools/shapes menu/rectangle.js +19 -0
- package/dist/api/drawing tools/shapes menu/rectangle.js.map +1 -0
- package/dist/api/drawing tools/shapes menu/text.d.ts +4 -0
- package/dist/api/drawing tools/shapes menu/text.d.ts.map +1 -0
- package/dist/api/drawing tools/shapes menu/text.js +25 -0
- package/dist/api/drawing tools/shapes menu/text.js.map +1 -0
- package/dist/api/drawingUtils.d.ts +22 -0
- package/dist/api/drawingUtils.d.ts.map +1 -0
- package/dist/api/drawingUtils.js +83 -0
- package/dist/api/drawingUtils.js.map +1 -0
- package/dist/core/CanvasLayer.d.ts +26 -0
- package/dist/core/CanvasLayer.d.ts.map +1 -0
- package/dist/core/CanvasLayer.js +56 -0
- package/dist/core/CanvasLayer.js.map +1 -0
- package/dist/core/Chart.d.ts +164 -0
- package/dist/core/Chart.d.ts.map +1 -0
- package/dist/core/Chart.js +839 -0
- package/dist/core/Chart.js.map +1 -0
- package/dist/core/CoordTransform.d.ts +168 -0
- package/dist/core/CoordTransform.d.ts.map +1 -0
- package/dist/core/CoordTransform.js +224 -0
- package/dist/core/CoordTransform.js.map +1 -0
- package/dist/core/Crosshair.d.ts +30 -0
- package/dist/core/Crosshair.d.ts.map +1 -0
- package/dist/core/Crosshair.js +186 -0
- package/dist/core/Crosshair.js.map +1 -0
- package/dist/core/IndicatorEngine.d.ts +51 -0
- package/dist/core/IndicatorEngine.d.ts.map +1 -0
- package/dist/core/IndicatorEngine.js +181 -0
- package/dist/core/IndicatorEngine.js.map +1 -0
- package/dist/core/InteractionManager.d.ts +197 -0
- package/dist/core/InteractionManager.d.ts.map +1 -0
- package/dist/core/InteractionManager.js +698 -0
- package/dist/core/InteractionManager.js.map +1 -0
- package/dist/core/PriceScale.d.ts +27 -0
- package/dist/core/PriceScale.d.ts.map +1 -0
- package/dist/core/PriceScale.js +113 -0
- package/dist/core/PriceScale.js.map +1 -0
- package/dist/core/Series.d.ts +40 -0
- package/dist/core/Series.d.ts.map +1 -0
- package/dist/core/Series.js +114 -0
- package/dist/core/Series.js.map +1 -0
- package/dist/core/TimeScale.d.ts +43 -0
- package/dist/core/TimeScale.d.ts.map +1 -0
- package/dist/core/TimeScale.js +150 -0
- package/dist/core/TimeScale.js.map +1 -0
- package/dist/datafeed/DatafeedConnector.d.ts +89 -0
- package/dist/datafeed/DatafeedConnector.d.ts.map +1 -0
- package/dist/datafeed/DatafeedConnector.js +268 -0
- package/dist/datafeed/DatafeedConnector.js.map +1 -0
- package/dist/engine/CandleEngine.d.ts +207 -0
- package/dist/engine/CandleEngine.d.ts.map +1 -0
- package/dist/engine/CandleEngine.js +318 -0
- package/dist/engine/CandleEngine.js.map +1 -0
- package/dist/engine/__tests__/CandleEngine.test.d.ts +2 -0
- package/dist/engine/__tests__/CandleEngine.test.d.ts.map +1 -0
- package/dist/engine/__tests__/CandleEngine.test.js +300 -0
- package/dist/engine/__tests__/CandleEngine.test.js.map +1 -0
- package/dist/engine/candleInvariants.d.ts +66 -0
- package/dist/engine/candleInvariants.d.ts.map +1 -0
- package/dist/engine/candleInvariants.js +134 -0
- package/dist/engine/candleInvariants.js.map +1 -0
- package/{src/engine/mergeUtils.ts → dist/engine/mergeUtils.d.ts} +15 -52
- package/dist/engine/mergeUtils.d.ts.map +1 -0
- package/dist/engine/mergeUtils.js +64 -0
- package/dist/engine/mergeUtils.js.map +1 -0
- package/dist/engine/timeframeUtils.d.ts +80 -0
- package/dist/engine/timeframeUtils.d.ts.map +1 -0
- package/{src/engine/timeframeUtils.ts → dist/engine/timeframeUtils.js} +30 -48
- package/dist/engine/timeframeUtils.js.map +1 -0
- package/dist/index.d.ts +40 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +49 -0
- package/dist/index.js.map +1 -0
- package/dist/internal.d.ts +29 -0
- package/dist/internal.d.ts.map +1 -0
- package/{src/internal.ts → dist/internal.js} +2 -11
- package/dist/internal.js.map +1 -0
- package/dist/licensing/ChartRuntimeResolver.d.ts +233 -0
- package/dist/licensing/ChartRuntimeResolver.d.ts.map +1 -0
- package/dist/licensing/ChartRuntimeResolver.js +310 -0
- package/dist/licensing/ChartRuntimeResolver.js.map +1 -0
- package/dist/licensing/LicenseManager.d.ts +55 -0
- package/dist/licensing/LicenseManager.d.ts.map +1 -0
- package/dist/licensing/LicenseManager.js +114 -0
- package/dist/licensing/LicenseManager.js.map +1 -0
- package/dist/licensing/__tests__/ChartRuntimeResolver.test.d.ts +13 -0
- package/dist/licensing/__tests__/ChartRuntimeResolver.test.d.ts.map +1 -0
- package/dist/licensing/__tests__/ChartRuntimeResolver.test.js +177 -0
- package/dist/licensing/__tests__/ChartRuntimeResolver.test.js.map +1 -0
- package/dist/licensing/__tests__/LicenseManager.test.d.ts +12 -0
- package/dist/licensing/__tests__/LicenseManager.test.d.ts.map +1 -0
- package/dist/licensing/__tests__/LicenseManager.test.js +153 -0
- package/dist/licensing/__tests__/LicenseManager.test.js.map +1 -0
- package/dist/licensing/licenseTypes.d.ts +18 -0
- package/dist/licensing/licenseTypes.d.ts.map +1 -0
- package/dist/licensing/licenseTypes.js +2 -0
- package/dist/licensing/licenseTypes.js.map +1 -0
- package/dist/pine/PineCompiler.d.ts +35 -0
- package/dist/pine/PineCompiler.d.ts.map +1 -0
- package/dist/pine/PineCompiler.js +44 -0
- package/dist/pine/PineCompiler.js.map +1 -0
- package/dist/pine/diagnostics.d.ts +20 -0
- package/dist/pine/diagnostics.d.ts.map +1 -0
- package/dist/pine/diagnostics.js +11 -0
- package/dist/pine/diagnostics.js.map +1 -0
- package/{src/pine/index.ts → dist/pine/index.d.ts} +4 -3
- package/dist/pine/index.d.ts.map +1 -0
- package/dist/pine/index.js +5 -0
- package/dist/pine/index.js.map +1 -0
- package/dist/pine/pine-ast.d.ts +142 -0
- package/dist/pine/pine-ast.d.ts.map +1 -0
- package/dist/pine/pine-ast.js +19 -0
- package/dist/pine/pine-ast.js.map +1 -0
- package/dist/pine/pine-lexer.d.ts +41 -0
- package/dist/pine/pine-lexer.d.ts.map +1 -0
- package/dist/pine/pine-lexer.js +249 -0
- package/dist/pine/pine-lexer.js.map +1 -0
- package/dist/pine/pine-parser.d.ts +51 -0
- package/dist/pine/pine-parser.d.ts.map +1 -0
- package/dist/pine/pine-parser.js +416 -0
- package/dist/pine/pine-parser.js.map +1 -0
- package/dist/pine/pine-transpiler.d.ts +33 -0
- package/dist/pine/pine-transpiler.d.ts.map +1 -0
- package/dist/pine/pine-transpiler.js +260 -0
- package/dist/pine/pine-transpiler.js.map +1 -0
- package/dist/pixi/LayerName.d.ts +18 -0
- package/dist/pixi/LayerName.d.ts.map +1 -0
- package/dist/pixi/LayerName.js +35 -0
- package/dist/pixi/LayerName.js.map +1 -0
- package/dist/pixi/PixiCandlestickRenderer.d.ts +23 -0
- package/dist/pixi/PixiCandlestickRenderer.d.ts.map +1 -0
- package/dist/pixi/PixiCandlestickRenderer.js +107 -0
- package/dist/pixi/PixiCandlestickRenderer.js.map +1 -0
- package/dist/pixi/PixiChart.d.ts +72 -0
- package/dist/pixi/PixiChart.d.ts.map +1 -0
- package/dist/pixi/PixiChart.js +367 -0
- package/dist/pixi/PixiChart.js.map +1 -0
- package/dist/pixi/PixiCrosshairRenderer.d.ts +29 -0
- package/dist/pixi/PixiCrosshairRenderer.d.ts.map +1 -0
- package/dist/pixi/PixiCrosshairRenderer.js +110 -0
- package/dist/pixi/PixiCrosshairRenderer.js.map +1 -0
- package/dist/pixi/PixiDrawingRenderer.d.ts +17 -0
- package/dist/pixi/PixiDrawingRenderer.d.ts.map +1 -0
- package/dist/pixi/PixiDrawingRenderer.js +111 -0
- package/dist/pixi/PixiDrawingRenderer.js.map +1 -0
- package/dist/pixi/PixiGridRenderer.d.ts +22 -0
- package/dist/pixi/PixiGridRenderer.d.ts.map +1 -0
- package/dist/pixi/PixiGridRenderer.js +114 -0
- package/dist/pixi/PixiGridRenderer.js.map +1 -0
- package/dist/pixi/PixiLayerManager.d.ts +56 -0
- package/dist/pixi/PixiLayerManager.d.ts.map +1 -0
- package/dist/pixi/PixiLayerManager.js +92 -0
- package/dist/pixi/PixiLayerManager.js.map +1 -0
- package/dist/react/canvas/ChartCanvas.d.ts +85 -0
- package/dist/react/canvas/ChartCanvas.d.ts.map +1 -0
- package/dist/react/canvas/ChartCanvas.js +604 -0
- package/dist/react/canvas/ChartCanvas.js.map +1 -0
- package/dist/react/canvas/ChartContextMenu.d.ts +18 -0
- package/dist/react/canvas/ChartContextMenu.d.ts.map +1 -0
- package/dist/react/canvas/ChartContextMenu.js +5 -0
- package/dist/react/canvas/ChartContextMenu.js.map +1 -0
- package/dist/react/canvas/ChartSettingsDialog.d.ts +25 -0
- package/dist/react/canvas/ChartSettingsDialog.d.ts.map +1 -0
- package/dist/react/canvas/ChartSettingsDialog.js +28 -0
- package/dist/react/canvas/ChartSettingsDialog.js.map +1 -0
- package/dist/react/canvas/IndicatorLabel.d.ts +21 -0
- package/dist/react/canvas/IndicatorLabel.d.ts.map +1 -0
- package/dist/react/canvas/IndicatorLabel.js +196 -0
- package/dist/react/canvas/IndicatorLabel.js.map +1 -0
- package/dist/react/canvas/IndicatorPane.d.ts +32 -0
- package/dist/react/canvas/IndicatorPane.d.ts.map +1 -0
- package/dist/react/canvas/IndicatorPane.js +395 -0
- package/dist/react/canvas/IndicatorPane.js.map +1 -0
- package/dist/react/canvas/PointerOverlay.d.ts +23 -0
- package/dist/react/canvas/PointerOverlay.d.ts.map +1 -0
- package/dist/react/canvas/PointerOverlay.js +61 -0
- package/dist/react/canvas/PointerOverlay.js.map +1 -0
- package/dist/react/canvas/toolbars/LeftToolbar.d.ts +19 -0
- package/dist/react/canvas/toolbars/LeftToolbar.d.ts.map +1 -0
- package/dist/react/canvas/toolbars/LeftToolbar.js +407 -0
- package/dist/react/canvas/toolbars/LeftToolbar.js.map +1 -0
- package/dist/react/hooks/useChartCapabilities.d.ts +21 -0
- package/dist/react/hooks/useChartCapabilities.d.ts.map +1 -0
- package/dist/react/hooks/useChartCapabilities.js +66 -0
- package/dist/react/hooks/useChartCapabilities.js.map +1 -0
- package/dist/react/index.d.ts +30 -0
- package/dist/react/index.d.ts.map +1 -0
- package/dist/react/index.js +28 -0
- package/dist/react/index.js.map +1 -0
- package/dist/react/internal.d.ts +38 -0
- package/dist/react/internal.d.ts.map +1 -0
- package/dist/react/internal.js +44 -0
- package/dist/react/internal.js.map +1 -0
- package/dist/react/shell/ManagedAppShell.d.ts +91 -0
- package/dist/react/shell/ManagedAppShell.d.ts.map +1 -0
- package/dist/react/shell/ManagedAppShell.js +440 -0
- package/dist/react/shell/ManagedAppShell.js.map +1 -0
- package/dist/react/trading/TradingBridge.d.ts +86 -0
- package/dist/react/trading/TradingBridge.d.ts.map +1 -0
- package/dist/react/trading/TradingBridge.js +73 -0
- package/dist/react/trading/TradingBridge.js.map +1 -0
- package/dist/react/workspace/ChartWorkspace.d.ts +73 -0
- package/dist/react/workspace/ChartWorkspace.d.ts.map +1 -0
- package/dist/react/workspace/ChartWorkspace.js +42 -0
- package/dist/react/workspace/ChartWorkspace.js.map +1 -0
- package/dist/react/workspace/FloatingPanel.d.ts +18 -0
- package/dist/react/workspace/FloatingPanel.d.ts.map +1 -0
- package/dist/react/workspace/FloatingPanel.js +82 -0
- package/dist/react/workspace/FloatingPanel.js.map +1 -0
- package/dist/react/workspace/IndicatorsDialog.d.ts +8 -0
- package/dist/react/workspace/IndicatorsDialog.d.ts.map +1 -0
- package/dist/react/workspace/IndicatorsDialog.js +121 -0
- package/dist/react/workspace/IndicatorsDialog.js.map +1 -0
- package/dist/react/workspace/LayoutMenu.d.ts +33 -0
- package/dist/react/workspace/LayoutMenu.d.ts.map +1 -0
- package/dist/react/workspace/LayoutMenu.js +113 -0
- package/dist/react/workspace/LayoutMenu.js.map +1 -0
- package/dist/react/workspace/SymbolSearchDialog.d.ts +10 -0
- package/dist/react/workspace/SymbolSearchDialog.d.ts.map +1 -0
- package/dist/react/workspace/SymbolSearchDialog.js +245 -0
- package/dist/react/workspace/SymbolSearchDialog.js.map +1 -0
- package/dist/react/workspace/TabBar.d.ts +17 -0
- package/dist/react/workspace/TabBar.d.ts.map +1 -0
- package/dist/react/workspace/TabBar.js +29 -0
- package/dist/react/workspace/TabBar.js.map +1 -0
- package/dist/react/workspace/toolbars/BottomToolbar.d.ts +19 -0
- package/dist/react/workspace/toolbars/BottomToolbar.d.ts.map +1 -0
- package/dist/react/workspace/toolbars/BottomToolbar.js +236 -0
- package/dist/react/workspace/toolbars/BottomToolbar.js.map +1 -0
- package/dist/react/workspace/toolbars/RightToolbar.d.ts +8 -0
- package/dist/react/workspace/toolbars/RightToolbar.d.ts.map +1 -0
- package/dist/react/workspace/toolbars/RightToolbar.js +18 -0
- package/dist/react/workspace/toolbars/RightToolbar.js.map +1 -0
- package/dist/react/workspace/toolbars/TopToolbar.d.ts +41 -0
- package/dist/react/workspace/toolbars/TopToolbar.d.ts.map +1 -0
- package/dist/react/workspace/toolbars/TopToolbar.js +82 -0
- package/dist/react/workspace/toolbars/TopToolbar.js.map +1 -0
- package/dist/renderers/CandlestickRenderer.d.ts +13 -0
- package/dist/renderers/CandlestickRenderer.d.ts.map +1 -0
- package/dist/renderers/CandlestickRenderer.js +98 -0
- package/dist/renderers/CandlestickRenderer.js.map +1 -0
- package/dist/renderers/HistogramRenderer.d.ts +11 -0
- package/dist/renderers/HistogramRenderer.d.ts.map +1 -0
- package/dist/renderers/HistogramRenderer.js +50 -0
- package/dist/renderers/HistogramRenderer.js.map +1 -0
- package/dist/renderers/LineRenderer.d.ts +12 -0
- package/dist/renderers/LineRenderer.d.ts.map +1 -0
- package/dist/renderers/LineRenderer.js +64 -0
- package/dist/renderers/LineRenderer.js.map +1 -0
- package/dist/theme/colors.d.ts +4 -0
- package/dist/theme/colors.d.ts.map +1 -0
- package/dist/theme/colors.js +19 -0
- package/dist/theme/colors.js.map +1 -0
- package/dist/tools/barDivergenceCheck.d.ts +120 -0
- package/dist/tools/barDivergenceCheck.d.ts.map +1 -0
- package/dist/tools/barDivergenceCheck.js +200 -0
- package/dist/tools/barDivergenceCheck.js.map +1 -0
- package/dist/trading/TradingOverlayStore.d.ts +86 -0
- package/dist/trading/TradingOverlayStore.d.ts.map +1 -0
- package/dist/trading/TradingOverlayStore.js +139 -0
- package/dist/trading/TradingOverlayStore.js.map +1 -0
- package/dist/trading/UnmanagedIngestion.d.ts +91 -0
- package/dist/trading/UnmanagedIngestion.d.ts.map +1 -0
- package/dist/trading/UnmanagedIngestion.js +114 -0
- package/dist/trading/UnmanagedIngestion.js.map +1 -0
- package/dist/trading/__tests__/ManagedTradingController.test.d.ts +18 -0
- package/dist/trading/__tests__/ManagedTradingController.test.d.ts.map +1 -0
- package/dist/trading/__tests__/ManagedTradingController.test.js +271 -0
- package/dist/trading/__tests__/ManagedTradingController.test.js.map +1 -0
- package/dist/trading/__tests__/TradingOverlayStore.test.d.ts +16 -0
- package/dist/trading/__tests__/TradingOverlayStore.test.d.ts.map +1 -0
- package/dist/trading/__tests__/TradingOverlayStore.test.js +267 -0
- package/dist/trading/__tests__/TradingOverlayStore.test.js.map +1 -0
- package/dist/trading/__tests__/UnmanagedIngestion.test.d.ts +16 -0
- package/dist/trading/__tests__/UnmanagedIngestion.test.d.ts.map +1 -0
- package/dist/trading/__tests__/UnmanagedIngestion.test.js +170 -0
- package/dist/trading/__tests__/UnmanagedIngestion.test.js.map +1 -0
- package/dist/trading/managed/ManagedTradingController.d.ts +110 -0
- package/dist/trading/managed/ManagedTradingController.d.ts.map +1 -0
- package/dist/trading/managed/ManagedTradingController.js +247 -0
- package/dist/trading/managed/ManagedTradingController.js.map +1 -0
- package/dist/trading/managed/managedCapabilities.d.ts +45 -0
- package/dist/trading/managed/managedCapabilities.d.ts.map +1 -0
- package/dist/trading/managed/managedCapabilities.js +79 -0
- package/dist/trading/managed/managedCapabilities.js.map +1 -0
- package/dist/trading/managed/managedTypes.d.ts +122 -0
- package/dist/trading/managed/managedTypes.d.ts.map +1 -0
- package/dist/trading/managed/managedTypes.js +13 -0
- package/dist/trading/managed/managedTypes.js.map +1 -0
- package/dist/trading/tradingTypes.d.ts +89 -0
- package/dist/trading/tradingTypes.d.ts.map +1 -0
- package/dist/trading/tradingTypes.js +8 -0
- package/dist/trading/tradingTypes.js.map +1 -0
- package/dist/tscript/TScriptIndicator.d.ts +41 -0
- package/dist/tscript/TScriptIndicator.d.ts.map +1 -0
- package/dist/tscript/TScriptIndicator.js +47 -0
- package/dist/tscript/TScriptIndicator.js.map +1 -0
- package/dist/tscript/ast.d.ts +89 -0
- package/dist/tscript/ast.d.ts.map +1 -0
- package/dist/tscript/ast.js +22 -0
- package/dist/tscript/ast.js.map +1 -0
- package/dist/tscript/lexer.d.ts +36 -0
- package/dist/tscript/lexer.d.ts.map +1 -0
- package/dist/tscript/lexer.js +187 -0
- package/dist/tscript/lexer.js.map +1 -0
- package/dist/tscript/parser.d.ts +50 -0
- package/dist/tscript/parser.d.ts.map +1 -0
- package/dist/tscript/parser.js +318 -0
- package/dist/tscript/parser.js.map +1 -0
- package/dist/tscript/runtime.d.ts +123 -0
- package/dist/tscript/runtime.d.ts.map +1 -0
- package/dist/tscript/runtime.js +475 -0
- package/dist/tscript/runtime.js.map +1 -0
- package/dist/tscript/series.d.ts +49 -0
- package/dist/tscript/series.d.ts.map +1 -0
- package/dist/tscript/series.js +79 -0
- package/dist/tscript/series.js.map +1 -0
- package/dist/types/IChart.d.ts +48 -0
- package/dist/types/IChart.d.ts.map +1 -0
- package/dist/types/IChart.js +2 -0
- package/dist/types/IChart.js.map +1 -0
- package/{src/types/IRenderer.ts → dist/types/IRenderer.d.ts} +2 -8
- package/dist/types/IRenderer.d.ts.map +1 -0
- package/dist/types/IRenderer.js +2 -0
- package/dist/types/IRenderer.js.map +1 -0
- package/dist/types/ISeries.d.ts +26 -0
- package/dist/types/ISeries.d.ts.map +1 -0
- package/dist/types/ISeries.js +2 -0
- package/dist/types/ISeries.js.map +1 -0
- package/package.json +32 -4
- package/src/__tests__/backwardCompatibility.test.ts +0 -191
- package/src/__tests__/candleInvariant.test.ts +0 -500
- package/src/__tests__/timeframeBoundary.test.ts +0 -583
- package/src/api/DrawingManager.ts +0 -188
- package/src/api/EventBus.ts +0 -53
- package/src/api/IndicatorDAG.ts +0 -389
- package/src/api/IndicatorRegistry.ts +0 -47
- package/src/api/LayoutManager.ts +0 -72
- package/src/api/PaneManager.ts +0 -129
- package/src/api/ReferenceAPI.ts +0 -195
- package/src/api/TChart.ts +0 -881
- package/src/api/drawing tools/fib gann menu/fibRetracement.ts +0 -27
- package/src/api/drawing tools/lines menu/crossLine.ts +0 -21
- package/src/api/drawing tools/lines menu/disjointChannel.ts +0 -74
- package/src/api/drawing tools/lines menu/extendedLine.ts +0 -22
- package/src/api/drawing tools/lines menu/flatTopBottom.ts +0 -45
- package/src/api/drawing tools/lines menu/horizontal.ts +0 -24
- package/src/api/drawing tools/lines menu/horizontalRay.ts +0 -25
- package/src/api/drawing tools/lines menu/infoLine.ts +0 -127
- package/src/api/drawing tools/lines menu/insidePitchfork.ts +0 -21
- package/src/api/drawing tools/lines menu/modifiedSchiffPitchfork.ts +0 -18
- package/src/api/drawing tools/lines menu/parallelChannel.ts +0 -47
- package/src/api/drawing tools/lines menu/pitchfork.ts +0 -15
- package/src/api/drawing tools/lines menu/ray.ts +0 -28
- package/src/api/drawing tools/lines menu/regressionTrend.ts +0 -157
- package/src/api/drawing tools/lines menu/schiffPitchfork.ts +0 -18
- package/src/api/drawing tools/lines menu/trendAngle.ts +0 -64
- package/src/api/drawing tools/lines menu/trendline.ts +0 -16
- package/src/api/drawing tools/lines menu/vertical.ts +0 -16
- package/src/api/drawing tools/shapes menu/rectangle.ts +0 -24
- package/src/api/drawing tools/shapes menu/text.ts +0 -30
- package/src/api/drawingUtils.ts +0 -82
- package/src/core/CanvasLayer.ts +0 -77
- package/src/core/Chart.ts +0 -917
- package/src/core/CoordTransform.ts +0 -282
- package/src/core/Crosshair.ts +0 -207
- package/src/core/IndicatorEngine.ts +0 -216
- package/src/core/InteractionManager.ts +0 -899
- package/src/core/PriceScale.ts +0 -133
- package/src/core/Series.ts +0 -132
- package/src/core/TimeScale.ts +0 -175
- package/src/datafeed/DatafeedConnector.ts +0 -300
- package/src/engine/CandleEngine.ts +0 -458
- package/src/engine/__tests__/CandleEngine.test.ts +0 -402
- package/src/engine/candleInvariants.ts +0 -172
- package/src/index.ts +0 -190
- package/src/licensing/ChartRuntimeResolver.ts +0 -380
- package/src/licensing/LicenseManager.ts +0 -131
- package/src/licensing/__tests__/ChartRuntimeResolver.test.ts +0 -207
- package/src/licensing/__tests__/LicenseManager.test.ts +0 -180
- package/src/licensing/licenseTypes.ts +0 -19
- package/src/pine/PineCompiler.ts +0 -68
- package/src/pine/diagnostics.ts +0 -30
- package/src/pine/pine-ast.ts +0 -163
- package/src/pine/pine-lexer.ts +0 -265
- package/src/pine/pine-parser.ts +0 -439
- package/src/pine/pine-transpiler.ts +0 -301
- package/src/pixi/LayerName.ts +0 -35
- package/src/pixi/PixiCandlestickRenderer.ts +0 -125
- package/src/pixi/PixiChart.ts +0 -425
- package/src/pixi/PixiCrosshairRenderer.ts +0 -134
- package/src/pixi/PixiDrawingRenderer.ts +0 -121
- package/src/pixi/PixiGridRenderer.ts +0 -136
- package/src/pixi/PixiLayerManager.ts +0 -102
- package/src/renderers/CandlestickRenderer.ts +0 -130
- package/src/renderers/HistogramRenderer.ts +0 -63
- package/src/renderers/LineRenderer.ts +0 -77
- package/src/theme/colors.ts +0 -21
- package/src/tools/barDivergenceCheck.ts +0 -305
- package/src/trading/TradingOverlayStore.ts +0 -161
- package/src/trading/UnmanagedIngestion.ts +0 -156
- package/src/trading/__tests__/ManagedTradingController.test.ts +0 -338
- package/src/trading/__tests__/TradingOverlayStore.test.ts +0 -323
- package/src/trading/__tests__/UnmanagedIngestion.test.ts +0 -205
- package/src/trading/managed/ManagedTradingController.ts +0 -292
- package/src/trading/managed/managedCapabilities.ts +0 -98
- package/src/trading/managed/managedTypes.ts +0 -151
- package/src/trading/tradingTypes.ts +0 -135
- package/src/tscript/TScriptIndicator.ts +0 -54
- package/src/tscript/ast.ts +0 -105
- package/src/tscript/lexer.ts +0 -190
- package/src/tscript/parser.ts +0 -334
- package/src/tscript/runtime.ts +0 -525
- package/src/tscript/series.ts +0 -84
- package/src/types/IChart.ts +0 -56
- package/src/types/ISeries.ts +0 -30
- package/tsconfig.json +0 -22
- package/tsup.config.ts +0 -15
- package/vitest.config.ts +0 -25
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
import type { Drawing } from '@forgecharts/types';
|
|
2
|
-
import type { CoordTransform } from '../../../core/CoordTransform';
|
|
3
|
-
|
|
4
|
-
export function renderFibRetracement(
|
|
5
|
-
ctx: CanvasRenderingContext2D,
|
|
6
|
-
d: Drawing,
|
|
7
|
-
t: CoordTransform,
|
|
8
|
-
): void {
|
|
9
|
-
const p0 = d.points[0];
|
|
10
|
-
const p1 = d.points[1];
|
|
11
|
-
if (!p0 || !p1) return;
|
|
12
|
-
const priceHigh = Math.max(p0.price, p1.price);
|
|
13
|
-
const priceLow = Math.min(p0.price, p1.price);
|
|
14
|
-
const span = priceHigh - priceLow;
|
|
15
|
-
const x0 = Math.min(t.timeToX(p0.time), t.timeToX(p1.time));
|
|
16
|
-
const x1 = Math.max(t.timeToX(p0.time), t.timeToX(p1.time));
|
|
17
|
-
ctx.save();
|
|
18
|
-
for (const ratio of [0, 0.236, 0.382, 0.5, 0.618, 0.786, 1]) {
|
|
19
|
-
const ly = t.priceToY(priceLow + span * (1 - ratio));
|
|
20
|
-
ctx.globalAlpha = 0.6;
|
|
21
|
-
ctx.beginPath();
|
|
22
|
-
ctx.moveTo(x0, ly);
|
|
23
|
-
ctx.lineTo(x1, ly);
|
|
24
|
-
ctx.stroke();
|
|
25
|
-
}
|
|
26
|
-
ctx.restore();
|
|
27
|
-
}
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import type { Drawing } from '@forgecharts/types';
|
|
2
|
-
import type { CoordTransform } from '../../../core/CoordTransform';
|
|
3
|
-
|
|
4
|
-
export function renderCrossLine(
|
|
5
|
-
ctx: CanvasRenderingContext2D,
|
|
6
|
-
d: Drawing,
|
|
7
|
-
t: CoordTransform,
|
|
8
|
-
): void {
|
|
9
|
-
const p0 = d.points[0];
|
|
10
|
-
if (!p0) return;
|
|
11
|
-
const x = t.timeToX(p0.time);
|
|
12
|
-
const y = t.priceToY(p0.price);
|
|
13
|
-
ctx.beginPath();
|
|
14
|
-
ctx.moveTo(0, y);
|
|
15
|
-
ctx.lineTo(t.plotWidth, y);
|
|
16
|
-
ctx.stroke();
|
|
17
|
-
ctx.beginPath();
|
|
18
|
-
ctx.moveTo(x, 0);
|
|
19
|
-
ctx.lineTo(x, t.plotHeight);
|
|
20
|
-
ctx.stroke();
|
|
21
|
-
}
|
|
@@ -1,74 +0,0 @@
|
|
|
1
|
-
import type { Drawing } from '@forgecharts/types';
|
|
2
|
-
import type { CoordTransform } from '../../../core/CoordTransform';
|
|
3
|
-
|
|
4
|
-
// ─── Renderer ─────────────────────────────────────────────────────────────────
|
|
5
|
-
|
|
6
|
-
/**
|
|
7
|
-
* Disjoint Channel — two fully independent trend lines forming a channel.
|
|
8
|
-
*
|
|
9
|
-
* Anchors (4 points):
|
|
10
|
-
* p0 — left endpoint of line 1 (top-left)
|
|
11
|
-
* p1 — right endpoint of line 1 (top-right)
|
|
12
|
-
* p2 — left endpoint of line 2 (bottom-left)
|
|
13
|
-
* p3 — right endpoint of line 2 (bottom-right)
|
|
14
|
-
*
|
|
15
|
-
* The tool places p2/p3 automatically when p0→p1 is drawn (offset downward).
|
|
16
|
-
* The user can then drag any of the 4 handles to reshape freely — including
|
|
17
|
-
* crossing the lines to create a bowtie / expanding wedge shape.
|
|
18
|
-
*/
|
|
19
|
-
export function renderDisjointChannel(
|
|
20
|
-
ctx: CanvasRenderingContext2D,
|
|
21
|
-
d: Drawing,
|
|
22
|
-
t: CoordTransform,
|
|
23
|
-
): void {
|
|
24
|
-
const p0 = d.points[0];
|
|
25
|
-
const p1 = d.points[1];
|
|
26
|
-
if (!p0 || !p1) return;
|
|
27
|
-
|
|
28
|
-
const x0 = t.timeToX(p0.time), y0 = t.priceToY(p0.price);
|
|
29
|
-
const x1 = t.timeToX(p1.time), y1 = t.priceToY(p1.price);
|
|
30
|
-
|
|
31
|
-
const p2 = d.points[2];
|
|
32
|
-
const p3 = d.points[3];
|
|
33
|
-
|
|
34
|
-
// During drawing (only 2 points placed yet) — show just the first segment
|
|
35
|
-
if (!p2 || !p3) {
|
|
36
|
-
ctx.beginPath();
|
|
37
|
-
ctx.moveTo(x0, y0);
|
|
38
|
-
ctx.lineTo(x1, y1);
|
|
39
|
-
ctx.stroke();
|
|
40
|
-
return;
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
const x2 = t.timeToX(p2.time), y2 = t.priceToY(p2.price);
|
|
44
|
-
const x3 = t.timeToX(p3.time), y3 = t.priceToY(p3.price);
|
|
45
|
-
|
|
46
|
-
const color = d.color ?? '#2196f3';
|
|
47
|
-
ctx.strokeStyle = color;
|
|
48
|
-
|
|
49
|
-
// Fill the quadrilateral first (behind the lines)
|
|
50
|
-
ctx.save();
|
|
51
|
-
ctx.globalAlpha = 0.07;
|
|
52
|
-
ctx.fillStyle = color;
|
|
53
|
-
ctx.beginPath();
|
|
54
|
-
ctx.moveTo(x0, y0);
|
|
55
|
-
ctx.lineTo(x1, y1);
|
|
56
|
-
ctx.lineTo(x3, y3);
|
|
57
|
-
ctx.lineTo(x2, y2);
|
|
58
|
-
ctx.closePath();
|
|
59
|
-
ctx.fill();
|
|
60
|
-
ctx.restore();
|
|
61
|
-
|
|
62
|
-
// Line 1: p0 → p1
|
|
63
|
-
ctx.beginPath();
|
|
64
|
-
ctx.moveTo(x0, y0);
|
|
65
|
-
ctx.lineTo(x1, y1);
|
|
66
|
-
ctx.stroke();
|
|
67
|
-
|
|
68
|
-
// Line 2: p2 → p3
|
|
69
|
-
ctx.beginPath();
|
|
70
|
-
ctx.moveTo(x2, y2);
|
|
71
|
-
ctx.lineTo(x3, y3);
|
|
72
|
-
ctx.stroke();
|
|
73
|
-
}
|
|
74
|
-
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import type { Drawing } from '@forgecharts/types';
|
|
2
|
-
import type { CoordTransform } from '../../../core/CoordTransform';
|
|
3
|
-
import { rayExit } from '../../drawingUtils';
|
|
4
|
-
|
|
5
|
-
export function renderExtendedLine(
|
|
6
|
-
ctx: CanvasRenderingContext2D,
|
|
7
|
-
d: Drawing,
|
|
8
|
-
t: CoordTransform,
|
|
9
|
-
): void {
|
|
10
|
-
const p0 = d.points[0];
|
|
11
|
-
const p1 = d.points[1];
|
|
12
|
-
if (!p0 || !p1) return;
|
|
13
|
-
const x0 = t.timeToX(p0.time), y0 = t.priceToY(p0.price);
|
|
14
|
-
const x1 = t.timeToX(p1.time), y1 = t.priceToY(p1.price);
|
|
15
|
-
const dx = x1 - x0, dy = y1 - y0;
|
|
16
|
-
const exitFwd = rayExit(t.plotWidth, t.plotHeight, x1, y1, dx, dy);
|
|
17
|
-
const exitBack = rayExit(t.plotWidth, t.plotHeight, x0, y0, -dx, -dy);
|
|
18
|
-
ctx.beginPath();
|
|
19
|
-
ctx.moveTo(exitBack.x, exitBack.y);
|
|
20
|
-
ctx.lineTo(exitFwd.x, exitFwd.y);
|
|
21
|
-
ctx.stroke();
|
|
22
|
-
}
|
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
import type { Drawing } from '@forgecharts/types';
|
|
2
|
-
import type { CoordTransform } from '../../../core/CoordTransform';
|
|
3
|
-
|
|
4
|
-
export function renderFlatTopBottom(
|
|
5
|
-
ctx: CanvasRenderingContext2D,
|
|
6
|
-
d: Drawing,
|
|
7
|
-
t: CoordTransform,
|
|
8
|
-
): void {
|
|
9
|
-
const p0 = d.points[0];
|
|
10
|
-
const p1 = d.points[1];
|
|
11
|
-
if (!p0 || !p1) return;
|
|
12
|
-
const x0 = t.timeToX(p0.time), y0 = t.priceToY(p0.price);
|
|
13
|
-
const x1 = t.timeToX(p1.time), y1 = t.priceToY(p1.price);
|
|
14
|
-
ctx.beginPath();
|
|
15
|
-
ctx.moveTo(x0, y0);
|
|
16
|
-
ctx.lineTo(x1, y1);
|
|
17
|
-
ctx.stroke();
|
|
18
|
-
const p2 = d.points[2];
|
|
19
|
-
if (!p2) return;
|
|
20
|
-
const yFlat = t.priceToY(p2.price);
|
|
21
|
-
ctx.beginPath();
|
|
22
|
-
ctx.moveTo(x0, yFlat);
|
|
23
|
-
ctx.lineTo(x1, yFlat);
|
|
24
|
-
ctx.stroke();
|
|
25
|
-
ctx.save();
|
|
26
|
-
ctx.globalAlpha = 0.35;
|
|
27
|
-
ctx.beginPath();
|
|
28
|
-
ctx.moveTo(x0, y0);
|
|
29
|
-
ctx.lineTo(x0, yFlat);
|
|
30
|
-
ctx.stroke();
|
|
31
|
-
ctx.beginPath();
|
|
32
|
-
ctx.moveTo(x1, y1);
|
|
33
|
-
ctx.lineTo(x1, yFlat);
|
|
34
|
-
ctx.stroke();
|
|
35
|
-
ctx.globalAlpha = 0.07;
|
|
36
|
-
ctx.fillStyle = d.color ?? '#2196f3';
|
|
37
|
-
ctx.beginPath();
|
|
38
|
-
ctx.moveTo(x0, y0);
|
|
39
|
-
ctx.lineTo(x1, y1);
|
|
40
|
-
ctx.lineTo(x1, yFlat);
|
|
41
|
-
ctx.lineTo(x0, yFlat);
|
|
42
|
-
ctx.closePath();
|
|
43
|
-
ctx.fill();
|
|
44
|
-
ctx.restore();
|
|
45
|
-
}
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import type { Drawing } from '@forgecharts/types';
|
|
2
|
-
import type { CoordTransform } from '../../../core/CoordTransform';
|
|
3
|
-
|
|
4
|
-
export function renderHorizontal(
|
|
5
|
-
ctx: CanvasRenderingContext2D,
|
|
6
|
-
d: Drawing,
|
|
7
|
-
t: CoordTransform,
|
|
8
|
-
): void {
|
|
9
|
-
const p0 = d.points[0];
|
|
10
|
-
if (!p0) return;
|
|
11
|
-
const y = t.priceToY(p0.price);
|
|
12
|
-
ctx.beginPath();
|
|
13
|
-
ctx.moveTo(0, y);
|
|
14
|
-
ctx.lineTo(t.plotWidth, y);
|
|
15
|
-
ctx.stroke();
|
|
16
|
-
// Price label
|
|
17
|
-
ctx.save();
|
|
18
|
-
ctx.font = '10px -apple-system, sans-serif';
|
|
19
|
-
ctx.fillStyle = d.color ?? '#2196f3';
|
|
20
|
-
ctx.textAlign = 'left';
|
|
21
|
-
ctx.textBaseline = 'middle';
|
|
22
|
-
ctx.fillText(p0.price.toFixed(2), t.plotWidth + 4, y);
|
|
23
|
-
ctx.restore();
|
|
24
|
-
}
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import type { Drawing } from '@forgecharts/types';
|
|
2
|
-
import type { CoordTransform } from '../../../core/CoordTransform';
|
|
3
|
-
|
|
4
|
-
export function renderHorizontalRay(
|
|
5
|
-
ctx: CanvasRenderingContext2D,
|
|
6
|
-
d: Drawing,
|
|
7
|
-
t: CoordTransform,
|
|
8
|
-
): void {
|
|
9
|
-
const p0 = d.points[0];
|
|
10
|
-
if (!p0) return;
|
|
11
|
-
const x0 = t.timeToX(p0.time);
|
|
12
|
-
const y = t.priceToY(p0.price);
|
|
13
|
-
ctx.beginPath();
|
|
14
|
-
ctx.moveTo(x0, y);
|
|
15
|
-
ctx.lineTo(t.plotWidth, y);
|
|
16
|
-
ctx.stroke();
|
|
17
|
-
// Price label
|
|
18
|
-
ctx.save();
|
|
19
|
-
ctx.font = '10px -apple-system, sans-serif';
|
|
20
|
-
ctx.fillStyle = d.color ?? '#2196f3';
|
|
21
|
-
ctx.textAlign = 'left';
|
|
22
|
-
ctx.textBaseline = 'middle';
|
|
23
|
-
ctx.fillText(p0.price.toFixed(2), t.plotWidth + 4, y);
|
|
24
|
-
ctx.restore();
|
|
25
|
-
}
|
|
@@ -1,127 +0,0 @@
|
|
|
1
|
-
import type { Drawing } from '@forgecharts/types';
|
|
2
|
-
import type { CoordTransform } from '../../../core/CoordTransform';
|
|
3
|
-
import { TF_SECS, formatDuration } from '../../drawingUtils';
|
|
4
|
-
|
|
5
|
-
export function renderInfoLine(
|
|
6
|
-
ctx: CanvasRenderingContext2D,
|
|
7
|
-
d: Drawing,
|
|
8
|
-
t: CoordTransform,
|
|
9
|
-
interval = '1h',
|
|
10
|
-
): void {
|
|
11
|
-
const p0 = d.points[0];
|
|
12
|
-
const p1 = d.points[1];
|
|
13
|
-
if (!p0 || !p1) return;
|
|
14
|
-
|
|
15
|
-
const x0 = t.timeToX(p0.time), y0 = t.priceToY(p0.price);
|
|
16
|
-
const x1 = t.timeToX(p1.time), y1 = t.priceToY(p1.price);
|
|
17
|
-
const dx = x1 - x0;
|
|
18
|
-
const dy = y1 - y0;
|
|
19
|
-
const len = Math.sqrt(dx * dx + dy * dy) || 1;
|
|
20
|
-
const ux = dx / len;
|
|
21
|
-
const uy = dy / len;
|
|
22
|
-
|
|
23
|
-
const color = d.color ?? '#2196f3';
|
|
24
|
-
ctx.strokeStyle = color;
|
|
25
|
-
ctx.fillStyle = color;
|
|
26
|
-
|
|
27
|
-
// ── Line segment from p0 to p1 ────────────────────────────────────────────
|
|
28
|
-
ctx.beginPath();
|
|
29
|
-
ctx.moveTo(x0, y0);
|
|
30
|
-
ctx.lineTo(x1, y1);
|
|
31
|
-
ctx.stroke();
|
|
32
|
-
|
|
33
|
-
// ── Stats banner ─────────────────────────────────────────────────────────
|
|
34
|
-
const priceDiff = p1.price - p0.price;
|
|
35
|
-
const pctChange = p0.price !== 0 ? (priceDiff / p0.price) * 100 : 0;
|
|
36
|
-
const timeDiff = Math.abs(p1.time - p0.time);
|
|
37
|
-
const tfSecs = TF_SECS[interval] ?? 3600;
|
|
38
|
-
const bars = Math.round(timeDiff / tfSecs);
|
|
39
|
-
const duration = formatDuration(timeDiff);
|
|
40
|
-
const pixDist = Math.round(len);
|
|
41
|
-
const angleRad = Math.atan2(-(y1 - y0), x1 - x0);
|
|
42
|
-
const angleDeg = (angleRad * 180 / Math.PI).toFixed(2);
|
|
43
|
-
const sign = priceDiff >= 0 ? '+' : '';
|
|
44
|
-
const decimals = p0.price < 1 ? 6 : 2;
|
|
45
|
-
const priceStr = `${sign}${priceDiff.toFixed(decimals)} (${sign}${pctChange.toFixed(2)}%)`;
|
|
46
|
-
const barsStr = `\u2194 ${bars} bars (${duration}), distance: ${pixDist} px`;
|
|
47
|
-
const angleStr = `\u25b3 ${angleDeg}\u00b0`;
|
|
48
|
-
const labels = [priceStr, barsStr, angleStr];
|
|
49
|
-
const icons = ['\u21d5', '', ''];
|
|
50
|
-
|
|
51
|
-
const PAD_X = 8;
|
|
52
|
-
const PAD_Y = 6;
|
|
53
|
-
const LINE_H = 16;
|
|
54
|
-
const BANNER_W = 240;
|
|
55
|
-
const BANNER_H = PAD_Y * 2 + labels.length * LINE_H;
|
|
56
|
-
|
|
57
|
-
// Place banner perpendicular to the line, offset from the midpoint
|
|
58
|
-
const midX = (x0 + x1) / 2;
|
|
59
|
-
const midY = (y0 + y1) / 2;
|
|
60
|
-
// Perpendicular unit vector (rotated 90° counter-clockwise)
|
|
61
|
-
const px = -uy;
|
|
62
|
-
const py = ux;
|
|
63
|
-
const OFFSET = BANNER_H / 2 + 12; // enough to clear the line
|
|
64
|
-
|
|
65
|
-
// Try offset in the "up" perpendicular direction first
|
|
66
|
-
let bx = midX + px * OFFSET - BANNER_W / 2;
|
|
67
|
-
let by = midY + py * OFFSET - BANNER_H / 2;
|
|
68
|
-
|
|
69
|
-
// If that clips vertically, flip to the other side
|
|
70
|
-
if (by < 2 || by + BANNER_H > t.plotHeight - 2) {
|
|
71
|
-
bx = midX - px * OFFSET - BANNER_W / 2;
|
|
72
|
-
by = midY - py * OFFSET - BANNER_H / 2;
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
// Clamp to plot area
|
|
76
|
-
bx = Math.max(2, Math.min(bx, t.plotWidth - BANNER_W - 2));
|
|
77
|
-
by = Math.max(2, Math.min(by, t.plotHeight - BANNER_H - 2));
|
|
78
|
-
|
|
79
|
-
ctx.save();
|
|
80
|
-
|
|
81
|
-
const hex = color.replace('#', '');
|
|
82
|
-
const r = parseInt(hex.slice(0, 2), 16);
|
|
83
|
-
const g = parseInt(hex.slice(2, 4), 16);
|
|
84
|
-
const b = parseInt(hex.slice(4, 6), 16);
|
|
85
|
-
|
|
86
|
-
// Background
|
|
87
|
-
ctx.fillStyle = `rgba(${r},${g},${b},0.12)`;
|
|
88
|
-
ctx.beginPath();
|
|
89
|
-
const radius = 4;
|
|
90
|
-
ctx.moveTo(bx + radius, by);
|
|
91
|
-
ctx.lineTo(bx + BANNER_W - radius, by);
|
|
92
|
-
ctx.arcTo(bx + BANNER_W, by, bx + BANNER_W, by + radius, radius);
|
|
93
|
-
ctx.lineTo(bx + BANNER_W, by + BANNER_H - radius);
|
|
94
|
-
ctx.arcTo(bx + BANNER_W, by + BANNER_H, bx + BANNER_W - radius, by + BANNER_H, radius);
|
|
95
|
-
ctx.lineTo(bx + radius, by + BANNER_H);
|
|
96
|
-
ctx.arcTo(bx, by + BANNER_H, bx, by + BANNER_H - radius, radius);
|
|
97
|
-
ctx.lineTo(bx, by + radius);
|
|
98
|
-
ctx.arcTo(bx, by, bx + radius, by, radius);
|
|
99
|
-
ctx.closePath();
|
|
100
|
-
ctx.fill();
|
|
101
|
-
|
|
102
|
-
// Border
|
|
103
|
-
ctx.strokeStyle = `rgba(${r},${g},${b},0.5)`;
|
|
104
|
-
ctx.lineWidth = 1;
|
|
105
|
-
ctx.setLineDash([]);
|
|
106
|
-
ctx.stroke();
|
|
107
|
-
|
|
108
|
-
// Text rows
|
|
109
|
-
const FONT = '11px -apple-system, BlinkMacSystemFont, sans-serif';
|
|
110
|
-
ctx.font = FONT;
|
|
111
|
-
ctx.textAlign = 'left';
|
|
112
|
-
ctx.textBaseline = 'top';
|
|
113
|
-
labels.forEach((line, i) => {
|
|
114
|
-
const ty = by + PAD_Y + i * LINE_H;
|
|
115
|
-
if (icons[i]) {
|
|
116
|
-
ctx.fillStyle = `rgba(${r},${g},${b},0.7)`;
|
|
117
|
-
ctx.fillText(icons[i], bx + PAD_X, ty + 1);
|
|
118
|
-
ctx.fillStyle = color;
|
|
119
|
-
ctx.fillText(line, bx + PAD_X + 14, ty + 1);
|
|
120
|
-
} else {
|
|
121
|
-
ctx.fillStyle = color;
|
|
122
|
-
ctx.fillText(line, bx + PAD_X, ty + 1);
|
|
123
|
-
}
|
|
124
|
-
});
|
|
125
|
-
|
|
126
|
-
ctx.restore();
|
|
127
|
-
}
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import type { Drawing } from '@forgecharts/types';
|
|
2
|
-
import type { CoordTransform } from '../../../core/CoordTransform';
|
|
3
|
-
import { getPF3 } from '../../drawingUtils';
|
|
4
|
-
import { renderTrendline } from './trendline';
|
|
5
|
-
|
|
6
|
-
export function renderInsidePitchfork(
|
|
7
|
-
ctx: CanvasRenderingContext2D,
|
|
8
|
-
d: Drawing,
|
|
9
|
-
t: CoordTransform,
|
|
10
|
-
): void {
|
|
11
|
-
const pf = getPF3(d, t);
|
|
12
|
-
if (!pf) { renderTrendline(ctx, d, t); return; }
|
|
13
|
-
const { x0, y0, x1, y1, x2, y2 } = pf;
|
|
14
|
-
const midX = (x1 + x2) / 2, midY = (y1 + y2) / 2;
|
|
15
|
-
ctx.beginPath(); ctx.moveTo(x0, y0); ctx.lineTo(midX, midY); ctx.stroke();
|
|
16
|
-
ctx.beginPath(); ctx.moveTo(x0, y0); ctx.lineTo(x1, y1); ctx.stroke();
|
|
17
|
-
ctx.beginPath(); ctx.moveTo(x0, y0); ctx.lineTo(x2, y2); ctx.stroke();
|
|
18
|
-
ctx.save(); ctx.globalAlpha = 0.4;
|
|
19
|
-
ctx.beginPath(); ctx.moveTo(x1, y1); ctx.lineTo(x2, y2); ctx.stroke();
|
|
20
|
-
ctx.restore();
|
|
21
|
-
}
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import type { Drawing } from '@forgecharts/types';
|
|
2
|
-
import type { CoordTransform } from '../../../core/CoordTransform';
|
|
3
|
-
import { getPF3, drawPitchforkLines } from '../../drawingUtils';
|
|
4
|
-
import { renderTrendline } from './trendline';
|
|
5
|
-
|
|
6
|
-
export function renderModifiedSchiffPitchfork(
|
|
7
|
-
ctx: CanvasRenderingContext2D,
|
|
8
|
-
d: Drawing,
|
|
9
|
-
t: CoordTransform,
|
|
10
|
-
): void {
|
|
11
|
-
const pf = getPF3(d, t);
|
|
12
|
-
if (!pf) { renderTrendline(ctx, d, t); return; }
|
|
13
|
-
const { x0, y0, x1, y1, x2, y2 } = pf;
|
|
14
|
-
const midX = (x1 + x2) / 2, midY = (y1 + y2) / 2;
|
|
15
|
-
const pivX = (x0 + x1) / 2;
|
|
16
|
-
const pivY = (y0 + y1) / 2;
|
|
17
|
-
drawPitchforkLines(ctx, t, pivX, pivY, midX, midY, x1, y1, x2, y2);
|
|
18
|
-
}
|
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
import type { Drawing } from '@forgecharts/types';
|
|
2
|
-
import type { CoordTransform } from '../../../core/CoordTransform';
|
|
3
|
-
|
|
4
|
-
export function renderParallelChannel(
|
|
5
|
-
ctx: CanvasRenderingContext2D,
|
|
6
|
-
d: Drawing,
|
|
7
|
-
t: CoordTransform,
|
|
8
|
-
): void {
|
|
9
|
-
const p0 = d.points[0];
|
|
10
|
-
const p1 = d.points[1];
|
|
11
|
-
if (!p0 || !p1) return;
|
|
12
|
-
const x0 = t.timeToX(p0.time), y0 = t.priceToY(p0.price);
|
|
13
|
-
const x1 = t.timeToX(p1.time), y1 = t.priceToY(p1.price);
|
|
14
|
-
ctx.beginPath();
|
|
15
|
-
ctx.moveTo(x0, y0);
|
|
16
|
-
ctx.lineTo(x1, y1);
|
|
17
|
-
ctx.stroke();
|
|
18
|
-
const p2 = d.points[2];
|
|
19
|
-
if (!p2) return;
|
|
20
|
-
// Offset from y1 so dragging from p1 starts with zero width
|
|
21
|
-
const off = t.priceToY(p2.price) - y1;
|
|
22
|
-
// Parallel line
|
|
23
|
-
ctx.beginPath();
|
|
24
|
-
ctx.moveTo(x0, y0 + off);
|
|
25
|
-
ctx.lineTo(x1, y1 + off);
|
|
26
|
-
ctx.stroke();
|
|
27
|
-
// Midline (dashed)
|
|
28
|
-
ctx.save();
|
|
29
|
-
ctx.globalAlpha = 0.5;
|
|
30
|
-
ctx.setLineDash([4, 4]);
|
|
31
|
-
ctx.beginPath();
|
|
32
|
-
ctx.moveTo(x0, y0 + off / 2);
|
|
33
|
-
ctx.lineTo(x1, y1 + off / 2);
|
|
34
|
-
ctx.stroke();
|
|
35
|
-
ctx.setLineDash([]);
|
|
36
|
-
// Fill
|
|
37
|
-
ctx.globalAlpha = 0.07;
|
|
38
|
-
ctx.fillStyle = d.color ?? '#2196f3';
|
|
39
|
-
ctx.beginPath();
|
|
40
|
-
ctx.moveTo(x0, y0);
|
|
41
|
-
ctx.lineTo(x1, y1);
|
|
42
|
-
ctx.lineTo(x1, y1 + off);
|
|
43
|
-
ctx.lineTo(x0, y0 + off);
|
|
44
|
-
ctx.closePath();
|
|
45
|
-
ctx.fill();
|
|
46
|
-
ctx.restore();
|
|
47
|
-
}
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import type { Drawing } from '@forgecharts/types';
|
|
2
|
-
import type { CoordTransform } from '../../../core/CoordTransform';
|
|
3
|
-
import { getPF3, drawPitchforkLines } from '../../drawingUtils';
|
|
4
|
-
import { renderTrendline } from './trendline';
|
|
5
|
-
|
|
6
|
-
export function renderPitchfork(
|
|
7
|
-
ctx: CanvasRenderingContext2D,
|
|
8
|
-
d: Drawing,
|
|
9
|
-
t: CoordTransform,
|
|
10
|
-
): void {
|
|
11
|
-
const pf = getPF3(d, t);
|
|
12
|
-
if (!pf) { renderTrendline(ctx, d, t); return; }
|
|
13
|
-
const { x0, y0, x1, y1, x2, y2 } = pf;
|
|
14
|
-
drawPitchforkLines(ctx, t, x0, y0, (x1 + x2) / 2, (y1 + y2) / 2, x1, y1, x2, y2);
|
|
15
|
-
}
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
import type { Drawing } from '@forgecharts/types';
|
|
2
|
-
import type { CoordTransform } from '../../../core/CoordTransform';
|
|
3
|
-
import { rayExit } from '../../drawingUtils';
|
|
4
|
-
|
|
5
|
-
export function renderRay(
|
|
6
|
-
ctx: CanvasRenderingContext2D,
|
|
7
|
-
d: Drawing,
|
|
8
|
-
t: CoordTransform,
|
|
9
|
-
): void {
|
|
10
|
-
const p0 = d.points[0];
|
|
11
|
-
const p1 = d.points[1];
|
|
12
|
-
if (!p0) return;
|
|
13
|
-
const x0 = t.timeToX(p0.time);
|
|
14
|
-
const y0 = t.priceToY(p0.price);
|
|
15
|
-
if (!p1) {
|
|
16
|
-
ctx.beginPath();
|
|
17
|
-
ctx.arc(x0, y0, 3, 0, Math.PI * 2);
|
|
18
|
-
ctx.fill();
|
|
19
|
-
return;
|
|
20
|
-
}
|
|
21
|
-
const dx = t.timeToX(p1.time) - x0;
|
|
22
|
-
const dy = t.priceToY(p1.price) - y0;
|
|
23
|
-
const exit = rayExit(t.plotWidth, t.plotHeight, x0, y0, dx, dy);
|
|
24
|
-
ctx.beginPath();
|
|
25
|
-
ctx.moveTo(x0, y0);
|
|
26
|
-
ctx.lineTo(exit.x, exit.y);
|
|
27
|
-
ctx.stroke();
|
|
28
|
-
}
|
|
@@ -1,157 +0,0 @@
|
|
|
1
|
-
import type { Drawing, OHLCV } from '@forgecharts/types';
|
|
2
|
-
import type { CoordTransform } from '../../../core/CoordTransform';
|
|
3
|
-
|
|
4
|
-
// ─── OLS linear regression ────────────────────────────────────────────────────
|
|
5
|
-
|
|
6
|
-
type RegressionParams = {
|
|
7
|
-
slope: number;
|
|
8
|
-
intercept: number;
|
|
9
|
-
stdDev: number;
|
|
10
|
-
};
|
|
11
|
-
|
|
12
|
-
/**
|
|
13
|
-
* Ordinary least-squares regression on the close prices of a candle slice.
|
|
14
|
-
*
|
|
15
|
-
* x = candle index (0 … N-1)
|
|
16
|
-
* y = close price
|
|
17
|
-
*
|
|
18
|
-
* m = (N·Σxy − Σx·Σy) / (N·Σx² − (Σx)²)
|
|
19
|
-
* b = (Σy − m·Σx) / N
|
|
20
|
-
*/
|
|
21
|
-
function calcOLS(closes: readonly number[]): RegressionParams | null {
|
|
22
|
-
const N = closes.length;
|
|
23
|
-
if (N < 2) return null;
|
|
24
|
-
|
|
25
|
-
let sumX = 0, sumY = 0, sumXY = 0, sumX2 = 0;
|
|
26
|
-
for (let i = 0; i < N; i++) {
|
|
27
|
-
const y = closes[i]!;
|
|
28
|
-
sumX += i;
|
|
29
|
-
sumY += y;
|
|
30
|
-
sumXY += i * y;
|
|
31
|
-
sumX2 += i * i;
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
const denom = N * sumX2 - sumX * sumX;
|
|
35
|
-
if (denom === 0) return null;
|
|
36
|
-
|
|
37
|
-
const slope = (N * sumXY - sumX * sumY) / denom;
|
|
38
|
-
const intercept = (sumY - slope * sumX) / N;
|
|
39
|
-
|
|
40
|
-
// Standard deviation of residuals
|
|
41
|
-
let sumRes2 = 0;
|
|
42
|
-
for (let i = 0; i < N; i++) {
|
|
43
|
-
const residual = closes[i]! - (slope * i + intercept);
|
|
44
|
-
sumRes2 += residual * residual;
|
|
45
|
-
}
|
|
46
|
-
const stdDev = Math.sqrt(sumRes2 / N);
|
|
47
|
-
|
|
48
|
-
return { slope, intercept, stdDev };
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
// ─── Candle slice helper ──────────────────────────────────────────────────────
|
|
52
|
-
|
|
53
|
-
/**
|
|
54
|
-
* Returns candles whose timestamps fall within [tStart, tEnd] (inclusive).
|
|
55
|
-
* Assumes the input array is sorted ascending by time (Series guarantees this).
|
|
56
|
-
*/
|
|
57
|
-
function sliceByTime(candles: readonly OHLCV[], tStart: number, tEnd: number): readonly OHLCV[] {
|
|
58
|
-
let lo = 0, hi = candles.length - 1, start = candles.length;
|
|
59
|
-
// Binary search for first index >= tStart
|
|
60
|
-
while (lo <= hi) {
|
|
61
|
-
const mid = (lo + hi) >>> 1;
|
|
62
|
-
if (candles[mid]!.time < tStart) lo = mid + 1;
|
|
63
|
-
else { start = mid; hi = mid - 1; }
|
|
64
|
-
}
|
|
65
|
-
// Walk forward to find last index <= tEnd
|
|
66
|
-
let end = start - 1;
|
|
67
|
-
for (let i = start; i < candles.length && candles[i]!.time <= tEnd; i++) end = i;
|
|
68
|
-
if (end < start) return [];
|
|
69
|
-
return candles.slice(start, end + 1);
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
// ─── Renderer ─────────────────────────────────────────────────────────────────
|
|
73
|
-
|
|
74
|
-
export function renderRegressionTrend(
|
|
75
|
-
ctx: CanvasRenderingContext2D,
|
|
76
|
-
d: Drawing,
|
|
77
|
-
t: CoordTransform,
|
|
78
|
-
candles: readonly OHLCV[],
|
|
79
|
-
): void {
|
|
80
|
-
const p0 = d.points[0];
|
|
81
|
-
const p1 = d.points[1];
|
|
82
|
-
if (!p0 || !p1) return;
|
|
83
|
-
|
|
84
|
-
const tStart = Math.min(p0.time, p1.time);
|
|
85
|
-
const tEnd = Math.max(p0.time, p1.time);
|
|
86
|
-
|
|
87
|
-
const slice = sliceByTime(candles, tStart, tEnd);
|
|
88
|
-
const N = slice.length;
|
|
89
|
-
if (N < 2) return;
|
|
90
|
-
|
|
91
|
-
const closes = slice.map(c => c.close);
|
|
92
|
-
const reg = calcOLS(closes);
|
|
93
|
-
if (!reg) return;
|
|
94
|
-
|
|
95
|
-
const { slope, intercept, stdDev } = reg;
|
|
96
|
-
|
|
97
|
-
// Regression price at the first and last candle of the slice
|
|
98
|
-
const regPriceStart = intercept; // index 0
|
|
99
|
-
const regPriceEnd = slope * (N - 1) + intercept; // index N-1
|
|
100
|
-
|
|
101
|
-
// Pixel x from actual candle timestamps; y from regression-derived prices
|
|
102
|
-
const x0 = t.timeToX(slice[0]!.time);
|
|
103
|
-
const x1 = t.timeToX(slice[N - 1]!.time);
|
|
104
|
-
const y0 = t.priceToY(regPriceStart);
|
|
105
|
-
const y1 = t.priceToY(regPriceEnd);
|
|
106
|
-
|
|
107
|
-
const color = d.color ?? '#2196f3';
|
|
108
|
-
|
|
109
|
-
// ── Regression line ───────────────────────────────────────────────────────
|
|
110
|
-
ctx.beginPath();
|
|
111
|
-
ctx.moveTo(x0, y0);
|
|
112
|
-
ctx.lineTo(x1, y1);
|
|
113
|
-
ctx.stroke();
|
|
114
|
-
|
|
115
|
-
// ── Deviation bands ───────────────────────────────────────────────────────
|
|
116
|
-
if (stdDev === 0) return; // flat data — no meaningful channel
|
|
117
|
-
|
|
118
|
-
const mult = d.deviationMultiplier ?? 2;
|
|
119
|
-
const bandOffset = stdDev * mult; // price units
|
|
120
|
-
|
|
121
|
-
const yUp0 = t.priceToY(regPriceStart + bandOffset);
|
|
122
|
-
const yUp1 = t.priceToY(regPriceEnd + bandOffset);
|
|
123
|
-
const yDn0 = t.priceToY(regPriceStart - bandOffset);
|
|
124
|
-
const yDn1 = t.priceToY(regPriceEnd - bandOffset);
|
|
125
|
-
|
|
126
|
-
ctx.save();
|
|
127
|
-
ctx.setLineDash([4, 3]);
|
|
128
|
-
ctx.globalAlpha = 0.65;
|
|
129
|
-
|
|
130
|
-
// Upper band
|
|
131
|
-
ctx.beginPath();
|
|
132
|
-
ctx.moveTo(x0, yUp0);
|
|
133
|
-
ctx.lineTo(x1, yUp1);
|
|
134
|
-
ctx.stroke();
|
|
135
|
-
|
|
136
|
-
// Lower band
|
|
137
|
-
ctx.beginPath();
|
|
138
|
-
ctx.moveTo(x0, yDn0);
|
|
139
|
-
ctx.lineTo(x1, yDn1);
|
|
140
|
-
ctx.stroke();
|
|
141
|
-
|
|
142
|
-
ctx.setLineDash([]);
|
|
143
|
-
|
|
144
|
-
// Fill between bands
|
|
145
|
-
ctx.globalAlpha = 0.07;
|
|
146
|
-
ctx.fillStyle = color;
|
|
147
|
-
ctx.beginPath();
|
|
148
|
-
ctx.moveTo(x0, yUp0);
|
|
149
|
-
ctx.lineTo(x1, yUp1);
|
|
150
|
-
ctx.lineTo(x1, yDn1);
|
|
151
|
-
ctx.lineTo(x0, yDn0);
|
|
152
|
-
ctx.closePath();
|
|
153
|
-
ctx.fill();
|
|
154
|
-
|
|
155
|
-
ctx.restore();
|
|
156
|
-
}
|
|
157
|
-
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import type { Drawing } from '@forgecharts/types';
|
|
2
|
-
import type { CoordTransform } from '../../../core/CoordTransform';
|
|
3
|
-
import { getPF3, drawPitchforkLines } from '../../drawingUtils';
|
|
4
|
-
import { renderTrendline } from './trendline';
|
|
5
|
-
|
|
6
|
-
export function renderSchiffPitchfork(
|
|
7
|
-
ctx: CanvasRenderingContext2D,
|
|
8
|
-
d: Drawing,
|
|
9
|
-
t: CoordTransform,
|
|
10
|
-
): void {
|
|
11
|
-
const pf = getPF3(d, t);
|
|
12
|
-
if (!pf) { renderTrendline(ctx, d, t); return; }
|
|
13
|
-
const { x0, y0, x1, y1, x2, y2 } = pf;
|
|
14
|
-
const midX = (x1 + x2) / 2, midY = (y1 + y2) / 2;
|
|
15
|
-
const pivX = (x0 + midX) / 2;
|
|
16
|
-
const pivY = (y0 + midY) / 2;
|
|
17
|
-
drawPitchforkLines(ctx, t, pivX, pivY, midX, midY, x1, y1, x2, y2);
|
|
18
|
-
}
|