From 78e037982a2cbb67614aaa2de31fa3e8cd19362e Mon Sep 17 00:00:00 2001 From: Claude Date: Fri, 31 Oct 2025 14:25:59 +0000 Subject: [PATCH 1/3] docs: Add technical indicators implementation status report Created comprehensive diff between implemented functions in src/ta/index.ts and documented functions in docs/reference/functions/ta.*.md. Report includes: - 11 implemented functions (18.6% complete) - 48 missing functions categorized by type - Prioritized recommendations for next implementations --- TA_IMPLEMENTATION_STATUS.md | 139 ++++++++++++++++++++++++++++++++++++ 1 file changed, 139 insertions(+) create mode 100644 TA_IMPLEMENTATION_STATUS.md diff --git a/TA_IMPLEMENTATION_STATUS.md b/TA_IMPLEMENTATION_STATUS.md new file mode 100644 index 0000000..168e045 --- /dev/null +++ b/TA_IMPLEMENTATION_STATUS.md @@ -0,0 +1,139 @@ +# Technical Indicators Implementation Status + +This document compares the implemented functions in `src/ta/index.ts` with the PineScript reference documentation in `docs/reference/functions/ta.*.md`. + +## Summary + +- **Total Documented Functions**: 59 +- **Implemented Functions**: 11 +- **Missing Functions**: 48 +- **Not Documented**: 0 + +--- + +## ✅ Implemented (11 functions) + +These functions are implemented in `src/ta/index.ts` and documented: + +1. ✅ `ta.atr` - Average True Range +2. ✅ `ta.bb` - Bollinger Bands +3. ✅ `ta.change` - Difference between current and previous value +4. ✅ `ta.crossover` - True when series1 crosses over series2 +5. ✅ `ta.crossunder` - True when series1 crosses under series2 +6. ✅ `ta.ema` - Exponential Moving Average +7. ✅ `ta.macd` - Moving Average Convergence Divergence +8. ✅ `ta.rsi` - Relative Strength Index +9. ✅ `ta.sma` - Simple Moving Average +10. ✅ `ta.stdev` - Standard Deviation +11. ✅ `ta.tr` - True Range + +--- + +## ❌ Missing Implementation (48 functions) + +These functions are documented but NOT yet implemented: + +### Moving Averages & Smoothing (6) +1. ❌ `ta.alma` - Arnaud Legoux Moving Average +2. ❌ `ta.hma` - Hull Moving Average +3. ❌ `ta.rma` - Rolling Moving Average +4. ❌ `ta.swma` - Symmetrically Weighted Moving Average +5. ❌ `ta.vwma` - Volume Weighted Moving Average +6. ❌ `ta.wma` - Weighted Moving Average + +### Oscillators & Momentum (10) +7. ❌ `ta.cci` - Commodity Channel Index +8. ❌ `ta.cmo` - Chande Momentum Oscillator +9. ❌ `ta.mfi` - Money Flow Index +10. ❌ `ta.mom` - Momentum +11. ❌ `ta.roc` - Rate of Change +12. ❌ `ta.stoch` - Stochastic +13. ❌ `ta.tsi` - True Strength Index +14. ❌ `ta.wpr` - Williams %R +15. ❌ `ta.rci` - Rank Correlation Index +16. ❌ `ta.dmi` - Directional Movement Index + +### Bands & Channels (2) +17. ❌ `ta.bbw` - Bollinger Bands Width +18. ❌ `ta.kc` - Keltner Channels +19. ❌ `ta.kcw` - Keltner Channels Width + +### Trend & Direction (3) +20. ❌ `ta.sar` - Parabolic SAR +21. ❌ `ta.supertrend` - SuperTrend +22. ❌ `ta.cog` - Center of Gravity + +### Statistical Functions (10) +23. ❌ `ta.correlation` - Correlation coefficient +24. ❌ `ta.dev` - Deviation +25. ❌ `ta.linreg` - Linear Regression +26. ❌ `ta.median` - Median +27. ❌ `ta.mode` - Mode +28. ❌ `ta.percentile_linear_interpolation` - Percentile (linear interpolation) +29. ❌ `ta.percentile_nearest_rank` - Percentile (nearest rank) +30. ❌ `ta.percentrank` - Percent Rank +31. ❌ `ta.variance` - Variance +32. ❌ `ta.vwap` - Volume Weighted Average Price + +### Price Analysis (6) +33. ❌ `ta.highest` - Highest value +34. ❌ `ta.highestbars` - Highest value bars ago +35. ❌ `ta.lowest` - Lowest value +36. ❌ `ta.lowestbars` - Lowest value bars ago +37. ❌ `ta.max` - Maximum +38. ❌ `ta.min` - Minimum +39. ❌ `ta.range` - Range (highest - lowest) + +### Pivot Points (3) +40. ❌ `ta.pivot_point_levels` - Pivot point levels +41. ❌ `ta.pivothigh` - Pivot high +42. ❌ `ta.pivotlow` - Pivot low + +### Conditional & Utility (8) +43. ❌ `ta.barssince` - Bars since condition +44. ❌ `ta.cross` - Cross (either direction) +45. ❌ `ta.cum` - Cumulative sum +46. ❌ `ta.falling` - Is falling +47. ❌ `ta.rising` - Is rising +48. ❌ `ta.valuewhen` - Value when condition was true + +--- + +## ⚠️ Implemented but Not Documented (0 functions) + +All implemented functions have corresponding documentation. + +--- + +## Implementation Progress: 18.6% + +``` +Progress: [██░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░] 11/59 +``` + +--- + +## Recommendations + +### Priority 1: Core Moving Averages +- `ta.wma` - Weighted Moving Average +- `ta.vwma` - Volume Weighted Moving Average +- `ta.rma` - Rolling Moving Average (used internally by many indicators) + +### Priority 2: Common Oscillators +- `ta.stoch` - Stochastic (very popular) +- `ta.cci` - Commodity Channel Index +- `ta.mfi` - Money Flow Index +- `ta.wpr` - Williams %R + +### Priority 3: Statistical & Utility Functions +- `ta.highest` / `ta.lowest` - Essential for many indicators +- `ta.correlation` - Used by several advanced indicators +- `ta.cum` - Cumulative sum (building block) +- `ta.cross` - General cross detection + +### Priority 4: Advanced Indicators +- `ta.supertrend` - Very popular modern indicator +- `ta.sar` - Parabolic SAR +- `ta.vwap` - Volume Weighted Average Price +- `ta.dmi` - Directional Movement Index From 51b0903e47ad96ca910f8691df975a1107be303f Mon Sep 17 00:00:00 2001 From: Claude Date: Fri, 31 Oct 2025 14:31:51 +0000 Subject: [PATCH 2/3] docs: Add PineLib source code comparison analysis Analyzed ta-v10.pine to identify which missing functions have PineScript implementations available. Key findings: - Only 1 documented missing function found in PineLib (ta.supertrend) - 47 documented functions NOT in PineLib (need implementation from scratch) - 45 PineLib-only functions not in documentation (advanced indicators) Includes prioritized recommendations for implementation. --- TA_PINELIB_COMPARISON.md | 197 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 197 insertions(+) create mode 100644 TA_PINELIB_COMPARISON.md diff --git a/TA_PINELIB_COMPARISON.md b/TA_PINELIB_COMPARISON.md new file mode 100644 index 0000000..5eae98e --- /dev/null +++ b/TA_PINELIB_COMPARISON.md @@ -0,0 +1,197 @@ +# Technical Indicators: PineLib Source Code Analysis + +This document analyzes the `docs/pinelib/ta-v10.pine` source code to identify which missing functions have PineScript implementations available. + +## Summary + +- **Missing functions with PineLib implementations**: 1 +- **Missing functions WITHOUT PineLib implementations**: 47 +- **PineLib-only functions (not in docs)**: 45 + +--- + +## ✅ Missing Functions Found in PineLib (1) + +These missing functions are documented AND have implementations in the PineLib source: + +1. ✅ **`ta.supertrend`** - SuperTrend Indicator + - PineLib exports: `supertrend()` and `supertrend2()` (alternate version with series float length) + - Implementation: Lines 568-622 in ta-v10.pine + +--- + +## ❌ Missing Functions NOT in PineLib (47) + +These documented functions are NOT implemented in the PineLib source code: + +### Moving Averages & Smoothing (6) +1. ❌ `ta.alma` - Arnaud Legoux Moving Average +2. ❌ `ta.hma` - Hull Moving Average +3. ❌ `ta.rma` - Rolling Moving Average (note: `rma2()` exists in PineLib as alternate) +4. ❌ `ta.swma` - Symmetrically Weighted Moving Average +5. ❌ `ta.vwma` - Volume Weighted Moving Average +6. ❌ `ta.wma` - Weighted Moving Average + +### Oscillators & Momentum (10) +7. ❌ `ta.cci` - Commodity Channel Index +8. ❌ `ta.cmo` - Chande Momentum Oscillator +9. ❌ `ta.mfi` - Money Flow Index +10. ❌ `ta.mom` - Momentum +11. ❌ `ta.roc` - Rate of Change +12. ❌ `ta.stoch` - Stochastic +13. ❌ `ta.tsi` - True Strength Index +14. ❌ `ta.wpr` - Williams %R +15. ❌ `ta.rci` - Rank Correlation Index +16. ❌ `ta.dmi` - Directional Movement Index + +### Bands & Channels (3) +17. ❌ `ta.bbw` - Bollinger Bands Width +18. ❌ `ta.kc` - Keltner Channels +19. ❌ `ta.kcw` - Keltner Channels Width + +### Trend & Direction (2) +20. ❌ `ta.sar` - Parabolic SAR +21. ❌ `ta.cog` - Center of Gravity + +### Statistical Functions (10) +22. ❌ `ta.correlation` - Correlation coefficient +23. ❌ `ta.dev` - Deviation +24. ❌ `ta.linreg` - Linear Regression +25. ❌ `ta.median` - Median +26. ❌ `ta.mode` - Mode +27. ❌ `ta.percentile_linear_interpolation` - Percentile (linear interpolation) +28. ❌ `ta.percentile_nearest_rank` - Percentile (nearest rank) +29. ❌ `ta.percentrank` - Percent Rank +30. ❌ `ta.variance` - Variance +31. ❌ `ta.vwap` - Volume Weighted Average Price + +### Price Analysis (7) +32. ❌ `ta.highest` - Highest value +33. ❌ `ta.highestbars` - Highest value bars ago +34. ❌ `ta.lowest` - Lowest value +35. ❌ `ta.lowestbars` - Lowest value bars ago +36. ❌ `ta.max` - Maximum +37. ❌ `ta.min` - Minimum +38. ❌ `ta.range` - Range (highest - lowest) + +### Pivot Points (3) +39. ❌ `ta.pivot_point_levels` - Pivot point levels +40. ❌ `ta.pivothigh` - Pivot high +41. ❌ `ta.pivotlow` - Pivot low + +### Conditional & Utility (6) +42. ❌ `ta.barssince` - Bars since condition +43. ❌ `ta.cross` - Cross (either direction) +44. ❌ `ta.cum` - Cumulative sum +45. ❌ `ta.falling` - Is falling +46. ❌ `ta.rising` - Is rising +47. ❌ `ta.valuewhen` - Value when condition was true + +--- + +## 🆕 PineLib-Only Functions (45) + +These functions are implemented in PineLib but NOT documented in `docs/reference/functions/ta.*.md`: + +### Moving Averages & Advanced Smoothing (10) +1. `ao()` - Awesome Oscillator (SMA-based) +2. `dema()` / `dema2()` - Double Exponential Moving Average +3. `ema2()` - Exponential Moving Average (alternate, allows series float length) +4. `frama()` - Fractal Adaptive Moving Average +5. `rma2()` - Rolling Moving Average (alternate, allows series float length) +6. `t3()` / `t3Alt()` - Tilson Moving Average (T3) +7. `tema()` / `tema2()` - Triple Exponential Moving Average +8. `trima()` - Triangular Moving Average + +### Oscillators & Momentum (11) +9. `aroon()` - Aroon Oscillator +10. `coppock()` - Coppock Curve +11. `dm()` - Demarker Indicator +12. `eom()` - Ease of Movement +13. `ft()` - Fisher Transform +14. `ift()` - Inverse Fisher Transform +15. `kvo()` - Klinger Volume Oscillator +16. `pzo()` - Price Zone Oscillator +17. `stc()` - Schaff Trend Cycle +18. `stochFull()` - Full Stochastic Oscillator +19. `stochRsi()` - Stochastic RSI +20. `szo()` - Sentiment Zone Oscillator +21. `trix()` - TRIX indicator +22. `uo()` - Ultimate Oscillator +23. `vhf()` - Vertical Horizontal Filter +24. `vi()` - Vortex Indicator +25. `vzo()` - Volume Zone Oscillator +26. `wpo()` - Wave Period Oscillator + +### Channels & Bands (1) +27. `donchian()` - Donchian Channel + +### Trend & Direction (4) +28. `ht()` - Hilbert Transform +29. `supertrend2()` - SuperTrend (alternate version) +30. `vStop()` / `vStop2()` - Volatility Stop + +### Pattern Detection (1) +31. `williamsFractal()` - Williams' Fractal + +### Statistical & Utility (3) +32. `atr2()` - Average True Range (alternate, allows series float length) +33. `cagr()` - Compound Annual Growth Rate +34. `changePercent()` - Calculate percentage change +35. `highestSince()` - Highest value since condition +36. `lowestSince()` - Lowest value since condition +37. `rms()` - Root Mean Square +38. `rwi()` - Random Walk Index + +### Volume Analysis (3) +39. `relativeVolume()` - Compare volume to its historical average +40. `requestUpAndDownVolume()` - Requests up/down volume data +41. `requestVolumeDelta()` - Requests volume delta + +### Advanced Indicators (1) +42. `ichimoku()` - Ichimoku Cloud + +--- + +## 📊 Implementation Priority Recommendations + +### Tier 1: Implement Immediately (Has PineLib Source) +1. **`ta.supertrend`** - Very popular indicator with complete source code available + +### Tier 2: Core Building Blocks (No PineLib, but essential) +These are fundamental functions used by many other indicators: +1. `ta.wma` - Weighted Moving Average (used by many indicators) +2. `ta.rma` - Rolling Moving Average (can use `rma2()` from PineLib as reference) +3. `ta.highest` / `ta.lowest` - Price analysis (used in many indicators) +4. `ta.highestbars` / `ta.lowestbars` - Bar counting (used in Aroon, etc.) +5. `ta.cum` - Cumulative sum (building block) + +### Tier 3: Popular Standard Indicators (No PineLib) +1. `ta.stoch` - Stochastic (very popular, can reference `stochFull()` from PineLib) +2. `ta.cci` - Commodity Channel Index +3. `ta.mfi` - Money Flow Index +4. `ta.wpr` - Williams %R +5. `ta.vwap` - Volume Weighted Average Price + +### Tier 4: Statistical Functions (No PineLib) +1. `ta.correlation` - Correlation coefficient +2. `ta.variance` - Variance +3. `ta.median` - Median +4. `ta.dev` - Deviation +5. `ta.linreg` - Linear Regression + +### Tier 5: Consider Adding PineLib-Only Functions to Docs +Many advanced indicators in PineLib are not documented. Consider: +1. Adding documentation for useful PineLib functions like `dema`, `tema`, `ichimoku`, etc. +2. Implementing these in OakScriptJS +3. This would significantly expand the library's capabilities + +--- + +## Notes + +- The PineLib library contains many advanced indicators not in the standard documentation +- Only 1 documented missing function has a direct PineLib implementation (`supertrend`) +- Most documented functions will need to be implemented from scratch or from PineScript built-ins +- The PineLib source can serve as a reference for implementation patterns and algorithms +- Several PineLib functions have "alternate" versions (e.g., `ema2`, `atr2`, `rma2`) that accept series float lengths instead of simple int From cb709656eda5fe9c20627620f3f6b848fe4d2da1 Mon Sep 17 00:00:00 2001 From: Claude Date: Fri, 31 Oct 2025 14:39:54 +0000 Subject: [PATCH 3/3] docs: Consolidate TA analysis into comprehensive TODO list Replaced TA_IMPLEMENTATION_STATUS.md and TA_PINELIB_COMPARISON.md with a single TA_TODO.md file that lists all 104 functions to implement. Changes: - Created comprehensive TODO list with checkboxes - Organized by priority (1-5) based on dependencies and usage - Separated documented functions (48) from PineLib-only (45) - Added implementation notes and recommended order - Removed redundant analysis files Total: 11 implemented, 93 remaining (48 documented + 45 bonus) --- TA_IMPLEMENTATION_STATUS.md | 139 ------------------------ TA_PINELIB_COMPARISON.md | 197 ---------------------------------- TA_TODO.md | 206 ++++++++++++++++++++++++++++++++++++ 3 files changed, 206 insertions(+), 336 deletions(-) delete mode 100644 TA_IMPLEMENTATION_STATUS.md delete mode 100644 TA_PINELIB_COMPARISON.md create mode 100644 TA_TODO.md diff --git a/TA_IMPLEMENTATION_STATUS.md b/TA_IMPLEMENTATION_STATUS.md deleted file mode 100644 index 168e045..0000000 --- a/TA_IMPLEMENTATION_STATUS.md +++ /dev/null @@ -1,139 +0,0 @@ -# Technical Indicators Implementation Status - -This document compares the implemented functions in `src/ta/index.ts` with the PineScript reference documentation in `docs/reference/functions/ta.*.md`. - -## Summary - -- **Total Documented Functions**: 59 -- **Implemented Functions**: 11 -- **Missing Functions**: 48 -- **Not Documented**: 0 - ---- - -## ✅ Implemented (11 functions) - -These functions are implemented in `src/ta/index.ts` and documented: - -1. ✅ `ta.atr` - Average True Range -2. ✅ `ta.bb` - Bollinger Bands -3. ✅ `ta.change` - Difference between current and previous value -4. ✅ `ta.crossover` - True when series1 crosses over series2 -5. ✅ `ta.crossunder` - True when series1 crosses under series2 -6. ✅ `ta.ema` - Exponential Moving Average -7. ✅ `ta.macd` - Moving Average Convergence Divergence -8. ✅ `ta.rsi` - Relative Strength Index -9. ✅ `ta.sma` - Simple Moving Average -10. ✅ `ta.stdev` - Standard Deviation -11. ✅ `ta.tr` - True Range - ---- - -## ❌ Missing Implementation (48 functions) - -These functions are documented but NOT yet implemented: - -### Moving Averages & Smoothing (6) -1. ❌ `ta.alma` - Arnaud Legoux Moving Average -2. ❌ `ta.hma` - Hull Moving Average -3. ❌ `ta.rma` - Rolling Moving Average -4. ❌ `ta.swma` - Symmetrically Weighted Moving Average -5. ❌ `ta.vwma` - Volume Weighted Moving Average -6. ❌ `ta.wma` - Weighted Moving Average - -### Oscillators & Momentum (10) -7. ❌ `ta.cci` - Commodity Channel Index -8. ❌ `ta.cmo` - Chande Momentum Oscillator -9. ❌ `ta.mfi` - Money Flow Index -10. ❌ `ta.mom` - Momentum -11. ❌ `ta.roc` - Rate of Change -12. ❌ `ta.stoch` - Stochastic -13. ❌ `ta.tsi` - True Strength Index -14. ❌ `ta.wpr` - Williams %R -15. ❌ `ta.rci` - Rank Correlation Index -16. ❌ `ta.dmi` - Directional Movement Index - -### Bands & Channels (2) -17. ❌ `ta.bbw` - Bollinger Bands Width -18. ❌ `ta.kc` - Keltner Channels -19. ❌ `ta.kcw` - Keltner Channels Width - -### Trend & Direction (3) -20. ❌ `ta.sar` - Parabolic SAR -21. ❌ `ta.supertrend` - SuperTrend -22. ❌ `ta.cog` - Center of Gravity - -### Statistical Functions (10) -23. ❌ `ta.correlation` - Correlation coefficient -24. ❌ `ta.dev` - Deviation -25. ❌ `ta.linreg` - Linear Regression -26. ❌ `ta.median` - Median -27. ❌ `ta.mode` - Mode -28. ❌ `ta.percentile_linear_interpolation` - Percentile (linear interpolation) -29. ❌ `ta.percentile_nearest_rank` - Percentile (nearest rank) -30. ❌ `ta.percentrank` - Percent Rank -31. ❌ `ta.variance` - Variance -32. ❌ `ta.vwap` - Volume Weighted Average Price - -### Price Analysis (6) -33. ❌ `ta.highest` - Highest value -34. ❌ `ta.highestbars` - Highest value bars ago -35. ❌ `ta.lowest` - Lowest value -36. ❌ `ta.lowestbars` - Lowest value bars ago -37. ❌ `ta.max` - Maximum -38. ❌ `ta.min` - Minimum -39. ❌ `ta.range` - Range (highest - lowest) - -### Pivot Points (3) -40. ❌ `ta.pivot_point_levels` - Pivot point levels -41. ❌ `ta.pivothigh` - Pivot high -42. ❌ `ta.pivotlow` - Pivot low - -### Conditional & Utility (8) -43. ❌ `ta.barssince` - Bars since condition -44. ❌ `ta.cross` - Cross (either direction) -45. ❌ `ta.cum` - Cumulative sum -46. ❌ `ta.falling` - Is falling -47. ❌ `ta.rising` - Is rising -48. ❌ `ta.valuewhen` - Value when condition was true - ---- - -## ⚠️ Implemented but Not Documented (0 functions) - -All implemented functions have corresponding documentation. - ---- - -## Implementation Progress: 18.6% - -``` -Progress: [██░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░] 11/59 -``` - ---- - -## Recommendations - -### Priority 1: Core Moving Averages -- `ta.wma` - Weighted Moving Average -- `ta.vwma` - Volume Weighted Moving Average -- `ta.rma` - Rolling Moving Average (used internally by many indicators) - -### Priority 2: Common Oscillators -- `ta.stoch` - Stochastic (very popular) -- `ta.cci` - Commodity Channel Index -- `ta.mfi` - Money Flow Index -- `ta.wpr` - Williams %R - -### Priority 3: Statistical & Utility Functions -- `ta.highest` / `ta.lowest` - Essential for many indicators -- `ta.correlation` - Used by several advanced indicators -- `ta.cum` - Cumulative sum (building block) -- `ta.cross` - General cross detection - -### Priority 4: Advanced Indicators -- `ta.supertrend` - Very popular modern indicator -- `ta.sar` - Parabolic SAR -- `ta.vwap` - Volume Weighted Average Price -- `ta.dmi` - Directional Movement Index diff --git a/TA_PINELIB_COMPARISON.md b/TA_PINELIB_COMPARISON.md deleted file mode 100644 index 5eae98e..0000000 --- a/TA_PINELIB_COMPARISON.md +++ /dev/null @@ -1,197 +0,0 @@ -# Technical Indicators: PineLib Source Code Analysis - -This document analyzes the `docs/pinelib/ta-v10.pine` source code to identify which missing functions have PineScript implementations available. - -## Summary - -- **Missing functions with PineLib implementations**: 1 -- **Missing functions WITHOUT PineLib implementations**: 47 -- **PineLib-only functions (not in docs)**: 45 - ---- - -## ✅ Missing Functions Found in PineLib (1) - -These missing functions are documented AND have implementations in the PineLib source: - -1. ✅ **`ta.supertrend`** - SuperTrend Indicator - - PineLib exports: `supertrend()` and `supertrend2()` (alternate version with series float length) - - Implementation: Lines 568-622 in ta-v10.pine - ---- - -## ❌ Missing Functions NOT in PineLib (47) - -These documented functions are NOT implemented in the PineLib source code: - -### Moving Averages & Smoothing (6) -1. ❌ `ta.alma` - Arnaud Legoux Moving Average -2. ❌ `ta.hma` - Hull Moving Average -3. ❌ `ta.rma` - Rolling Moving Average (note: `rma2()` exists in PineLib as alternate) -4. ❌ `ta.swma` - Symmetrically Weighted Moving Average -5. ❌ `ta.vwma` - Volume Weighted Moving Average -6. ❌ `ta.wma` - Weighted Moving Average - -### Oscillators & Momentum (10) -7. ❌ `ta.cci` - Commodity Channel Index -8. ❌ `ta.cmo` - Chande Momentum Oscillator -9. ❌ `ta.mfi` - Money Flow Index -10. ❌ `ta.mom` - Momentum -11. ❌ `ta.roc` - Rate of Change -12. ❌ `ta.stoch` - Stochastic -13. ❌ `ta.tsi` - True Strength Index -14. ❌ `ta.wpr` - Williams %R -15. ❌ `ta.rci` - Rank Correlation Index -16. ❌ `ta.dmi` - Directional Movement Index - -### Bands & Channels (3) -17. ❌ `ta.bbw` - Bollinger Bands Width -18. ❌ `ta.kc` - Keltner Channels -19. ❌ `ta.kcw` - Keltner Channels Width - -### Trend & Direction (2) -20. ❌ `ta.sar` - Parabolic SAR -21. ❌ `ta.cog` - Center of Gravity - -### Statistical Functions (10) -22. ❌ `ta.correlation` - Correlation coefficient -23. ❌ `ta.dev` - Deviation -24. ❌ `ta.linreg` - Linear Regression -25. ❌ `ta.median` - Median -26. ❌ `ta.mode` - Mode -27. ❌ `ta.percentile_linear_interpolation` - Percentile (linear interpolation) -28. ❌ `ta.percentile_nearest_rank` - Percentile (nearest rank) -29. ❌ `ta.percentrank` - Percent Rank -30. ❌ `ta.variance` - Variance -31. ❌ `ta.vwap` - Volume Weighted Average Price - -### Price Analysis (7) -32. ❌ `ta.highest` - Highest value -33. ❌ `ta.highestbars` - Highest value bars ago -34. ❌ `ta.lowest` - Lowest value -35. ❌ `ta.lowestbars` - Lowest value bars ago -36. ❌ `ta.max` - Maximum -37. ❌ `ta.min` - Minimum -38. ❌ `ta.range` - Range (highest - lowest) - -### Pivot Points (3) -39. ❌ `ta.pivot_point_levels` - Pivot point levels -40. ❌ `ta.pivothigh` - Pivot high -41. ❌ `ta.pivotlow` - Pivot low - -### Conditional & Utility (6) -42. ❌ `ta.barssince` - Bars since condition -43. ❌ `ta.cross` - Cross (either direction) -44. ❌ `ta.cum` - Cumulative sum -45. ❌ `ta.falling` - Is falling -46. ❌ `ta.rising` - Is rising -47. ❌ `ta.valuewhen` - Value when condition was true - ---- - -## 🆕 PineLib-Only Functions (45) - -These functions are implemented in PineLib but NOT documented in `docs/reference/functions/ta.*.md`: - -### Moving Averages & Advanced Smoothing (10) -1. `ao()` - Awesome Oscillator (SMA-based) -2. `dema()` / `dema2()` - Double Exponential Moving Average -3. `ema2()` - Exponential Moving Average (alternate, allows series float length) -4. `frama()` - Fractal Adaptive Moving Average -5. `rma2()` - Rolling Moving Average (alternate, allows series float length) -6. `t3()` / `t3Alt()` - Tilson Moving Average (T3) -7. `tema()` / `tema2()` - Triple Exponential Moving Average -8. `trima()` - Triangular Moving Average - -### Oscillators & Momentum (11) -9. `aroon()` - Aroon Oscillator -10. `coppock()` - Coppock Curve -11. `dm()` - Demarker Indicator -12. `eom()` - Ease of Movement -13. `ft()` - Fisher Transform -14. `ift()` - Inverse Fisher Transform -15. `kvo()` - Klinger Volume Oscillator -16. `pzo()` - Price Zone Oscillator -17. `stc()` - Schaff Trend Cycle -18. `stochFull()` - Full Stochastic Oscillator -19. `stochRsi()` - Stochastic RSI -20. `szo()` - Sentiment Zone Oscillator -21. `trix()` - TRIX indicator -22. `uo()` - Ultimate Oscillator -23. `vhf()` - Vertical Horizontal Filter -24. `vi()` - Vortex Indicator -25. `vzo()` - Volume Zone Oscillator -26. `wpo()` - Wave Period Oscillator - -### Channels & Bands (1) -27. `donchian()` - Donchian Channel - -### Trend & Direction (4) -28. `ht()` - Hilbert Transform -29. `supertrend2()` - SuperTrend (alternate version) -30. `vStop()` / `vStop2()` - Volatility Stop - -### Pattern Detection (1) -31. `williamsFractal()` - Williams' Fractal - -### Statistical & Utility (3) -32. `atr2()` - Average True Range (alternate, allows series float length) -33. `cagr()` - Compound Annual Growth Rate -34. `changePercent()` - Calculate percentage change -35. `highestSince()` - Highest value since condition -36. `lowestSince()` - Lowest value since condition -37. `rms()` - Root Mean Square -38. `rwi()` - Random Walk Index - -### Volume Analysis (3) -39. `relativeVolume()` - Compare volume to its historical average -40. `requestUpAndDownVolume()` - Requests up/down volume data -41. `requestVolumeDelta()` - Requests volume delta - -### Advanced Indicators (1) -42. `ichimoku()` - Ichimoku Cloud - ---- - -## 📊 Implementation Priority Recommendations - -### Tier 1: Implement Immediately (Has PineLib Source) -1. **`ta.supertrend`** - Very popular indicator with complete source code available - -### Tier 2: Core Building Blocks (No PineLib, but essential) -These are fundamental functions used by many other indicators: -1. `ta.wma` - Weighted Moving Average (used by many indicators) -2. `ta.rma` - Rolling Moving Average (can use `rma2()` from PineLib as reference) -3. `ta.highest` / `ta.lowest` - Price analysis (used in many indicators) -4. `ta.highestbars` / `ta.lowestbars` - Bar counting (used in Aroon, etc.) -5. `ta.cum` - Cumulative sum (building block) - -### Tier 3: Popular Standard Indicators (No PineLib) -1. `ta.stoch` - Stochastic (very popular, can reference `stochFull()` from PineLib) -2. `ta.cci` - Commodity Channel Index -3. `ta.mfi` - Money Flow Index -4. `ta.wpr` - Williams %R -5. `ta.vwap` - Volume Weighted Average Price - -### Tier 4: Statistical Functions (No PineLib) -1. `ta.correlation` - Correlation coefficient -2. `ta.variance` - Variance -3. `ta.median` - Median -4. `ta.dev` - Deviation -5. `ta.linreg` - Linear Regression - -### Tier 5: Consider Adding PineLib-Only Functions to Docs -Many advanced indicators in PineLib are not documented. Consider: -1. Adding documentation for useful PineLib functions like `dema`, `tema`, `ichimoku`, etc. -2. Implementing these in OakScriptJS -3. This would significantly expand the library's capabilities - ---- - -## Notes - -- The PineLib library contains many advanced indicators not in the standard documentation -- Only 1 documented missing function has a direct PineLib implementation (`supertrend`) -- Most documented functions will need to be implemented from scratch or from PineScript built-ins -- The PineLib source can serve as a reference for implementation patterns and algorithms -- Several PineLib functions have "alternate" versions (e.g., `ema2`, `atr2`, `rma2`) that accept series float lengths instead of simple int diff --git a/TA_TODO.md b/TA_TODO.md new file mode 100644 index 0000000..1483389 --- /dev/null +++ b/TA_TODO.md @@ -0,0 +1,206 @@ +# Technical Indicators - Implementation TODO List + +This document lists all TA functions that need to be implemented for OakScriptJS to match PineScript functionality. + +**Current Progress**: 11/59 documented functions implemented (18.6%) + +--- + +## Priority 1: Has PineLib Source Code (1) + +### ✅ Ready to Implement +- [ ] `ta.supertrend` - SuperTrend Indicator + - Source: ta-v10.pine lines 568-622 + - Returns: [float, int] (superTrend value, trend direction) + +--- + +## Priority 2: Core Building Blocks (9) + +These are fundamental functions used by many other indicators and must be implemented first: + +### Moving Averages +- [ ] `ta.wma` - Weighted Moving Average +- [ ] `ta.rma` - Rolling Moving Average (reference: rma2() in PineLib) +- [ ] `ta.vwma` - Volume Weighted Moving Average +- [ ] `ta.alma` - Arnaud Legoux Moving Average +- [ ] `ta.hma` - Hull Moving Average +- [ ] `ta.swma` - Symmetrically Weighted Moving Average + +### Price Analysis +- [ ] `ta.highest` - Highest value over period +- [ ] `ta.lowest` - Lowest value over period +- [ ] `ta.highestbars` - Bars since highest value +- [ ] `ta.lowestbars` - Bars since lowest value +- [ ] `ta.max` - Maximum of two values +- [ ] `ta.min` - Minimum of two values +- [ ] `ta.range` - Range (highest - lowest) + +### Utility Functions +- [ ] `ta.cum` - Cumulative sum +- [ ] `ta.cross` - Cross (either direction) + +--- + +## Priority 3: Popular Oscillators & Indicators (15) + +### Standard Oscillators +- [ ] `ta.stoch` - Stochastic Oscillator (reference: stochFull() in PineLib) +- [ ] `ta.cci` - Commodity Channel Index +- [ ] `ta.mfi` - Money Flow Index +- [ ] `ta.wpr` - Williams %R +- [ ] `ta.mom` - Momentum +- [ ] `ta.roc` - Rate of Change +- [ ] `ta.cmo` - Chande Momentum Oscillator +- [ ] `ta.tsi` - True Strength Index +- [ ] `ta.rci` - Rank Correlation Index +- [ ] `ta.dmi` - Directional Movement Index + +### Bands & Channels +- [ ] `ta.bbw` - Bollinger Bands Width +- [ ] `ta.kc` - Keltner Channels +- [ ] `ta.kcw` - Keltner Channels Width + +### Trend Indicators +- [ ] `ta.sar` - Parabolic SAR +- [ ] `ta.cog` - Center of Gravity + +--- + +## Priority 4: Statistical Functions (10) + +- [ ] `ta.variance` - Variance +- [ ] `ta.correlation` - Correlation coefficient +- [ ] `ta.dev` - Deviation +- [ ] `ta.median` - Median +- [ ] `ta.mode` - Mode +- [ ] `ta.percentile_linear_interpolation` - Percentile (linear interpolation) +- [ ] `ta.percentile_nearest_rank` - Percentile (nearest rank) +- [ ] `ta.percentrank` - Percent Rank +- [ ] `ta.linreg` - Linear Regression + +--- + +## Priority 5: Advanced Indicators (6) + +### Volume-Based +- [ ] `ta.vwap` - Volume Weighted Average Price + +### Pivot Points +- [ ] `ta.pivot_point_levels` - Pivot point levels +- [ ] `ta.pivothigh` - Pivot high +- [ ] `ta.pivotlow` - Pivot low + +### Conditional Functions +- [ ] `ta.barssince` - Bars since condition +- [ ] `ta.rising` - Is rising +- [ ] `ta.falling` - Is falling +- [ ] `ta.valuewhen` - Value when condition was true + +--- + +## Bonus: PineLib-Only Functions (45) + +These functions are implemented in PineLib but not in the official documentation. Consider adding them to expand OakScriptJS capabilities: + +### Moving Averages & Advanced Smoothing (10) +- [ ] `ta.dema` - Double Exponential Moving Average (PineLib: dema/dema2) +- [ ] `ta.tema` - Triple Exponential Moving Average (PineLib: tema/tema2) +- [ ] `ta.trima` - Triangular Moving Average +- [ ] `ta.t3` - Tilson Moving Average (T3) +- [ ] `ta.frama` - Fractal Adaptive Moving Average +- [ ] `ta.ema2` - EMA with series float length support +- [ ] `ta.rma2` - RMA with series float length support +- [ ] `ta.atr2` - ATR with series float length support + +### Oscillators & Momentum (17) +- [ ] `ta.ao` - Awesome Oscillator +- [ ] `ta.aroon` - Aroon Oscillator +- [ ] `ta.coppock` - Coppock Curve +- [ ] `ta.dm` - Demarker Indicator +- [ ] `ta.eom` - Ease of Movement +- [ ] `ta.ft` - Fisher Transform +- [ ] `ta.ift` - Inverse Fisher Transform +- [ ] `ta.kvo` - Klinger Volume Oscillator +- [ ] `ta.pzo` - Price Zone Oscillator +- [ ] `ta.stc` - Schaff Trend Cycle +- [ ] `ta.stochFull` - Full Stochastic Oscillator +- [ ] `ta.stochRsi` - Stochastic RSI +- [ ] `ta.szo` - Sentiment Zone Oscillator +- [ ] `ta.trix` - TRIX indicator +- [ ] `ta.uo` - Ultimate Oscillator +- [ ] `ta.vhf` - Vertical Horizontal Filter +- [ ] `ta.vi` - Vortex Indicator +- [ ] `ta.vzo` - Volume Zone Oscillator +- [ ] `ta.wpo` - Wave Period Oscillator + +### Channels & Bands (1) +- [ ] `ta.donchian` - Donchian Channel + +### Trend & Direction (4) +- [ ] `ta.ht` - Hilbert Transform +- [ ] `ta.supertrend2` - SuperTrend with series float length +- [ ] `ta.vStop` - Volatility Stop +- [ ] `ta.vStop2` - Volatility Stop with series float length + +### Pattern Detection (1) +- [ ] `ta.williamsFractal` - Williams' Fractal + +### Statistical & Utility (6) +- [ ] `ta.cagr` - Compound Annual Growth Rate +- [ ] `ta.changePercent` - Calculate percentage change +- [ ] `ta.highestSince` - Highest value since condition +- [ ] `ta.lowestSince` - Lowest value since condition +- [ ] `ta.rms` - Root Mean Square +- [ ] `ta.rwi` - Random Walk Index + +### Volume Analysis (3) +- [ ] `ta.relativeVolume` - Compare volume to historical average +- [ ] `ta.requestUpAndDownVolume` - Requests up/down volume data +- [ ] `ta.requestVolumeDelta` - Requests volume delta + +### Advanced Indicators (1) +- [ ] `ta.ichimoku` - Ichimoku Cloud + +--- + +## Implementation Notes + +### Dependencies +Some functions depend on others being implemented first: +- `ta.bbw` requires `ta.bb` (✅ done) +- `ta.kcw` requires `ta.kc` +- `ta.stoch` is used by many other oscillators +- `ta.highest` and `ta.lowest` are used by many indicators +- `ta.wma` is used by several indicators + +### Testing Strategy +Each implemented function should have: +1. Unit tests comparing output with PineScript +2. Edge case handling (NaN, empty arrays, etc.) +3. Performance benchmarks for large datasets + +### Code Organization +Consider organizing implementations into separate files: +- `ta/moving-averages.ts` +- `ta/oscillators.ts` +- `ta/bands-channels.ts` +- `ta/statistical.ts` +- `ta/utility.ts` + +--- + +## Summary + +**Total Functions to Implement**: 104 +- **Documented (missing)**: 48 +- **PineLib-only**: 45 +- **Already implemented**: 11 + +**Recommended Implementation Order**: +1. Core building blocks (wma, rma, highest, lowest, cum) +2. SuperTrend (has source code) +3. Popular oscillators (stoch, cci, mfi) +4. Statistical functions +5. Advanced indicators +6. PineLib-only enhancements