# The Neural Engine

Monika's decision-making process is driven by a hybrid "Brain & Hands" architecture designed to minimize latency while maximizing security.

#### The Brain (Pattern Recognition)

Running on a dedicated cloud container, the Neural Engine continuously processes market data for key assets (MON, BTC, ETH) using a multi-layered scoring system.

**1. The AI Confidence Score Calculation**

Monika does not rely on a single indicator. Instead, she generates a composite **Confidence Score (0-100)** based on a weighted algorithm:

$$
\text{Score} = (W\_{knn} \cdot C\_{fractal}) + (W\_{tech} \cdot S\_{technical}) + (W\_{macro} \cdot M\_{trend})
$$

* **Fractal Matching (60% Weight):** The K-Nearest Neighbors (KNN) algorithm compares the current 1-hour candle structure against 10,000 historical scenarios. If 80% of similar historical patterns resulted in a pump, the raw fractal score is 80.
* **RSI Momentum (20% Weight):**
  * **Bullish:** RSI > 50 and rising (Adds points).
  * **Overbought Penalty:** RSI > 75 (Subtracts points to prevent buying tops).
* **Macro Trend (20% Weight):** Checks the D1 (Daily) timeframe for major support/resistance validity.

**2. Golden Cross Detection (The "Alpha" Signal)**

Monika includes a dedicated **Golden Cross** detector acting as a "Super-Signal."

* **Definition:** When the 50-period Simple Moving Average (SMA) crosses *above* the 200-period SMA on the H4 or D1 timeframe.
* **System Response:**
  1. **Override:** A confirmed Golden Cross automatically sets the "Macro Trend" score to maximum.
  2. **Aggression Mode:** The engine reduces the RSI cooldown period, allowing for more aggressive entries during the confirmed uptrend.
  3. **Visualizer:** The terminal's "Market Structure" panel lights up **GOLD** to indicate this rare, high-probability event.

**3. The Trend Shield (Risk Management)**

To prevent counter-trend trading during crashes, a dynamic filter is applied before any score is finalized:

* **Bearish Shield:** If Price < EMA 200 (Exponential Moving Average) on the 4H chart, all "BUY" scores are dampened by 50%.
* **Volatility Guard:** If Bollinger Band width expands > 300% in 1 hour (flash crash event), trading is paused until volatility normalizes.

#### The Hands (Execution Layer)

Once the Brain generates a signal (Score > 75), the **Smart Routing Engine** takes over:

1. **Polls Monad RPCs** to check gas costs and slippage.
2. **Calculates Optimal Path:** Checks liquidity depth across PancakeSwap V3 and Uniswap V3.
3. **Auto-Routing:** If direct MON/USDC liquidity is low, it automatically constructs a multi-hop route (e.g., MON -> WETH -> USDC).


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://printr-deployr.gitbook.io/monika-docs/the-neural-engine.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
