Spezifikation
Project Description:
I am looking for an experienced developer to build a breakout box trading algorithm designed for futures trading, specifically for the 6J (Japanese Yen) contract.
The system must be built with prop firm trading rules in mind (fixed risk, limited drawdown, no overnight exposure) and structured for Tradovate-style workflow — clean session logic, pending breakout orders, and strict time-based trade management.
The code can be developed in MQL5 (MT5), but the logic should be compatible with futures data and easily adaptable to other contracts (e.g., 6E, ES, NQ, CL).
Strategy Logic (Detailed Requirements):
1️⃣ Box Formation (Range Detection)
-
Define a custom time window (user inputs: Box Start Time, Box End Time).
-
During that window, the system must:
-
Detect the highest high and lowest low of all bars within the time range.
-
Draw a visible box on the chart marking that range (with user-defined color and transparency).
-
Save these high/low values for trade setup calculations.
-
-
The “box” represents the pre-breakout consolidation zone.
2️⃣ Pending Order Placement (Breakout Setup)
-
Immediately after the box window ends:
-
Place a Buy Stop Order a few ticks above the box high.
-
Place a Sell Stop Order a few ticks below the box low.
-
Both offset distances should be user inputs (e.g., BufferTicksAbove / BufferTicksBelow ).
-
-
These orders should remain pending until triggered or canceled by time/logic conditions.
-
Once one order is activated, the other pending order must be automatically canceled to avoid opposing positions.
3️⃣ Stop Loss and Position Sizing
-
A Stop Loss must be placed on the opposite side of the box:
-
For a buy trade → SL = box low.
-
For a sell trade → SL = box high.
-
-
The bot should automatically calculate position size based on:
-
User-defined risk percentage of account balance (e.g., 1%).
-
The tick value and box size (in ticks).
-
-
Position sizing should ensure that the maximum loss equals the defined risk percentage.
-
Option for manual lot override if the user prefers fixed volume.
4️⃣ Trade Management
-
No Take Profit by default — trades should run without a fixed profit target to capture strong directional moves.
-
Include option for:
-
Trailing Stop (user can enable/disable and define trailing distance or step in ticks).
-
Break-even trigger (optional input: move SL to entry after X ticks in profit).
-
-
Only one active position at a time (no hedging, no scaling, no pyramiding).
5️⃣ Time-Based Trade Closure
-
At a specified “Close Time” (user input, e.g., 15:00 CST):
-
Automatically close all open trades (regardless of profit/loss).
-
Delete all pending orders.
-
This ensures no positions remain open overnight (prop firm compliance).
-
6️⃣ Market Filters and Safety Conditions
-
Minimum and Maximum Box Size Filters:
-
Skip trade if box height < MinBoxSizeTicks (too tight – likely false breakout).
-
Skip trade if box height > MaxBoxSizeTicks (too wide – excessive risk).
-
-
Time Filters:
-
Optional setting to disable trading on certain weekdays (e.g., no trades on Fridays).
-
-
News Filter (optional):
-
Skip new setups during scheduled high-impact news times (user input or news calendar integration if supported).
-
-
Volatility Check (optional):
-
Skip trades if average true range (ATR) during box period exceeds user-defined threshold.
-