Display VaR per Symbol as opposed to the Entire Portfolio

MQL5 Indicateurs Experts

Tâche terminée

Temps d'exécution 11 jours
Commentaires du client
Was flexible and able to solve a difficult task. I appreciate his patience and hard work throughout this project :)
Commentaires de l'employé
Super client

Spécifications

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.



Répondu

1
Développeur 1
Évaluation
(10)
Projets
25
28%
Arbitrage
1
0% / 0%
En retard
1
4%
Chargé
2
Développeur 2
Évaluation
(5)
Projets
5
40%
Arbitrage
1
0% / 100%
En retard
1
20%
Gratuit
Commandes similaires
Create a robot like this live on YouTube, it is a simple hedge system that does not have martingale or other risky means of.making money.... please check out the link and if it is possible for you to repeat this then reach out with a sample and price. YouTube: https://www.youtube.com/live/cT_42RWzq_0?si=Z8M5mKkAMGZhxdTL
Hi There I am looking for someone to create me a simple anti martingale EA The EA will open a buy and sell the moment the EA is attached to a chart. Should the price increase - additional buys will open. This will continue until profit point Should the price retrace all trades should close just before breakeven point. New sequence starts immediatly thereafter The sell trade will close if the combined profit of buys
Hi, I have a Live Data feature for my trading accounts that lets me check details like total open positions, number of lots, profits, etc. I need someone to add the number of pending orders to this live data. This is important for me to ensure that all accounts have the same number of pending orders, since I use a copy trading system. Please send me a message if you can handle this job. Thank you
Capable of Trading on all pears. Need a HFT EA with an %80 to %97 profit returns that may have a very very low with or without drawdown. It should have a good Gui panel showing statistics. It has to use candlestick pattern such as (pin bars, inside bar, engulfed bar)at a significant tuning point as a supply and demand zone. Always wait for retest before placing a stop order with the trailing stop loss on one
Job Description: We are seeking an experienced EA programmer to create an EA that utilizes SnR + Trendlines + Multi timeframe confluence Project Requirements: - Support and Resistance, Open Close levels/kissing candles/Rejection block, Support broken becomes Resistance(SbR), Resistance broken becomes Support(RbS), Quasimodo Levels, Asian Range, London Killzone, London Open, New York Killzone, New York Open
Job Description: We are seeking an experienced EA programmer to create an EA that utilizes SnR + Trendlines + Multi timeframe confluence Project Requirements: - Support and Resistance, Open Close levels/kissing candles/Rejection block, Support broken becomes Resistance(SbR), Resistance broken becomes Support(RbS), Quasimodo Levels, Asian Range, London Killzone, London Open, New York Killzone, New York Open
Starting from scratch, I need a solution to develop my own crypto trading and exchange platform. This platform should compare prices across various exchanges like Coinbase, Binance, KuCoin, and Unocoin, as well as different cryptocurrencies. The solution must identify opportunities to buy on one platform and sell on another for a profit, transferring funds to my personal wallet instantly for security. The bot should
Need EA programmer to create an MT4 EA that will be able to leverage trades in favour of the market direction ,the EA should be able to operate to any broker. The EA must trade on a clear trend not when the Market is ranging. More will be explained once your application has been accepted for the job
Hello I have my own candlestick pattern that I manually trade looking for someone who could automate it its based off visual seeing the candle and not math hopefully we could chat with each other and testing it rigorously to ensure its exactly like my system willing to pay 1k to 5k even 10 depending on how hard the job is... Thank You, Victor
Starting from scratch, I need a solution to develop my own crypto trading and exchange platform. This platform should compare prices across various exchanges like Coinbase, Binance, KuCoin, and Unocoin, as well as different cryptocurrencies. The solution must identify opportunities to buy on one platform and sell on another for a profit, transferring funds to my personal wallet instantly for security. The bot should

Informations sur le projet

Budget
50+ USD
Pour le développeur
45 USD