Center Of Gravity v2 NRP indicator
Key Changes:
Calculation Logic: Now, for each bar n (from the oldest to the current -1), a separate polynomial fit is calculated using only bars n+1 to n+bars_back (future data relative to n, but fixed at the time of n's close). This simulates the behavior of the original without repainting.
Efficiency: Optimized to not recalculate everything on every tick. Only updates the most recent bar (current-1) when there is a new bar.
Std dev: Calculated fixed per bar, without repainting.
Draw begin: Adjusted to start at Bars - bars_back - 1, avoiding premature drawing.
Objects and Arrows: Retained, but only updated at bar 0 (current) with fixed values.
Parameters: Added a comment explaining that m=5 gives high smoothness (but more lag); You can lower it to 2-3 for less smoothness but less oscillation.
Testing: This approach maintains the "stickiness" and visual smoothness of the original, but the values ​​don't change retroactively. In backtests, you'll see stable historical signals.
Final notes:
Smoothness vs. Original: With m=5 and bars_back=192, the curve will be very smooth and will "stick" to the price similar to the original, but with a slight lag (1 bar). If you notice any "steps" on lower timeframes, increase bars_back to 256 or higher.
Performance: On charts with many bars, it may be a little slower at startup (it calculates per bar), but once loaded, it only updates as needed.
Trading Use: Signals (line crossovers) are now 100% reliable in historical and real-time data, with no disappearances. Combine it with confirmations like RSI for better entries.
Important Notice
The AI-generated forex indicators published here are strictly experimental. They may contain errors or limitations and should not be considered as final tools or immediate recommendations for real-world use.
Their purpose is to serve as a basis for analysis, feedback, and refinement by the community and subject matter experts.
Careful evaluation is recommended before any practical application.