> For the complete documentation index, see [llms.txt](https://docs.blocklensai.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.blocklensai.com/the-core/howitworks.md).

# How It Works ?

Blocklens AI is designed to make futures trading smarter, more precise, and fully community-driven.

\
\&#xNAN;***Here’s how the system works step by step:***&#x20;

<h2 align="center"><mark style="color:$info;">Step 1</mark> - AI Scans the Market</h2>

Blocklens AI is always on watch, scanning the entire futures market in real time, 24/7, to catch hidden opportunities before they emerge. Instead of chasing trades manually, the AI constantly evaluates every listed perpetual pair and filters out only the setups with strong potential.

<figure><img src="/files/notEGWFzsUElkRlcZ3mU" alt=""><figcaption></figcaption></figure>

***

<h2 align="center"><mark style="color:$info;">Step 2</mark> - Indicator Analysis</h2>

#### **How Blocklens AI Uses Indicator Analysis ?**

Indicators are at the core of Blocklens AI’s decision-making engine. Instead of relying on just one signal, the AI combines multiple indicators to create a **confluence score** that reflects the real market strength.

**Step 1: Real-Time Indicator Calculation**\
The AI continuously computes values for RSI, MACD, EMA crossovers, Volume shifts, and price action zones across all supported futures pairs.

**Step 2: Detecting Market Conditions**

* **RSI** → Identifies if the market is overbought or oversold.
* **MACD** → Shows momentum shifts and potential reversals.
* **EMA Crossovers** → Confirms short-term vs long-term trend direction.
* **Volume Heatmap** → Detects unusual buying/selling pressure.
* **Price Action Patterns** → Finds key formations that reveal hidden market psychology.

**Step 3: Confluence Scoring**\
The AI assigns points when conditions align (e.g., RSI oversold + MACD bullish + rising volume = strong long setup).\
If enough factors agree, the setup is marked as **high probability**.

**Step 4: Signal Validation with AI Model**\
Past data is used to train the AI, so it recognizes which indicator combinations historically led to profitable trades.\
Only when the probability passes a threshold does Blocklens AI push the signal.

{% hint style="success" %}
Instead of reacting to one indicator (like many traders do), Blocklens AI blends multiple signals together, filters them through machine learning, and delivers only **strong, validated trade setups** to the user.
{% endhint %}

<figure><img src="/files/af6Mao8m0gMMpyUteJY8" alt=""><figcaption></figcaption></figure>

***

<h2 align="center"><mark style="color:$info;">Step 3</mark> - Candlestick Patterns Analysis</h2>

#### **How Blocklens AI Uses Candlestick Patterns**

Blocklens AI doesn’t just spot candlestick shapes — it reads them in full market context to separate real signals from noise.&#x20;

**Step 1: Automatic Pattern Recognition**\
The AI scans every candle across supported futures pairs and flags formations like Bullish Engulfing, Doji, Hammer, Morning Star, and more.

**Step 2: Trend Validation**\
Instead of treating patterns in isolation, Blocklens AI checks whether the broader market is in an uptrend, downtrend, or sideways range to confirm relevance.

**Step 3: Indicator Confluence**\
Each detected pattern is cross-verified with technical indicators such as RSI, MACD, EMA crossovers, and Volume strength. Only when patterns align with indicator signals do they qualify as potential trades.

{% hint style="success" %}
By layering candlestick analysis with trend detection and indicator confirmation, Blocklens AI automatically filters out false patterns and highlights only **high-probability trading opportunities** — the way a pro trader would, but faster and 24/7.
{% endhint %}

***

<h2 align="center"><mark style="color:$info;">Step 4</mark> - AI Filtering</h2>

Raw signals are noisy. Blocklens AI refines every setup through a **multi-layer validation system** combining indicators, candlestick patterns, and machine learning.

### Explanation

Raw signals are generated → We compute technical indicators (RSI, EMA, MACD, Volume) and detect candlestick patterns.

#### **Step 1: Calculate indicators**

* RSI, MACD, EMA crossovers, Volume changes and price action.

#### **Step 2: Create an indicator confluence score**

* If RSI oversold → +1
* If MACD bullish → +1
* If Volume rising → +1
* If EMA crossover confirmed → +1

{% hint style="success" %}
(Score ≥ 2 = strong confluence)
{% endhint %}

#### **Step 3: Candlestick pattern workflow**

* Detect if the setup includes a **Reversal** (e.g., Bullish Engulfing, Hammer), **Continuation** (e.g., Rising Three Methods, Marubozu), or **Indecision** (e.g., Doji, Spinning Top).
* Match the pattern to current **trend context** (uptrend, downtrend, sideways).
* Assign a pattern score: Strong (+1), Neutral (0), Weak (ignore).
* Add candlestick score to the indicator confluence.

{% hint style="success" %}
Bullish Engulfing (+1) + RSI oversold (+1) + Rising Volume (+1) = **Score 3 (high-confidence long setup).**
{% endhint %}

#### **Step 4: Confluence check**

* If 2 or more conditions (indicators + candlestick pattern) align → that’s a strong setup, like pro traders confirm before taking trades.

#### **Step 5: Model training**

* A <kbd>RandomForestClassifier</kbd> learns which **indicator + candlestick combinations** historically led to winning trades.

Here is an example code of how Blocklens AI uses a **RandomForestClassifier** to train on historical indicator and candlestick data. ⮯

```python
import pandas as pd
from sklearn.ensemble import RandomForestClassifier
from sklearn.model_selection import train_test_split
from sklearn.metrics import classification_report, accuracy_score

# Example historical dataset (indicators + candlestick patterns)
data = {
    "RSI": [25, 72, 40, 65, 29, 85, 33, 55],
    "MACD": [1, -1, 0, 1, -1, -1, 1, 0],       # 1 = bullish, -1 = bearish, 0 = neutral
    "EMA_Crossover": [1, -1, 0, 1, -1, -1, 1, 0],  # 1 = bullish, -1 = bearish
    "Volume_Score": [1, 0, 1, 1, 0, 0, 1, 1],   # 1 = rising, 0 = weak
    "Pattern_Score": [1, -1, 0, 1, -1, -1, 0, 1], # candlestick score
    "Profitable": [1, 0, 0, 1, 0, 0, 1, 1]     # Target: 1 = profitable, 0 = not
}

# Convert to DataFrame
df = pd.DataFrame(data)

# Features and target
X = df[["RSI", "MACD", "EMA_Crossover", "Volume_Score", "Pattern_Score"]]
y = df["Profitable"]

# Train-test split
X_train, X_test, y_train, y_test = train_test_split(X, y, test_size=0.3, random_state=42)

# Train Random Forest Classifier
model = RandomForestClassifier(n_estimators=100, random_state=42)
model.fit(X_train, y_train)

# Predictions
y_pred = model.predict(X_test)

# Evaluation
print("Accuracy:", accuracy_score(y_test, y_pred))
print("Classification Report:\n", classification_report(y_test, y_pred))

# Example: Predict probability of a new setup
new_setup = [[28, 1, 1, 1, 1]]  # Oversold RSI, Bullish MACD, EMA up, Rising Volume, Bullish Pattern
probability = model.predict_proba(new_setup)[0][1]

print("Probability this setup is profitable:", round(probability * 100, 2), "%")

```

{% hint style="success" %}
**Result:** The system acts like a pro trader, validating signals with **indicators + candlestick context + machine learning** before sending them out.
{% endhint %}

***

<h2 align="center"><mark style="color:$info;">Step 5</mark> - Smart Entry &#x26; Exit Levels</h2>

Blocklens AI signals are designed to be **clear, simple, and executable**. Each signal includes one entry zone, one stop-loss, and one take-profit, making it easy for traders to follow without over-complication.

### **🔹Entry Zone**

Defined using liquidity zones, EMA clusters, and candlestick confirmations.

* Example: “Entry Zone: $4,800 – $4,810 (ETH/USDT)

### **🔹 Stop-Loss (SL)**

Placed just beyond the invalidation level to protect capital.

* For longs → below support or candlestick low.
* For shorts → above resistance or candlestick high.

### **🔹 Take-Profit (TP)**

Blocklens AI sets **one precise TP level** using Fibonacci extensions, ATR volatility, and historical reaction points. This gives traders a clear target for closing the trade.

* Example: TP = $4,850 (ETH/USDT)

**Risk-to-Reward Check**\
Every signal is validated by its Risk-to-Reward ratio.

* If R/R < 1.3 → filtered out.
* If R/R ≥ 1.4 → ✅ published.

***

<h2 align="center"><mark style="color:$info;"><strong>Step 6</strong></mark><strong> -</strong> Leverage Adjustment</h2>

Blocklens AI doesn’t just calculate signal confidence — it also adjusts the **suggested leverage** based on the strength of the setup. This way, **stronger signals = more aggressive leverage**, while weaker signals stick to safer modes.

### **Weighted Confidence System (recap)**

* RSI Oversold/Overbought → +15%
* MACD Momentum Shift → +20%
* EMA Crossovers → +15%
* Volume Spike / Heatmap → +15%
* Candlestick Reversal → +25%
* Candlestick Continuation → +15%
* Doji (Indecision at top) = +10%&#x20;

{% hint style="success" %}
The **total score = sum of all active signals**. Higher score = higher confidence → higher leverage.
{% endhint %}

***

### **Confidence → Leverage Mapping**

Blocklens AI maps final confidence % into **risk-adjusted leverage tiers**:

* **0–30% = Weak → Ignore**\
  ❌ No trade taken.\ <kbd>(Avoids overtrading low-quality setups.)</kbd>
* **30–60% = Medium → Safe Mode (1–5x)**\
  &#x20;Low leverage to reduce risk.\ <kbd>Example: RSI + EMA cross but weak candlestick.</kbd>
* **60–80% = Strong → Balanced Mode (5–10x)**\
  Moderate leverage for strong setups.\ <kbd>Example: RSI oversold + MACD bullish + Rising Volume</kbd><kbd>*.*</kbd>
* **80%+ = High Confidence → Aggressive Mode (10–20x)**\
  Full conviction signals where confluence is perfect.\ <kbd>Example: Bullish Engulfing + Oversold RSI + MACD bullish + Volume spike.</kbd>

<h3 align="center">Example Leverage Data</h3>

<table data-full-width="true"><thead><tr><th>Safe Mode (5x Leverage)</th><th>Balanced Mode (10x Leverage)</th><th>Aggressive Mode (20x Leverage)</th></tr></thead><tbody><tr><td>RSI Oversold (+1) (≈ +20% confidence)</td><td>RSI Oversold (+1) (≈ +20% confidence)</td><td>Bullish Engulfing (+1) (≈ +25% confidence)</td></tr><tr><td>MACD Bullish (+1) (≈ +20% confidence)</td><td>EMA Bullish Cross (+1) (≈ +20% confidence)</td><td>RSI Oversold (+1) (≈ +20% confidence)</td></tr><tr><td>Volume Flat (0) (≈ 0% confidence)</td><td>Volume Rising (+1) (≈ +20% confidence)</td><td>EMA Bullish Cross (+1) (≈ +20% confidence)</td></tr><tr><td>Doji Pattern (0) (≈ 0% confidence)</td><td>Doji Pattern (0) (≈ 0% confidence)</td><td>Volume Spike (+1) (≈ +20% confidence)</td></tr><tr><td><strong>Total Confidence = </strong><mark style="color:blue;"><strong>40% (Medium)</strong></mark></td><td><strong>Total Confidence = </strong><mark style="color:purple;"><strong>60% (Strong)</strong></mark></td><td><strong>Total Confidence = </strong><mark style="color:$success;"><strong>85% (Very Strong)</strong></mark></td></tr></tbody></table>

{% hint style="success" %}
No more guessing leverage. Strong signals, stronger leverage. Weak setups, safer exposure.
{% endhint %}

***


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## 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, and the optional `goal` query parameter:

```
GET https://docs.blocklensai.com/the-core/howitworks.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
