Trabajo finalizado


Tarea técnica
I've converted some of the code provided in this video: Coding Incremental VaR in MQL4 and MQL5 for Better Trading Risk Management | Free Code Download
The purpose of this code is to display the Value at Risk (in dollars of the entire portfolio) and Standard Deviation of Returns.
he code was provided through the following GitHub Source: https://github.com/darwinex/advanced-mql-programming/tree/master/risk-man/incremental-var
Changes I have made to the code:
- Converted it from a Script to an Expert Advisor
- Replaced some of the code so that it dynamically measures the VAR for Current Open Positions Positions as Opposed to FIXED Positions.
Next Steps:
- Watch the video (or from 8:30 onwards), after watching this you will have some context. The issue that I am having is for the current live open positions the VaR is increasing irrespective on whether it is a Buy or Opposing Sell (note as you will notice in the demonstration of the video, these positions will cancel each other out).
Outcome 1):
I need the live trades on the account to equal the exact same VAR value as the predetermined code.
For example:
If the FIXED code specifies:
{"AUDCAD","EURGBP","USDCAD"} { 0.1, - 0.1, 0.1}
Then if the VAR is $98 in the FIXED code then it should be the exact same value if I opened those positions and compared it to the Dynamic EA.
Outcome 2):
I need to be able to fetch the Standard Deviation of the Portfolio in the Expert Advisor code and display this in the EA (note this code is available in the mph file).
If more context is needed on Portfolio Standard Deviation then watch this video: MQL5 Coding Tutorial for Portfolio Std Deviation and VaR for MT5
Note: Load the MPH file in your Includes Folder, Value at Risk - FIXED is a Script & Value at Risk - Dynamic is an EA.
What I need is Value at Risk - Dynamic edited, the other code provide is just for assistance.