mirror of
https://github.com/mihakralj/QuanTAlib.git
synced 2026-08-16 01:28:05 +00:00
docs: update category index files and fix indicator implementations (#58)
This commit is contained in:
+20
-58
@@ -1,65 +1,27 @@
|
||||
# Trends (FIR)
|
||||
|
||||
> "FIR filters are always stable. The question is how many coefficients you need." Digital Signal Processing folklore
|
||||
> "FIR filters are always stable. The question is how many coefficients you need." Digital Signal Processing folklore
|
||||
|
||||
Finite Impulse Response (FIR) trend indicators. These use fixed-length windows with explicit coefficients. No feedback loops, no recursion. Output depends only on current and past inputs. Always stable. Linear phase possible. SIMD-friendly batch computation.
|
||||
|
||||
## Indicator Status
|
||||
## Indicators
|
||||
|
||||
| Indicator | Full Name | Status | Description |
|
||||
| :--- | :--- | :---: | :--- |
|
||||
| [ALMA](lib/trends_FIR/alma/Alma.md) | Arnaud Legoux MA | | Gaussian window with offset parameter. Smooth with configurable lag. |
|
||||
| [BLMA](lib/trends_FIR/blma/Blma.md) | Blackman MA | | Blackman window. Excellent side-lobe suppression (-58 dB). |
|
||||
| [BWMA](lib/trends_FIR/bwma/Bwma.md) | Bessel-Weighted MA | | Bessel window function. Good frequency resolution. |
|
||||
| [Conv](lib/trends_FIR/conv/Conv.md) | Convolution MA | | Generic convolution with custom kernel. Building block for others. |
|
||||
| [DWMA](lib/trends_FIR/dwma/Dwma.md) | Double Weighted MA | | WMA of WMA. Smoother than single WMA. Triangular-like response. |
|
||||
| [GWMA](lib/trends_FIR/gwma/Gwma.md) | Gaussian Weighted MA | | Centered Gaussian bell curve. No overshoot. Ã controls width. |
|
||||
| [HAMMA](lib/trends_FIR/hamma/Hamma.md) | Hamming MA | | Hamming window. -43 dB side lobes. Good general purpose. |
|
||||
| [HANMA](lib/trends_FIR/hanma/Hanma.md) | Hanning MA | | Hanning (raised cosine). Zero at edges. Smooth roll-off. |
|
||||
| [HMA](lib/trends_FIR/hma/Hma.md) | Hull MA | | Reduced lag via weighted average differencing. Can overshoot. |
|
||||
| [HWMA](lib/trends_FIR/hwma/Hwma.md) | Holt-Winters MA | | Triple exponential smoothing. Tracks level, velocity, acceleration. |
|
||||
| [LSMA](lib/trends_FIR/lsma/Lsma.md) | Least Squares MA | | Linear regression endpoint. Extrapolates trend. |
|
||||
| [PWMA](lib/trends_FIR/pwma/Pwma.md) | Pascal Weighted MA | | Pascal's triangle coefficients. Binomial distribution weights. |
|
||||
| [SGMA](lib/trends_FIR/sgma/Sgma.md) | Savitzky-Golay MA | | Polynomial fit. Preserves higher moments. Shape-preserving. |
|
||||
| [SINEMA](lib/trends_FIR/sinema/Sinema.md) | Sine-Weighted MA | | Sine wave weighting. Smooth bell-shaped emphasis. |
|
||||
| [SMA](lib/trends_FIR/sma/Sma.md) | Simple MA | | Equal weights. Baseline reference. Lag = (N-1)/2. |
|
||||
| [TRIMA](lib/trends_FIR/trima/Trima.md) | Triangular MA | | Triangular weights. SMA of SMA. Emphasizes middle. |
|
||||
| [WMA](lib/trends_FIR/wma/Wma.md) | Weighted MA | | Linear weights. Recent prices weighted more. Lag < SMA. |
|
||||
|
||||
**Status Key:** Implemented | =Ë Planned
|
||||
|
||||
## Selection Guide
|
||||
|
||||
| Use Case | Recommended | Why |
|
||||
| Indicator | Full Name | Description |
|
||||
| :--- | :--- | :--- |
|
||||
| Baseline comparison | SMA | Simple, well-understood. Reference for lag/smoothness. |
|
||||
| Reduced lag | HMA, WMA, LSMA | HMA aggressive. WMA moderate. LSMA extrapolates. |
|
||||
| Minimal overshoot | GWMA, TRIMA | Gaussian and triangular weights are gentle. |
|
||||
| Spectral purity | BLMA, HAMMA | Window functions designed for frequency analysis. |
|
||||
| Shape preservation | SGMA | Polynomial fit preserves peaks and valleys. |
|
||||
| Configurable response | ALMA, Conv | ALMA has offset/sigma. Conv accepts any kernel. |
|
||||
| Trend extrapolation | LSMA, HWMA | LSMA extends regression. HWMA tracks velocity. |
|
||||
|
||||
## FIR vs IIR Comparison
|
||||
|
||||
| Aspect | FIR (This Category) | IIR (trends_IIR) |
|
||||
| :--- | :--- | :--- |
|
||||
| Stability | Always stable | Can be unstable if poorly designed |
|
||||
| Phase | Linear phase possible | Nonlinear phase (causes distortion) |
|
||||
| Coefficients | Many (N = period) | Few (2-4 typically) |
|
||||
| Memory | Higher | Lower |
|
||||
| Computation | O(N) per sample, SIMD-friendly | O(1) per sample, recursive |
|
||||
| Lag | Fixed for given N | Can be lower for same smoothness |
|
||||
| Overshoot | Generally low | Can overshoot (especially JMA, HMA) |
|
||||
|
||||
## Window Function Characteristics
|
||||
|
||||
| Window | Main Lobe Width | Side Lobe (dB) | Best For |
|
||||
| :--- | :--- | :--- | :--- |
|
||||
| Rectangular (SMA) | Narrow | -13 | Frequency resolution |
|
||||
| Hanning | Medium | -31 | General purpose |
|
||||
| Hamming | Medium | -43 | Better side-lobe rejection |
|
||||
| Blackman | Wide | -58 | Excellent side-lobe rejection |
|
||||
| Gaussian | Configurable | Configurable | Tunable trade-off |
|
||||
|
||||
Narrower main lobe = better frequency resolution. Lower side lobes = less spectral leakage.
|
||||
| [ALMA](lib/trends_FIR/alma/Alma.md) | Arnaud Legoux MA | Gaussian window with offset parameter. Smooth with configurable lag. |
|
||||
| [BLMA](lib/trends_FIR/blma/Blma.md) | Blackman MA | Blackman window. Excellent side-lobe suppression (-58 dB). |
|
||||
| [BWMA](lib/trends_FIR/bwma/Bwma.md) | Bessel-Weighted MA | Bessel window function. Good frequency resolution. |
|
||||
| [CONV](lib/trends_FIR/conv/Conv.md) | Convolution MA | Generic convolution with custom kernel. Building block for others. |
|
||||
| [DWMA](lib/trends_FIR/dwma/Dwma.md) | Double Weighted MA | WMA of WMA. Smoother than single WMA. Triangular-like response. |
|
||||
| [GWMA](lib/trends_FIR/gwma/Gwma.md) | Gaussian Weighted MA | Centered Gaussian bell curve. No overshoot. σ controls width. |
|
||||
| [HAMMA](lib/trends_FIR/hamma/Hamma.md) | Hamming MA | Hamming window. -43 dB side lobes. Good general purpose. |
|
||||
| [HANMA](lib/trends_FIR/hanma/Hanma.md) | Hanning MA | Hanning (raised cosine). Zero at edges. Smooth roll-off. |
|
||||
| [HMA](lib/trends_FIR/hma/Hma.md) | Hull MA | Reduced lag via weighted average differencing. Can overshoot. |
|
||||
| [HWMA](lib/trends_FIR/hwma/Hwma.md) | Holt-Winters MA | Triple exponential smoothing. Tracks level, velocity, acceleration. |
|
||||
| [LSMA](lib/trends_FIR/lsma/Lsma.md) | Least Squares MA | Linear regression endpoint. Extrapolates trend. |
|
||||
| [PWMA](lib/trends_FIR/pwma/Pwma.md) | Pascal Weighted MA | Pascal's triangle coefficients. Binomial distribution weights. |
|
||||
| [SGMA](lib/trends_FIR/sgma/Sgma.md) | Savitzky-Golay MA | Polynomial fit. Preserves higher moments. Shape-preserving. |
|
||||
| [SINEMA](lib/trends_FIR/sinema/Sinema.md) | Sine-Weighted MA | Sine wave weighting. Smooth bell-shaped emphasis. |
|
||||
| [SMA](lib/trends_FIR/sma/Sma.md) | Simple MA | Equal weights. Baseline reference. Lag = (N-1)/2. |
|
||||
| [TRIMA](lib/trends_FIR/trima/Trima.md) | Triangular MA | Triangular weights. SMA of SMA. Emphasizes middle. |
|
||||
| [WMA](lib/trends_FIR/wma/Wma.md) | Weighted MA | Linear weights. Recent prices weighted more. Lag < SMA. |
|
||||
|
||||
@@ -1,79 +0,0 @@
|
||||
---
|
||||
description: Configuration for AI behavior when interacting with Codacy's MCP Server
|
||||
applyTo: '**'
|
||||
---
|
||||
---
|
||||
# Codacy Rules
|
||||
Configuration for AI behavior when interacting with Codacy's MCP Server
|
||||
|
||||
## using any tool that accepts the arguments: `provider`, `organization`, or `repository`
|
||||
* ALWAYS use:
|
||||
* provider: gh
|
||||
* organization: mihakralj
|
||||
* repository: QuanTAlib
|
||||
* Avoid calling `git remote -v` unless really necessary
|
||||
|
||||
## CRITICAL: After ANY successful `edit_file` or `reapply` operation
|
||||
* YOU MUST IMMEDIATELY run the `codacy_cli_analyze` tool from Codacy's MCP Server for each file that was edited, with:
|
||||
* `rootPath`: set to the workspace path
|
||||
* `file`: set to the path of the edited file
|
||||
* `tool`: leave empty or unset
|
||||
* If any issues are found in the new edits, propose and apply fixes for them.
|
||||
* > NOTE: Failure to follow this rule is considered a critical error.
|
||||
|
||||
## When you tried to run the `codacy_cli_analyze` tool and the Codacy CLI is not installed
|
||||
* Ask the user 'Codacy CLI is not installed. Would you like me to install it now?'
|
||||
* If the user responds with "yes", run the `codacy_cli_install` tool and then continue with the original task
|
||||
* If the user responds with "no", instruct the user that they can disable automatic analysis in the extension settings
|
||||
* Wait for the user to respond before proceeding with any other actions
|
||||
|
||||
## After every response
|
||||
* If you made any file edits in this conversation, verify you ran `codacy_cli_analyze` tool from Codacy's MCP Server
|
||||
|
||||
## When there are no Codacy MCP Server tools available, or the MCP Server is not reachable
|
||||
* Suggest the user the following troubleshooting steps:
|
||||
* Try to reset the MCP on the extension
|
||||
* If the user is using VSCode, suggest them to review their Copilot > MCP settings in Github, under their organization or personal account. Refer them to Settings > Copilot > Enable MCP servers in Copilot. Suggested URL (https://github.com/settings/copilot/features) or https://github.com/organizations/{organization-name}/settings/copilot/features (This can only be done by their organization admins / owners)
|
||||
* If none of the above steps work, suggest the user to contact Codacy support
|
||||
|
||||
## Trying to call a tool that needs a rootPath as a parameter
|
||||
* Always use the standard, non-URL-encoded file system path
|
||||
|
||||
## CRITICAL: Dependencies and Security Checks
|
||||
* IMMEDIATELY after ANY of these actions:
|
||||
* Running npm/yarn/pnpm install
|
||||
* Adding dependencies to package.json
|
||||
* Adding requirements to requirements.txt
|
||||
* Adding dependencies to pom.xml
|
||||
* Adding dependencies to build.gradle
|
||||
* Any other package manager operations
|
||||
* You MUST run the `codacy_cli_analyze` tool with:
|
||||
* `rootPath`: set to the workspace path
|
||||
* `tool`: set to "trivy"
|
||||
* `file`: leave empty or unset
|
||||
* If any vulnerabilities are found because of the newly added packages:
|
||||
* Stop all other operations
|
||||
* Propose and apply fixes for the security issues
|
||||
* Only continue with the original task after security issues are resolved
|
||||
* EXAMPLE:
|
||||
* After: npm install react-markdown
|
||||
* Do: Run codacy_cli_analyze with trivy
|
||||
* Before: Continuing with any other tasks
|
||||
|
||||
## General
|
||||
* Repeat the relevant steps for each modified file.
|
||||
* "Propose fixes" means to both suggest and, if possible, automatically apply the fixes.
|
||||
* You MUST NOT wait for the user to ask for analysis or remind you to run the tool.
|
||||
* Do not run `codacy_cli_analyze` looking for changes in duplicated code or code complexity metrics.
|
||||
* Complexity metrics are different from complexity issues. When trying to fix complexity in a repository or file, focus on solving the complexity issues and ignore the complexity metric.
|
||||
* Do not run `codacy_cli_analyze` looking for changes in code coverage.
|
||||
* Do not try to manually install Codacy CLI using either brew, npm, npx, or any other package manager.
|
||||
* If the Codacy CLI is not installed, just run the `codacy_cli_analyze` tool from Codacy's MCP Server.
|
||||
* When calling `codacy_cli_analyze`, only send provider, organization and repository if the project is a git repository.
|
||||
|
||||
## Whenever a call to a Codacy tool that uses `repository` or `organization` as a parameter returns a 404 error
|
||||
* Offer to run the `codacy_setup_repository` tool to add the repository to Codacy
|
||||
* If the user accepts, run the `codacy_setup_repository` tool
|
||||
* Do not ever try to run the `codacy_setup_repository` tool on your own
|
||||
* After setup, immediately retry the action that failed (only retry once)
|
||||
---
|
||||
@@ -1,4 +0,0 @@
|
||||
|
||||
|
||||
#Ignore vscode AI rules
|
||||
.github\instructions\codacy.instructions.md
|
||||
-1
@@ -1 +0,0 @@
|
||||
{}
|
||||
@@ -637,15 +637,9 @@ public sealed class Wma : AbstractBase
|
||||
|
||||
var vWsums = Avx.Add(vWsumState, vPw2);
|
||||
|
||||
Vector256<double> vResult;
|
||||
if (Fma.IsSupported)
|
||||
{
|
||||
vResult = Fma.MultiplyAdd(vWsums, vInvDivisor, vZero);
|
||||
}
|
||||
else
|
||||
{
|
||||
vResult = Avx.Multiply(vWsums, vInvDivisor);
|
||||
}
|
||||
Vector256<double> vResult = Fma.IsSupported
|
||||
? Fma.MultiplyAdd(vWsums, vInvDivisor, vZero)
|
||||
: Avx.Multiply(vWsums, vInvDivisor);
|
||||
vResult.StoreUnsafe(ref Unsafe.Add(ref outRef, idx));
|
||||
|
||||
vSumState = Avx2.Permute4x64(vSums.AsUInt64(), 0b_11_11_11_11).AsDouble(); // skipcq: CS-R1131
|
||||
@@ -832,4 +826,4 @@ public sealed class Wma : AbstractBase
|
||||
Unsafe.Add(ref outRef, idx) = wsum * invDivisor;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user