The code that has been provided calculates the value at risk for the entire portfolio (opened trades on MT5). I would like to understand what this comprises of on a per Symbol basis.
1) Calculate the Value at Risk for Each of the 10 Symbols (for Buy & Sells) and then for the Whole Symbol:
Line 51 of Account Manager Part 1:
input string CHART_MANAGEMNET1= "====== CHART MANAGEMENT ======";
input string symbol1 = "US30";
input string symbol2 = "XAUUSD";
input string symbol3 = "AUDCAD";
input string symbol4 = "AUDUSD";
input string symbol5 = "AUDNZD";
input string symbol6 = "EURUSD";
input string symbol7 = "EURGBP";
input string symbol8 = "USDCHF";
input string symbol9 = "USDCAD";
input string symbol10 = "GBPCHF";
Suggested Process:
//Calculate the Value at Risk for Buy & Sell Side - Note Repeat Process fro Symbols 2 - 10
/*
double ValueAtRiskB1
double ValueAtRiskS1
//Used to Calculate the Total Value at Risk of the Symbol - Note Repeat the Process for Symbols 2 - 10
if((ValueAtRiskB1 - ValueAtRiskS1) > 0)
{
double ValueAtRisk1 = (ValueAtRiskB1 - ValueAtRiskS1)
}
else
{
double ValueAtRisk1 = (ValueAtRiskB1 - ValueAtRiskS1)*-1
}
2) Show the Relevant Weightings of the Currently Open Trades (in terms of Value at Risk):
Divide the current Value at Risk of the Symbol by the Total Value at Risk & Convert to a Percentage
Line 173 of Account Manager Part 1
double Weighting1 = ValueAtRisk1/currValueAtRisk
double Weighting2 = ValueAtRisk2/currValueAtRisk
double Weighting3 = ValueAtRisk3/currValueAtRisk
double Weighting4 = ValueAtRisk4/currValueAtRisk
double Weighting5 = ValueAtRisk5/currValueAtRisk
double Weighting6 = ValueAtRisk6/currValueAtRisk
double Weighting7 = ValueAtRisk7/currValueAtRisk
double Weighting8 = ValueAtRisk8/currValueAtRisk
double Weighting9 = ValueAtRisk9/currValueAtRisk
double Weighting10 = ValueAtRisk10/currValueAtRisk
3) Display Information in Dashboard:
Comment(
" RISK MANAGEMENT: ", "\n\n",
"Symbol 1: VaR: " + DoubleToString(ValueAtRisk1, 2) + "Weighting:" + DoubleToString(Weighting1, 2) + "\n\n",
"Symbol 2: VaR: " + DoubleToString(ValueAtRisk2, 2) + "Weighting:" + DoubleToString(Weighting2, 2) + "\n\n",
"Symbol 3: VaR: " + DoubleToString(ValueAtRisk3, 2) + "Weighting:" + DoubleToString(Weighting3, 2) + "\n\n",
"Symbol 4: VaR: " + DoubleToString(ValueAtRisk4, 2) + "Weighting:" + DoubleToString(Weighting4, 2) + "\n\n",
"Symbol 5: VaR: " + DoubleToString(ValueAtRisk5, 2) + "Weighting:" + DoubleToString(Weighting5, 2) + "\n\n",
"Symbol 6: VaR: " + DoubleToString(ValueAtRisk6, 2) + "Weighting:" + DoubleToString(Weighting6, 2) + "\n\n",
"Symbol 7: VaR: " + DoubleToString(ValueAtRisk7, 2) + "Weighting:" + DoubleToString(Weighting7, 2) + "\n\n",
"Symbol 8: VaR: " + DoubleToString(ValueAtRisk8, 2) + "Weighting:" + DoubleToString(Weighting8, 2) + "\n\n",
"Symbol 9: VaR: " + DoubleToString(ValueAtRisk9, 2) + "Weighting:" + DoubleToString(Weighting9, 2) + "\n\n",
"Symbol 10: VaR: " + DoubleToString(ValueAtRisk10, 2) + "Weighting:" + DoubleToString(Weighting10, 2) + "\n\n",
"Total Value at Risk: $" + DoubleToString(currValueAtRisk, 2) + "\n\n",
"Standard Deviation: " + DoubleToString(currportfolioStdDev, 6) + "\n\n"
);
Note: Account Manager Part 2 - will likely need to be adapted. To fetch values from it make these values a double in the following code (this worked beforehand).
class CPortfolioRiskMan
{
public:
double portfolioStdDev;
double MultiPositionVaR;
Make sure to add the MPH file in the includes folder for decompiling.
Solicitudes similares
A lightweight MT5 chart overlay displaying total floating P&L, average entry price, combined lot size, and current symbol exposure as a percentage of account balance, all updating in real time with color-coded profit/loss indicators, delivered with clean object-oriented source code and no DLL dependencies
Hello Developers, I am looking for an experienced MQL5 developer to complete the development of a custom MetaTrader 5 Expert Advisor (EA) based on my proprietary trading strategy. I already have a partially developed EA that includes the required custom indicators and part of the trading logic. The project can either be completed by modifying the existing EA or, if more appropriate, by rebuilding it from scratch
Hello Developers, I want to build a custom Expert Advisor (EA) for MetaTrader 5 (MT5) to trade Gold (XAUUSD) and Bitcoin (BTCUSD). This will be based on my own custom strategy. Here are the project requirements: 1. Platform: MetaTrader 5 (MQL5) 2. Trading Assets: Gold (XAUUSD) and Bitcoin (BTCUSD) 3. Timeframe: Suitable for multi-timeframe execution (I will specify the exact timeframes in private chat) 4. Core
Požadavky: platforma MetaTrader 5, jazyk MQL5; předání úplného a čitelného zdrojového kódu .mq5 a všech potřebných .mqh souborů; zákazů knihoven, DLL, vzdálených serverů a externí licenční kontroly; zákaz martingale, gridu, navyšování pozice po ztrátě a obchodování bez stop-lossu; výpočet velikosti pozice podle procenta rizika a skutečné měny účtu; nastavitelné maximální denní riziko a celkové čerpání; ochrana proti
I will pay 10k (negotiable) for an EA for existing MT5 that generates a minimum of 5% or higher a month consistently Please send demo version with optimal settings so I can test, if it performs in a strategy tester i will also need option to forward test it in a demo account. You will provide me with the.ex5 file with an expiration of 1 week, so that I can test the EA first on demo account. Developer should be
I am looking for a profitable daily trading system. It can trade any pair of the following, Gold, EURUSD,GBPUSD so either of these three pairs. If it does trade other pairs and is very profitable then send proof. The system shouldnt be a risky system like a blind martingale. It needs to trade everyday and be profitable. It shouldnt be spread sensitive. Ideally i need the system on MT5 but if its on mt4 i can accept
The Great Martingale and Classic Martingale will be coded selectively in one . The Coder should know well both of Great and Classic Martingale and calculation of both of their lot sizing. Should understand the below Formulas of lot sizing after one loss or consecutive loses. if not understand the below please do not apply . A different trailing stop which calculates all profits/losses in a serie will be applied
Our advanced automated trading robot is designed to analyze the financial markets and execute trades without requiring constant manual intervention. Using intelligent algorithms, it monitors market trends, price movements, and technical indicators in real time to identify potential trading opportunities. The robot automatically opens, manages, and closes trades based on its predefined strategy, helping to remove
Description: I need an experienced MQL5 developer to build a professional MT5 Expert Advisor for XAU/USD based on my trading strategy. I require the full .mq5 source code and the compiled file. Trading Logic: Timeframes: H4 to determine overall direction, H1 for supply and demand zones, M15 for trade entries. Buy conditions: H4 trend is bullish, price reaches a valid H1 demand zone, liquidity sweep occurs below the
I'm looking for an experienced Python developer with a strong understanding of market microstructure, order flow, and electronic trading to help build a research-driven gold trading system. This is not a typical indicator or retail trading bot. The project focuses on analysing COMEX Gold Futures Market-by-Order (MBO) data to detect institutional order-flow behaviour and generate trading signals for XAUUSD (MetaTrader