cd /news/machine-learning/financial-market-analysis-double-tow… · home topics machine-learning article
[ARTICLE · art-54184] src=dev.to ↗ pub= topic=machine-learning verified=true sentiment=· neutral

Financial Market Analysis (Double-Tower Transformer)

A developer built a Double-Tower Gated Transformer Network (GTN) to generate profitable trading signals from high-frequency EUR/USD forex data. The system uses a custom cost matrix and weighted cross-entropy loss to combat class imbalance, and optimizes for raw profitability under real-world MetaTrader 5 constraints. Despite overfitting on a single batch, the model underfitted when scaled to one epoch with maximum parameters on an A100 GPU.

read1 min views1 publishedJul 10, 2026

A predictive machine learning system explicitly designed to generate profitable trading signals from high-frequency (1-minute) EUR/USD forex data. The flagship focus of this repository is a custom Double-Tower Gated Transformer Network (GTN) built to predict Take Profit / Stop Loss (TP/SL) strikes.

The data pipeline processes 1-minute OHLC bars to map out realistic TP/SL bounds over a 24-hour lookahead rather than using fixed time horizons.

The core model, the Gated Transformer Network (GTN), utilizes a dual-tower architecture that separates feature interactions from temporal sequences. It replaces traditional sinusoidal encodings with learned time embeddings to capture market regime shifts and session overlaps (London, NY, Tokyo).

To combat severe class imbalance (the model's tendency to constantly predict "keep/hold"), the network optimizes against a custom cost matrix and weighted cross-entropy loss.

![[Pasted image 20260710145647.png]] Instead of optimizing for standard classification accuracy, the pipeline tackles raw profitability. The intent is for models to learn the structural mechanics of price action, balancing Risk/Reward ratios (e.g., 1:2) against real-world MetaTrader 5 execution constraints (enforcing next-candle open entries and proper UTF-16-LE signal formatting).

(buy_precision + sell_precision)/2 - 0.25 * |buy_precision - sell_precision| find out why despite everything we underfitted?

I did manage to overfit on a single batch of data; however, based on the scaling laws paper, I tried to do 1 epoch with proportionate maximum parameters that I can efficiently fit into the 80GB VRAM of an A100 GPU or 2*40GB VRAM of A100 depending of availability.

reference paper: https://arxiv.org/pdf/2103.14438 Gated Transformer Networks for Multivariate Time Series Classification

── more in #machine-learning 4 stories · sorted by recency
── more on @gated transformer network 3 stories trending now
sponsored brought to you by zahid.host 4,200+ EU-deployed projects
reading about agents? ship yours in a single git push.

Run your AI side-project on zahid.host

EU-based hosting, git-push deploys, automatic HTTPS, no cold starts. Free tier with a custom domain — perfect for shipping the agent you just read about.

$git push zahid main
Live at https://your-agent.zahid.host
Get free account → Pricing
from €0/mo · no card required
LIVE [news/financial-market-ana…] indexed:0 read:1min 2026-07-10 ·