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
Overview: I am looking for an experienced MQL5 developer to build an advanced Expert Advisor (EA) for MetaTrader 5. The EA must parse trading signals from Telegram channels and execute them automatically on MT5 with high accuracy and low latency. Key Requirements & Custom Features: Multi-Channel Support (2 Telegram Channels): The EA must be able to listen to two different Telegram channels simultaneously. Independent
Ich möchte einen professionellen Expert Advisor (EA) für MetaTrader 5 entwickeln lassen, der sich funktional am ThunderGold Scalper orientiert. Instrument: XAUUSD / GOLD Zeitrahmen: M15 Plattform: MetaTrader 5 / MQL5 Der EA soll eine eigene, nachprogrammierte Strategie verwenden und keine geschützten Quellcodes oder proprietären Dateien des Originalprodukts kopieren. Gewünschte Funktionen: automatischer Handel auf
I need a fully automated Expert Advisor (EA) written in MQL5 for MetaTrader 5. The EA must work directly inside MT5 and must NOT require TradingView, PineConnector, webhooks, or another external connector to place trades. Trading Instrument Primary symbol: XAGUSD (Silver) My broker may display the symbol as XAGUSD-ECN, so the EA should work with the broker’s available XAGUSD symbol. Main entry timeframe: 5-minute
RECHERCHE DÉVELOPPEUR MQL5 — PARTENARIAT 50/50 Objectif : développer un EA de trading automatisé en 11 jours maximum pour participer à plusieurs concours de trading démo. Je recherche un développeur MQL5 expérimenté, capable de développer, tester et optimiser un EA proprement, avec une vraie maîtrise de la gestion du risque. CONCOURS VISÉS 🥇 XM — Weekly Demo Contest - Concours récurrent - Prize pool annoncé : 25 000
I need a EA programer to program my EA for MLQ5 to sell at the last candle before impulses to the downside(-) and buy on the last candle before the upside(+) movement. For the take profit we target the nearest high for buy and target nearest low for sell.Stop loss on the last weak of the order block
//+------------------------------------------------------------------+ //| XAUUSD Wolfe + SMC Quick Profit EA | //| MT5 / MQL5 | //+------------------------------------------------------------------+ #property strict #include <Trade/Trade.mqh> CTrade trade; //================================================================== // INPUTS //================================================================== //--- General
can you help me with I have an indicator that I built and I work with PickMyTrade. The entries come through the alerts I get from Trading View . Trading View needs to send an alert and PickMyTrade executes a trade at that exact same second. Now, I have a problem in Trading View with the synchronization between the alert and the signal. I have a box that I built for a trade. It needs to output the box and get an
Key Technical Specifications Platform & Engine: Native MetaTrader 5 (MQL5) using CTrade execution class. Trading Strategy: Dual-directional breakout grid strategy featuring dynamic price validation and overall equity trailing stops. Order Capacity: 70 total pending orders max (35 Buy grid levels, 35 Sell grid levels). Core Features & Execution Rules Feature Specification Details Price Direction Guard Automatically
Buying profitable EA Budget up to 1.5k (Serious offer) Specification EN I will pay 1.5k (negotiable) for an EA for existing MT4 that generates a minimum of 5% or higher a month consistently no monthly DD more than 5% on ,5k account 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. Developer should be willing
I need an MT4 Expert Advisor (MQL4). 1. Open one Buy and one Sell trade simultaneously. 2. Adjustable lot size (default 0.01). 3. Stop Loss on both trades. 4. If one trade hits Stop Loss: - Do not open a replacement trade. - Leave the remaining trade open. 5. Optional trailing stop: - On/Off switch. - Adjustable distance. 6. When the remaining trade closes: - Open a new Buy and Sell pair. - Repeat continuously