An open API service indexing awesome lists of open source software.

https://github.com/fractal-solutions/paed-framework


https://github.com/fractal-solutions/paed-framework

Last synced: about 2 months ago
JSON representation

Awesome Lists containing this project

README

        

# Price Action Energy Dynamics (PAED) Framework

The PAED framework is a first-principles method for efficient trading based on price action, inspired by the Hopfield neural network’s energy-minimization dynamics. This framework views price behavior as a system governed by energy functions, with stable market patterns as attractor states. Here's the concise yet complete documentation for reference.

---

## 1. Define the Problem

Efficient trading involves recognizing patterns in price action data, predicting the next likely movement, and acting on it profitably. The PAED framework reduces this to **pattern recognition**, **energy modeling**, and **decision-making**.

---

## 2. First Principles of Price Action

1. **Price Movement**: Driven by supply-demand imbalances, representing collective shifts in market perception.

2. **Market Structure**: Price action respects key zones (e.g., support/resistance) and trends due to herd psychology.

3. **Efficiency vs. Inefficiency**: Markets are inefficient in the short term (opportunity) but efficient in the long term (randomness).

---

## 3. Energy-Based Modeling of Price Behavior

### Energy Function

The price dynamics are described by the energy function:

\[
E = \text{Trend Energy} + \text{Volatility Energy} - \text{Liquidity Flow}.
\]

1. **Trend Energy**: Captures directional movement (momentum):

\[
\text{Trend Energy} = -\alpha \sum_t (P_t - P_{t-1}),
\]

2. **Volatility Energy**: Models random fluctuations:

\[
\text{Volatility Energy} = \beta \sum_t (P_t - \mu)^2,
\]

3. **Liquidity Flow**: Captures the effect of large orders/news:

\[
\text{Liquidity Flow} = -\gamma \sum_t \text{Volume}_t \cdot \Delta P_t,
\]

### State Updates

Define price states and update them to minimize energy:

\[
P_{t+1} = P_t + \eta \frac{\partial E}{\partial P_t},
\]

---

## 4. Recognizing and Storing Market Patterns

### Stable States as Patterns

Repeatable price patterns (e.g., trends, reversals) are encoded as local energy minima.
The weights of price levels are defined using a Hebbian-like learning rule:

\[
w_{ij} = \frac{1}{N} \sum_\mu (\Delta P_i^\mu \Delta P_j^\mu),
\]

### Attractor Dynamics

When price approaches a stored pattern (e.g., double top), it converges to that attractor.
Spurious states (random noise) are minimized through appropriate parameter tuning.

---

## 5. Decision-Making and Risk Management

### Actionable Trading Rules

1. **Entry Signal**: Enter when price approaches a stable state and Signal Strength exceeds a noise threshold:

\[
\text{Signal Strength} = \sum_i w_{ij} \Delta P_i - \text{Noise Threshold}.
\]

2. **Exit Signal**: Exit when:

\[
\Delta E \approx 0 \quad \text{or} \quad |\text{Volatility Energy}| > |\text{Trend Energy}|.
\]

3. **Stop-Loss Level**: Defined as:

\[
\text{Stop-Loss Level} = P_t \pm \sqrt{\text{Volatility Energy}}.
\]

---

## 6. Convergence Guarantees

1. The energy function E is bounded and decreases with each price update, ensuring convergence to a stable pattern.

2. The symmetric weight matrix w_{ij} prevents oscillations and ensures the system settles into attractors.

---

## 7. Practical Implementation

### Steps to Build the PAED Framework

1. **Data Preparation**: Use historical price and volume data to compute energy components.

2. **Pattern Encoding**: Train the system using a Hebbian-like rule to store market patterns as weights.

3. **Energy Minimization**: Use gradient descent to model price evolution and identify attractors.

4. **Backtesting**: Test the framework across datasets to validate profitability and refine thresholds.

---

## Summary

The PAED framework models price action as a system minimizing energy, with trends, volatility, and liquidity influencing dynamics. Patterns are encoded as attractor states, and actionable signals are derived by interpreting system behavior.