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
//+------------------------------------------------------------------+ //| synthetic tick generator based on two assets | //+------------------------------------------------------------------+ class CSyntheticTickGenerator { private : string symbol_a; string symbol_b; string synth_name; double ratio; double last_price_a; double
# SNRZ BOT — SESSION PROGRESS LOG Last updated: 2026-09-16 (local late-evening session) ## SAN BOT (new — cloned from SNRZ) - `MQL5\Experts\AutomatedOrderBot_SAN.mq5` / `.ex5` — v1.0, compiled 0 errors/0 warnings - Signal source: custom indicator "SAN" (InpSANName, buy buf 0 / sell buf 1, target bar 1), same SNRZ-style read, MA fallback if missing - Magic number 234567 (separate from SNRZ 123456 so both bots can run
Multi-Asset EA (XAUUSD / FRA40) with Time Filters, High-Impact News Avoidance, Advanced Risk/Lot Sizing, and H1 Breakout Strategy 1. RISK SETTINGS * Max Daily Loss Limit: (bool) Toggle true/false. If true, input double for max loss in currency (e.g., $500). If hit, close all positions and stop trading until next day. * Lot Sizing Mode: Dropdown menu: 1. Fixed Lots (e.g. 0.10); 2. Percentage Risk (%) based on Account
Subject: Looking for an Experienced MQL Developer for Long-Term Collaboration (Mechanical Strategy) Hello everyone, I am reposting my request from last year. Due to work commitments, I couldn't dedicate time to this project back then, but now I am fully ready to move forward. I am looking for a highly experienced, verified MQL4/MQL5 programmer to automate my trading strategy. About the project: Rule-based &
Should be as it but no alarms, also we need to add a deep search so he can see all the preves candles and a memory function so its not slowing down the indicator. for higher time frames daily 4h 1h around 365 days and for lower time frames we do up to 20k bars but both flexible so i can change it later. the memory is important so the indicator is not always recalculating everything when a new candle shows especially
Creating a bot using the Parabolic indicator with a simple interface.. I want a bot that uses the Parabolic SAR indicator only, with these orders attached to it. Boot name : HEMIN .FX Magic number : 000000 …………………………………………………. Trade behavior : regular OR inverse OR only long "buy" OR only short "sell" Timeframe : ………… Period: ……… ………………………………………………….. Lot size : ……………… Break even in points : …
I am looking for an experienced MQL5 EA developer to develop an MT5 EA by the observable trading behaviour from a supplied live XAUUSD trade history . The EA appears to use a simple grid/recovery/hedging strategy with alternating BUY/SELL positions and progressive lot sizes. I need the developer to Develop the EA for MT5 / XAUUSD . Reproduce the observed entry, grid/add-on, recovery/hedging, lot progression and
Project: Fix & Schedule My Dual Fibo Standard Fibonacci Bot I have an existing MQ4 expert advisor called "Dual Fibo Standard Fibonacci". It needs to process 1,000 clients. Right now it runs blindly with no schedule and takes way too long. I need you to optimize it so it runs like a professional business with a 50-100 batch printed stamp copy progress log. Please reply with your numbers for this simple layout: * Phase
Yes. This screen is asking you to write the Requirements Specification for your Gold/XAUUSD trading robot. Since you want your DEEPTHINK X10 institutional-style MT5 system , use this ready-to-paste specification: DEEPTHINK X10 GOLD ROBOT – MT5 EXPERT ADVISOR REQUIREMENTS Develop an advanced MetaTrader 5 Expert Advisor (EA) for XAUUSD (Gold) scalping based on a multi-factor DEEPTHINK X10 trading framework. 1. MARKET -
Need an MQL5 Expert Advisor for MT5 that automates my manual trading strategy. Entry logic: Enter only when trend direction, support/resistance level, and RSI all align (Triple Confirmation). Extra confluence from Smart Money Concepts (order blocks, Fair Value Gaps, BOS/CHoCH). Risk rules: 1% risk per trade, minimum 1:2 risk-reward, stop-loss at structure levels (not fixed pips). Must-haves: Works on Islamic