137 lines
3.7 KiB
Markdown
137 lines
3.7 KiB
Markdown
# Position Planning Tool for MQL5
|
|
|
|
A visual position planning tool for MetaTrader 5 that helps traders evaluate a proposed trade directly on the chart before execution.
|
|
|
|
The tool uses interactive Entry, Stop-Loss, and Take-Profit levels to calculate risk, estimated position size, potential reward, and risk-to-reward in real time.
|
|
|
|
## Features
|
|
|
|
* ATR-based initial placement of Entry, Stop-Loss, and Take-Profit levels
|
|
* Interactive chart lines for adjusting planned price levels
|
|
* Support for:
|
|
|
|
* Buy Market
|
|
* Sell Market
|
|
* Buy Limit
|
|
* Sell Limit
|
|
* Buy Stop
|
|
* Sell Stop
|
|
* BUY and SELL setup validation
|
|
* Stop-Loss distance calculation
|
|
* Configurable account risk percentage
|
|
* Monetary risk estimation
|
|
* Symbol-aware position-size estimation
|
|
* Potential reward calculation
|
|
* Risk-to-reward calculation
|
|
* Live dashboard updates
|
|
* Automatic market Entry synchronization with Bid or Ask
|
|
* Chart object cleanup when the EA is removed
|
|
|
|
## Purpose
|
|
|
|
The Position Planning Tool is designed for **pre-trade analysis**.
|
|
|
|
It helps answer questions such as:
|
|
|
|
* Where should Entry, Stop-Loss, and Take-Profit be positioned?
|
|
* How many points are being risked?
|
|
* How much account balance is being risked?
|
|
* What position size corresponds to that risk?
|
|
* What is the potential monetary reward?
|
|
* What is the resulting risk-to-reward ratio?
|
|
|
|
The tool does **not** execute, modify, or close trades.
|
|
|
|
## How It Works
|
|
|
|
When the EA is attached to a chart, it initializes Entry, Stop-Loss, and Take-Profit using the current market price and ATR-based distances.
|
|
|
|
For market scenarios, Entry follows the current Ask price for BUY plans and the current Bid price for SELL plans.
|
|
|
|
For pending scenarios, the Entry line can be adjusted manually together with Stop-Loss and Take-Profit.
|
|
|
|
Whenever the planning levels change, the tool validates the setup and recalculates the displayed metrics.
|
|
|
|
## Dashboard
|
|
|
|
The dashboard displays:
|
|
|
|
* Symbol
|
|
* Order Type
|
|
* Direction
|
|
* Entry
|
|
* Stop-Loss
|
|
* Take-Profit
|
|
* Stop-Loss Points
|
|
* Take-Profit Points
|
|
* Risk Percentage
|
|
* Risk Money
|
|
* Estimated Reward
|
|
* Estimated Position Size
|
|
* Risk-to-Reward
|
|
* Setup Status
|
|
|
|
## Inputs
|
|
|
|
The main configurable inputs include:
|
|
|
|
* planning order type
|
|
* risk percentage
|
|
* ATR timeframe
|
|
* ATR period
|
|
* Stop-Loss ATR multiplier
|
|
* Take-Profit ATR multiplier
|
|
* Entry line color
|
|
* Stop-Loss line color
|
|
* Take-Profit line color
|
|
|
|
## Installation
|
|
|
|
1. Copy `PositionPlanningTool.mq5` into:
|
|
|
|
`MQL5/Experts/`
|
|
|
|
2. Open the file in MetaEditor.
|
|
|
|
3. Apply the MetaQuotes Styler if required.
|
|
|
|
4. Compile the EA.
|
|
|
|
5. Return to MetaTrader 5 and refresh the Expert Advisors list.
|
|
|
|
6. Attach `PositionPlanningTool` to a chart.
|
|
|
|
7. Select the required planning order type and risk settings.
|
|
|
|
8. Adjust the planning lines and observe the dashboard calculations.
|
|
|
|
## Project File
|
|
|
|
```text
|
|
PositionPlanningTool.mq5
|
|
```
|
|
|
|
The EA is self-contained and does not require additional include files, libraries, or external resources.
|
|
|
|
## Article
|
|
|
|
This project accompanies the MQL5 article:
|
|
|
|
**Building a Visual Position Planning Tool in MQL5**
|
|
|
|
The article explains the implementation progressively, including ATR-based initialization, interactive planning lines, setup validation, risk calculation, position-size estimation, reward analysis, and dashboard integration.
|
|
|
|
**Article link:**
|
|
`[https://www.mql5.com/en/articles/23970]`
|
|
|
|
## Important Limitation
|
|
|
|
This project is a planning and analysis tool only.
|
|
|
|
**It evaluates a planned position but does not execute trades.**
|
|
|
|
Always verify the calculated values against the trading conditions of the symbol and broker before making trading decisions.
|
|
|
|
## License
|
|
|
|
Use, study, and modify the source code in accordance with the license and publication terms applicable to this repository and the accompanying MQL5 article.
|