Skip to content

Commit ccd4654

Browse files
committed
Add initial VisualRiskCalculator source code
0 parents  commit ccd4654

File tree

9 files changed

+526
-0
lines changed

9 files changed

+526
-0
lines changed

.DS_Store

6 KB
Binary file not shown.

.github/.DS_Store

6 KB
Binary file not shown.

.github/assets/panel_update.gif

16 MB
Loading
17.1 MB
Loading
14.4 MB
Loading

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
*.ex5
2+
*.ex4

LICENSE

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2025 arnaudrmt
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

README.md

Lines changed: 86 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,86 @@
1+
<div align="center">
2+
3+
![VisualRiskCalc Banner](https://placehold.co/800x200/2C3E50/FFFFFF?text=VisualRiskCalculator&font=montserrat)
4+
5+
![MetaTrader 5](https://img.shields.io/badge/MetaTrader-5-green?logo=metatrader&logoColor=white)
6+
![MQL5](https://img.shields.io/badge/Language-MQL5-blue)
7+
![License](https://img.shields.io/badge/License-MIT-yellow?logo=opensourceinitiative)
8+
9+
</div>
10+
11+
> ⚠️ **Setup & Requirement Notice**
12+
>
13+
> VisualRiskCalculator is an **Expert Advisor (EA)** for **MetaTrader 5**.
14+
>
15+
> **Algo Trading Required:** For the drag-and-drop features and trade execution to work, you must enable the **"Algo Trading"** button in your MT5 toolbar.
16+
>
17+
> **Account Compatibility:** This tool works with both **Netting** and **Hedging** accounts. It automatically detects your account currency (e.g., trading EURUSD on a JPY account) and handles all conversion math instantly.
18+
19+
This utility is built on a simple philosophy: **Stop calculating. Start trading.** It eliminates the need for external calculators or mental math by integrating risk management directly into the visual chart experience.
20+
21+
---
22+
23+
## How to Install
24+
25+
This follows the standard installation process for any MetaTrader Expert Advisor.
26+
27+
1. **Download** the `VisualRiskCalc.mq5` file from this repository.
28+
2. Open **MetaTrader 5**.
29+
3. Go to **File** -> **Open Data Folder**.
30+
4. Navigate to the `MQL5` folder, then open the `Experts` folder.
31+
5. **Copy and Paste** the `VisualRiskCalc.mq5` file into this folder.
32+
6. Go back to MetaTrader 5, right-click on the **Navigator** panel (usually on the left), and click **Refresh**. The EA will appear under the "Expert Advisors" list.
33+
34+
---
35+
36+
## Showcase: The Tool in Action
37+
38+
VisualRiskCalc provides a fluid, Visual interface for trade management. Here is how it improves your workflow.
39+
40+
| Feature Showcase | Description |
41+
| :--------------------------------------------------------- | :-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
42+
| ![Drag Showcase](.github/assets/price_line_dragging.gif) | **Seamless Drag-and-Drop**: A red "handle" arrow sits on the current price line. simply click and drag it to your desired Stop Loss level. The tool automatically detects if you are going Short or Long based on where you drag. |
43+
| ![RealTime Showcase](.github/assets/panel_update.gif) | **Real-Time Calculation**: As you move your mouse, the panel updates instantly. It calculates the exact **Lot Size** needed to risk your specific percentage, converts currency rates, and projects the Pip distance. |
44+
| ![Execution Showcase](.github/assets/take_profit_line.gif) | **Smart Execution**: The tool draws a dynamic **Take Profit** line (default 1:2) that moves with you. When you are ready, the "WAITING" button turns into a **BUY** or **SELL** button. One click executes the trade and cleans up the chart. |
45+
46+
---
47+
48+
## Configuration & Usage
49+
50+
### 1. The Workflow
51+
52+
Forget opening calculator apps. The process is entirely visual.
53+
54+
1. **Grab the Handle:** Look for the red arrow on the current price axis.
55+
2. **Drag to SL:** Pull it to where your Stop Loss should be. The tool activates immediately.
56+
3. **Adjust:** You can tweak the **Risk %** or **R:R Ratio** in the panel while the lines are active; the lines and math will update instantly.
57+
4. **Execute:** Click the large colored button at the bottom to place the order.
58+
59+
### 2. Input Parameters
60+
61+
You can configure the defaults when you first load the EA onto the chart.
62+
63+
| Parameter | Default | Description |
64+
| :--------------- | :------------- | :------------------------------------------------------------------------------------------------------------------------ |
65+
| `DefRiskPercent` | `1.0` | The default percentage of your Account Balance you are willing to lose on a trade. |
66+
| `DefRewardRatio` | `2.0` | The default Risk-to-Reward ratio. `2.0` sets the Take Profit at 2x the distance of the Stop Loss. |
67+
| `PanelYOffset` | `60` | How far down (in pixels) the panel sits from the top of the chart. Useful if you have other indicators in the top corner. |
68+
| `ThemeColor` | `MidnightBlue` | The background color of the control panel. |
69+
70+
### 3. The Panel Interface
71+
72+
The on-chart GUI gives you full control without navigating menus.
73+
74+
- **Risk % Field:** Change this to `0.5`, `2.0`, etc., to resize your position instantly.
75+
- **Reward Field:** Change this to `3.0` to extend your Take Profit line further out.
76+
- **Reset Button:** Cancels the current analysis, removes the lines, and resets the tool to the "Passive" state (waiting for you to drag the handle again).
77+
78+
---
79+
80+
## Features
81+
82+
- **Zero Dependencies:** Uses standard MQL5 libraries (`Trade.mqh`) included with every MT5 installation.
83+
- **Dynamic Stop Loss:** Dragging the SL line automatically adjusts the TP line to maintain your R:R ratio.
84+
- **Smart Direction:** Automatically detects **Long (Buy)** vs **Short (Sell)** based on whether the Stop Loss is below or above the current price.
85+
- **Currency Normalization:** Automatically handles `TickValue` and `Point` calculations for Forex, Indices, or Crypto (depending on broker data).
86+
- **Lot Normalization:** Automatically rounds lot sizes to the broker's `Step` value (e.g., 0.01 or 0.1) and adheres to Min/Max volume limits.

0 commit comments

Comments
 (0)