Total monetary risk piece of code

MQL4 Experts Scripts

Specification

* A function, which I could add to start() or ontick() of any EA that would give a Comment() which lists;

   - The total monetary risk of the account based on open positions

   - Should work with any pair, any broker, any number of digits

   - If even one position has no SL, the risk is unlimited.

   - If there are one or more positions, and all have a SL, then it should calculate the max risk based on number of lots/microlots etc. open given the stoploss values.

   - If certain positions offset each other in risk (for example, 0.10 lots up, 0.05 down on the same pair)

   - The calculation should be per-MT4-account, irrespective of what EA the code is attached to

   - The calculation should return a single result in USD$

Example:

Comment ("The maximum risk of the 4 current open positions (0.23 lots) is $403.44 USD, if all stoplosses were hit simultaneously.");

Where 4, 0.23 and 403.44 are variables.


There should also be an offset switch. Two examples for off/on of this switch:

USDJPY 0.10 long + 0.05 short. SL is set at $10 for first position, at $5 for second.

setting: offset=0: SL1 $10 + SL2 $5 = $15 risk (this maximum risk could only be triggered if price went up/down enough to hit both stoplosses)

setting: offset=1: SL1 $10 - $SL2 $5 (since there are two positions on the same pair) = $5 more realistic risk

Thanks

Responded

1
Developer 1
Rating
(4)
Projects
7
43%
Arbitration
5
0% / 60%
Overdue
3
43%
Free
2
Developer 2
Rating
(20)
Projects
43
30%
Arbitration
6
0% / 50%
Overdue
17
40%
Free
3
Developer 3
Rating
(30)
Projects
93
49%
Arbitration
18
56% / 17%
Overdue
38
41%
Free
4
Developer 4
Rating
(62)
Projects
140
46%
Arbitration
19
42% / 16%
Overdue
32
23%
Free
Similar orders
I need a Professional who can take my think or swim script and convert it to an equivalent ninja script indicator. i want it to function exactly in ninja as it does for TOS. end product should be an indicator with all the code visible that I can load onto my chart and I should see it performing live exactly the same way it does on TOS
Formal Software Request Software Title: High-Performance Automated Trading System Requestor: 80485848 Date: 19 August 2024 1. Introduction We seek a sophisticated automated trading system capable of executing trades across Forex, Gold, and Cryptocurrency markets. The primary objective is to achieve a high win rate while operating autonomously. 2. Core Requirements Win Rate: The system must demonstrate a
Hi, I have a Compiled JForex strategy (.jfx file) I would like someone to convert it in to readable source code. Please let me know if you can do this task. Thank you

Project information

Budget