Adding of Proposed vs Current Value at Risk Filter

MQL5 Indicadores Asesores Expertos

Trabajo finalizado

Plazo de ejecución 10 horas

Tarea técnica

Context: Watch the following video for an example usecase - https://www.youtube.com/watch?v=3FV8PTikKc0


What I have at the moment is an Expert Advisor that calculates the Total Value at Risk for Currently Open Symbols.

Outcome, a bool (true / false) variable that checks the symbol , lot size and assesses whether adding that trade would reduce the value at risk.

e.g. if Proposed Value at Risk < Current Value at risk then the variable is true.

Here is my attempt at this:

bool LowerVAR(string Symbol1, double Lotsize1)
{
    //string CurrPortAssets[]   = {symb1, symb2, symb3, symb4, symb5, symb6, symb7, symb8, symb9, symb10};
    //double CurrPortLotSizes[] = { SumLots(symb1), SumLots(symb2), SumLots(symb3), SumLots(symb4), SumLots(symb5), SumLots(symb6), SumLots(symb7), SumLots(symb8), SumLots(symb9), SumLots(symb10)};      
   string CurrPortAssets[];
   double CurrPortLotSizes[];
    
    CPortfolioRiskMan PortfolioRisk(InpVaRTimeframe, InpStdDevPeriods, InpCorrelPeriods);

    PortfolioRisk.CalculateIncrementalVaR(CurrPortAssets, CurrPortLotSizes);

    // CREATE PROPOSED POSITION ARRAY AND ADD PROPOSED POSITION
    string ProposedPortAssets[];
    double ProposedPorLotSizes[];
    ArrayResize(ProposedPortAssets, ArraySize(CurrPortAssets) + 1);
    ArrayResize(ProposedPorLotSizes, ArraySize(CurrPortLotSizes) + 1);

    ArrayCopy(ProposedPortAssets, CurrPortAssets);
    ArrayCopy(ProposedPorLotSizes, CurrPortLotSizes);

    ProposedPortAssets[ArraySize(ProposedPortAssets) - 1] = Symbol1;
    ProposedPorLotSizes[ArraySize(ProposedPorLotSizes) - 1] = Lotsize1;

    // POSITION DIAGNOSTICS
    string posDiagnostics = "";
    for (int i = 0; i < ArraySize(ProposedPortAssets); i++)
    {
        string posType = (i == ArraySize(ProposedPortAssets) - 1) ? "PROPOSED" : "EXISTING";
        posDiagnostics += "Pos " + IntegerToString(i) + " " + ProposedPortAssets[i] + " " + DoubleToString(ProposedPorLotSizes[i], 2) + "  (" + posType + ")\n";
    }

    // CALCULATE THE PROPOSED VaR IF NEW POSITION WERE ALLOWED TO OPEN
    PortfolioRisk.CalculateIncrementalVaR(ProposedPortAssets, ProposedPorLotSizes);
    double proposedValueAtRisk = PortfolioRisk.IncrementalVaR;

    return TotalValueAtRisk > proposedValueAtRisk;
}


What I need next is some assistance in editing / making a change to this so that I can achieve the above goal above.

Please check all the content and I will send you the code (which I have already created), I just need to make sure you understand he task.


Looking forward to working with you :)


Han respondido

1
Desarrollador 1
Evaluación
(206)
Proyectos
336
16%
Arbitraje
23
39% / 30%
Caducado
18
5%
Ocupado
2
Desarrollador 2
Evaluación
(9)
Proyectos
20
10%
Arbitraje
3
67% / 33%
Caducado
5
25%
Libre
3
Desarrollador 3
Evaluación
(8)
Proyectos
18
17%
Arbitraje
3
67% / 0%
Caducado
0
Libre
Solicitudes similares
I have an indicator that give signals. I would like an EA to automate the strategy. the Indicator gives an arrow in the direction the trade needs to open. Attached is a picture of the indicator. I have also attached the Indicator as well as a word document of what I would like be able to select on the EA
Hello, I am seeking an experienced expert who can assist me in converting a trading indicator or strategy written in Vbox Thinkscript into a compatible format for use with Sierra Chart
My idea _Anna. 50+ USD
I'm looking for a strategy where I can specify two points, such as Point A and Point B, which could be based on today's high/low or yesterday’s high/low, etc. I should have the option to define these points. The system should execute a buy order when the price goes above Point A, with the ability to set a target in percentage or points, as well as a stop-loss. Similarly, when the price drops below Point B, it should
RackemupEA is based on an indicator which was made freely available to all. The mql4 file is attached. The requirements doc spells out easy to understand entry/exit conditions as well as some trade management functions to control the size of successive entries in the series. Series (or sequence) is a set of trades that open in the same direction, either long or short. The EA will and must be FIFO compliant. Hedging
I have one expert advisor. I optimized it and generated 3 optimized set files. As each EA can run only single set file, I need my EA to run with the parametrization from 3 set files at the same time because trade conditions those are defined by the set files are not same
Buy - 2 or 3 (option) moving average (simple or exponential) alignment, with the shortest above the longest and if 3, with the second in the middle of the others 2. Wait a candle close above the one or two (option) previous maximums Stop loss: in the minimum of previous candle or minimum of the enter candle (option) with option to add 5, 10, 15, 20, 25, 30, 35, 40, 45 or 50 points below (options to set) Trailing stop
Project Overview Develop a custom automated trading bot (Expert Advisor) for MetaTrader 4 (MT4) that executes trades on the S&P 500 index CFDs via CMC Markets. The bot will implement a momentum-based trading strategy that utilizes technical indicators for market entry and exit signals, incorporates dynamic stop-loss orders, adjusts position sizes based on market momentum, and adheres to strict risk management
Hello, I want to make simple EA for MT5 where I can set main pair and correlated pair and if main pair open trade it will open opposite trade on correlated pair and when main pair close trade it will close trade on correlated pair also. For example if I set US30 as main and NAS100 as correlated and open buy on US30 it will open sell on NAS100. When I close buy on US30 it also close sell on NAS100. Additional options
no order will be given until you prove that you are capable to code , so at least make a basic demo first to take the final order from me. and i can not afford to pay more than 30 usd. so its final offer EA should work with any pair like jpy , oil and Gold pairs along with EURUSD , GBPUSD etc and GBPJPY and too Lot size … its fixed for all. So which ever size client set . it will set for all the trades Gap between
My Goal: I want to make an EA that makes money using AI.. with zero losses and 100% winning chances and we will continue to upgrade and design the EA until we reach our goal. this could be a long term project

Información sobre el proyecto

Presupuesto
85+ USD
Para el ejecutor
76.5 USD
Plazo límite de ejecución
a 2 día(s)