Analog Flow [KedArc Quant]Overview
AnalogFlow is an advanced analogue based market projection engine that reconstructs future price tendencies by matching current price behavior to historical analogues in the same instrument. Instead of using traditional indicators such as moving averages, RSI, or regression, AnalogFlow applies pattern vector similarity analysis - a data driven technique that identifies historically similar sequences and aggregates their subsequent movements into a smooth, forward looking curve.
Think of it as a market memory system:
If the current pattern looks like one we have seen before, how did price move afterward?
Why AnalogFlow Is Unique
1. Pattern centric - it does not rely on any standard indicator formula; it directly analyzes price movement vectors.
2. Adaptive - it learns from the same instrument's past behavior, making it self calibrating to volatility and regime shifts.
3. Non repainting - the projection is generated on the latest completed bar and remains fixed until new data is available.
4. Noise resistant - the EMA Blend engine smooths the projected trajectory, reducing random variance between analogues.
Inputs and Configuration
Pattern Bars
Number of bars in the reference pattern window: 40
Projection Bars
Number of bars forward to project: 30
Search Depth
Number of bars back to look for matching analogues: 600
Distance Metric
Comparison method: Euclidean, Manhattan, or Cosine (default Euclidean)
Matches
Number of top analogues to blend (1-5): Top 3
Build Mode
Projection type: Cumulative, MeanStep, or EMA Blend (default EMA Blend)
EMA Blend Length
Smoothness of the projected path: 15
Normalize Pattern
Enable Z score normalization for shape matching: true
Dissimilarity Mode
If true, finds inverse analogues for mean reversion analysis: false
Line Color and Width
Style settings for projection curve: Blue, width 2
How It Works with Past Data
1. The system builds a memory bank of patterns from the last N bars based on the scanDepth value.
2. It compares the latest Pattern Bars segment to each historical segment.
3. It selects the Top K most similar or dissimilar analogues.
4. For each analogue, it retrieves what happened after that pattern historically.
5. It averages or smooths those forward moves into a single composite forecast curve.
6. The forecast (blue line) is drawn ahead of the current candle using line.new with no repainting.
Output Explained
Blue Path
The weighted mean future trajectory based on historical analogues.
Smoother when EMA Blend mode is enabled.
Flat Section
Indicates low directional consensus or equilibrium across analogues.
Upward or Downward Slope
Represents historical tendency toward continuation or reversal following similar conditions.
Recommended Timeframes
Scalping / Short Term
1m - 5m : Short winLen (20-30), small ahead (10-15)
Swing Trading
15m - 1h : Balanced settings (winLen 40-60, ahead 20-30)
Positional / Multi Day
4h - 1D : Large windows (winLen 80-120, ahead 30-50)
Instrument Compatibility
Works seamlessly on:
Stocks and ETFs
Indices
Cryptocurrency
Commodities (Gold, Crude, etc.)
Futures and F&O (both intraday and positional)
Forex
No symbol specific calibration needed. It self adapts to volatility.
How Traders Can Use It
Forecast Context
Identify likely short term price path or drift direction.
Reversal Detection
Flip seekOpp to true for mean reversion pattern analysis.
Scenario Comparison
Observe whether the current regime tends to continue or stall.
Momentum Confirmation
Combine with trend tools such as EMA or MACD for directional bias.
Backtesting Support
Compare projected path versus realized price to evaluate reliability.
FAQ
Q1. Does AnalogFlow repaint?
No. It calculates only once per completed bar and projects forward. The future path remains static until a new bar closes.
Q2. Is it a neural network or AI model?
Not in the machine learning sense. It is a deterministic analogue matching engine using statistical distance metrics.
Q3. Why does the projection sometimes flatten?
That means similar historical setups had no clear consensus in direction (neutral expectation).
Q4. Can I use it for live trading signals?
AnalogFlow is not a signal generator. It provides probabilistic context for upcoming movement.
Q5. Does higher scanDepth improve accuracy?
Up to a point. More depth gives more analogues, but too much can dilute recency. Try 400 to 800.
Glossary
Analogue
A past pattern similar to the current price behavior.
Distance Metric
Mathematical formula for pattern similarity.
Step Vector
Difference between consecutive closing prices.
EMA Blend
Exponential smoothing of the projected path.
Cumulative Mode
Adds sequential historical deltas directly.
Z Score Normalization
Rescaling to mean 0 and variance 1 for shape comparison.
Summary
AnalogFlow converts the market's historical echoes into a structured, statistically weighted forward projection. It gives traders a contextual roadmap, not a signal, showing how similar past setups evolved and allowing better informed entries, exits, and scenario planning across all asset classes.
Disclaimer
This script is provided for educational purposes only.
Past performance does not guarantee future results.
Trading involves risk, and users should exercise caution and proper risk management when applying this strategy.
Manhattan
RSI-MFI Machine Learning [ Manhattan distance ]The RSI-MFI Machine Learning Indicator is a technical analysis tool that combines the Relative Strength Index (RSI) and Money Flow Index (MFI) indicators with the Manhattan distance metric.
It aims to provide insights into potential trade setups by leveraging machine learning principles and calculating distances between current and historical data points.
The indicator starts by calculating the RSI and MFI values based on the specified periods for each indicator.
The RSI measures the strength and speed of price movements, while the MFI evaluates the inflow and outflow of money in the market.
By combining these two indicators, the indicator captures both price momentum and money flow dynamics.
To apply machine learning principles , the indicator utilizes the Manhattan distance metric to quantify the similarity or dissimilarity between different data points.
The Manhattan distance is calculated by taking the absolute differences between corresponding RSI and MFI values of the current point and historical points.
Next, the indicator determines the nearest neighbors based on the calculated Manhattan distances.
The number of nearest neighbors is determined by the square root of the specified count of neighbors.
By identifying similar patterns and behaviors in the historical data, the indicator aims to uncover potential trade opportunities.
Trade signals are generated based on the calculated distances. The indicator compares each distance with the maximum distance encountered so far.
If a new maximum distance is found, it updates the value and considers the corresponding direction as a potential trade signal. The trade signals are stored in an array for further analysis.
Furthermore, the indicator considers the price action and a calculated regression line to differentiate between long and short trade signals.
Long trade signals are identified when the closing price is above the regression line, indicating a potentially bullish setup.
Short trade signals are identified when the closing price is below the regression line, indicating a potentially bearish setup.
The RSI-MFI Machine Learning Indicator visualizes the regression line on the price chart and labels the bars accordingly. It highlights the regression line with different colors based on the trade signals, making it easier for traders to identify potential entry or exit points.
Traders can use the RSI-MFI Machine Learning Indicator as a tool to analyze price movements, evaluate market conditions based on RSI and MFI, leverage machine learning concepts to find similar patterns, and make informed trading decisions.

