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
I am looking for an experienced MQL5 developer or development team to build a scalable Telegram-to-MT5 copy trading system. The main purpose of the system is to monitor trading signals from my Telegram channel and automatically execute those signals on connected client MT5 accounts. Core Requirements Receive and parse trading signals from Telegram Automatically execute trades on connected MT5 accounts Support more
Hi, I’m looking to develop a custom XAUUSD (Gold) trading EA for MT5. I initially wanted to get an EA, but I don’t currently have a specific trading strategy. I would like help developing a suitable strategy from scratch and then converting it into a fully automated MT5 EA. My account size will be around $1,000. I’m interested in a scalping strategy that can trade during both the London and New York sessions. My main
I've built the bot as a single-page app that runs the three-step workflow you described. Since the page can't pull live broker data, it runs on simulated 5-minute candles or on a CSV you paste in.I've published the trading bot page. I haven't opened or run it, so I can't confirm the logic behaves as intended. It runs on simulated 5-minute candles (or a CSV you paste in) and builds the 4H and 30M charts from them. How
Title: Custom M5 Gold (XAUUSD Cent) Scalper EA with Daily Profit Target and Strict Risk Control 1. OVERVIEW & OBJECTIVE We need an Expert Advisor (EA) developed for MT4 and MT5 to trade XAU/USD Cent (XAUUSDc on HFM / HF Markets). The EA must operate fully autonomously on M5 charts, targeting micro-pips (3 to 5 cent movements) per trade. The core philosophy is "set-and-forget" with absolute risk protection to prevent
Hello, I want to develop a custom MT5 Expert Advisor (EA) for XAUUSD Gold. IMPORTANT: I want a proper rule-based automated trading EA, NOT a martingale, grid or guaranteed-profit bot. 1. MARKET & TIMEFRAME - Platform: MT5 - Symbol: XAUUSD only - Main trend timeframe: M15 - Entry timeframe: M5 - Must support broker suffixes such as XAUUSDm, XAUUSD., etc. 2. TREND RULE BUY trend: - M15 price above EMA 50 - EMA 50 above
Hi, I’m looking for a **ready-made MT5 scalping EA specifically for Gold (XAUUSD)**. My main requirement is an **HTF scalping strategy**, so I’m looking for an existing robot that is already developed and can be tested before I make the purchase. I’m not looking to build one from scratch at this stage. I would like to first test the EA on a **demo account** to see how it performs under live market conditions and
Are you able to build one bot for stock and one for ninja trader and tell me the win rate on it. I need ninja trader bot that enter buy and exit according the move to do not stay long in the market in each entry . That can follow the smart money concept or other if you have a good one
custom color candle logic understand programmer need for this job... first understand logic and interested please message .... 1-candle color green and hh for buy, candle color red ll for sell so candle color and hh or ll must match to place order... below color candle entry logic see in (ea input settings) previous candle (low or high) for stop pending order with some pips high or low in input settings 2-orders
READ CAREFULLY BEFORE APPLY Hi there I am in need of a well automated and reliable ready made expert advisor scalper ea that run perfectly across trending market conditions, I mean a profitable strategy must perform optimally and yield massive trading returns, I am looking forward to validate a well working ea as per my specifications here, you must provide both screenshot and videos of the HFT scalper ea running on
Hi there I need an developer to create a ea for mt5 and mt4 but the ea should be an fast connect ea meaning by taping the ea then automatically it connect to mt5 chart same in mt4 It should place order using invisible buy and invisible sell when the bid price breakout in 1 point Automatically it place an order depends on which direction and invisible stop loss in points , please reply if you can