Display VaR per Symbol as opposed to the Entire Portfolio

MQL5 Indicadores Asesores Expertos

Trabajo finalizado

Plazo de ejecución 11 días
Comentario del Cliente
Was flexible and able to solve a difficult task. I appreciate his patience and hard work throughout this project :)
Comentario del Ejecutor
Super client

Tarea técnica

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";      // Symbol - Other
input    string      symbol2          = "XAUUSD";    // Symbol 2 - Other
input    string      symbol3          = "AUDCAD";    // Symbol 3 - Forex
input    string      symbol4          = "AUDUSD";    // Symbol 4 - Forex
input    string      symbol5          = "AUDNZD";    // Symbol 5 - Forex
input    string      symbol6          = "EURUSD";    // Symbol 6 - Forex
input    string      symbol7          = "EURGBP";    // Symbol 7 - Forex
input    string      symbol8          = "USDCHF";    // Symbol 8 - Forex
input    string      symbol9          = "USDCAD";    // Symbol 9 - Forex
input    string      symbol10          = "GBPCHF";    // Symbol 10 - Forex

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

  // Portfolio Weighting 
  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.



Han respondido

1
Desarrollador 1
Evaluación
(15)
Proyectos
34
24%
Arbitraje
3
0% / 33%
Caducado
2
6%
Trabaja
2
Desarrollador 2
Evaluación
(7)
Proyectos
7
29%
Arbitraje
3
0% / 100%
Caducado
1
14%
Libre
Solicitudes similares
to compile all the suitable markets for buy and place a buy for the shortest timeframe and place a sell for also a shortest timeframe it should work with all brokers and can automatically place a trade as long as its connected to the internet it should inform where the contracts are placed and for how long
XAUUSD Scalper M1 30 - 100 USD
I want XAUUSD scalping bot it works on strong support and resistance.Put pending BUY SELL orders at S&R levels. Adding some basic inputs TP,SL,Trailing.If you have similar EA share demo file in personal chat.if results satisfy with my expectations i will proceed with same EA any modifications if required
1 indicator SATV Final Work a. Symbol Name b. If Last Candle is Blue Then scanner Box Colour is Blue If Last Candle is RED Then Scanner Box colour is RED c. Live Price d. IF price is cross strong Buy or strong sell showing only For Buy/Sell and Candle low / High showing price 2 Bhav Copy Input field for 1-12 month If I want 5 Month back open Bhav & 1 Year 3 Moving Average Average Line price If Live price below to
It's a ninjacators.com indicator they offered at one time but no longer appears on their website. It's called the "Emini Predictive Trader" - based on tracking the three major indices - NYSE, DOW30, and NASDAQ - and suggests long or short entries if/when all three indices "agree". Would work well to trade the S&P500. I copied their original pitch page while it was up, along with the video that was on it. I'll attach
i NEED SOMEONE WHO CAN HELP ME CREATE A BOT THAT EXECUTE AND CLOSE TRADE AUTOMATICALLY ONLY FOR GOLD (XAUUSD) . A BOT THAT DOES NOT TRADE THE NEWS BUT ONLY TAKE TRADE ON ITS OWN AUTOMATICALLYON A NORMAL TRADING DAYS , I DONT MIND IF YOU ALREADY HAVE ONE THAT YOU ALREADY CREATED BUT TRUST AND HAVE A GOOD PERCENTAGE WIN RATE . I WANTS A BOT THAT USES (SL & TP) ON ITS OWN , OPENING AND CLOSES TRADE AUTOMATICALLY WITHOUT
Busco programador para crear un bot de trading automático. El bot operará en opciones binarias en Nadex, basado en la relación entre dos índices. La estrategia completa será entregada por privado al programador que acepte el trabajo. Requisitos: • Operación automática con delay configurable. • Entrada basada en datos de otro activo. • Personalizable en cantidad, expiración y lógica. • Código fuente incluido
Hello, I'm currently seeking a skilled and reliable MQL4 developer to assist in modifying and enhancing my Expert Advisor, Reversal Master V10.1 , to its next version V12.1 FF . This update involves integrating several advanced third-party indicators and implementing new trading logic based on clearly defined conditions to improve performance and strategy precision. If you have experience in EA development and enjoy
Hello, I'm currently seeking a skilled and reliable MQL4 developer to assist in modifying and enhancing my Expert Advisor, Reversal Master V10.1 , to its next version V12.1 FF . This update involves integrating several advanced third-party indicators and implementing new trading logic based on clearly defined conditions to improve performance and strategy precision. If you have experience in EA development and enjoy
Project Description: I am looking for a highly skilled MQL5 developer to create a robust solution for a persistent TLS handshake failure. My Expert Advisor (EA) needs to connect to a secure WebSocket server ( wss:// ) hosted on Railway.app or any other online websocket provider, but the connection consistently fails during the security negotiation phase. Ideal Candidate Skills: Deep expertise in MQL5 programming
I need an experienced developer to convert my MT4 EA based on the Super Trend indicator to MT5. The new EA should also include additional features. Essential modifications: - Incorporate additional indicators: Moving Average and PSAR. - Add custom alerts: Push and sound notifications. - Implement money management rules

Información sobre el proyecto

Presupuesto
50+ USD
Para el ejecutor
45 USD