StrategyQuant
Assistant IA QAlgoCloudQuantAnalyzerQuantDataManager
Cours gratuitEntreprise
BlogDocumentationForumContactez-nous
BlogMarketplace
Se connecter
Créer un compte gratuit

Produit

  • Tarifs & licences
  • Formations
  • Place de marché
  • Commencer l'essai gratuit

Mentions légales

  • Conditions d'utilisation
  • Politique de confidentialité
  • Cookies

Contact

[email protected]

Société

StrategyQuant s.r.o.

Korunní 2569/108, Vinohrady, 101 00 Praha 10, République tchèque, UE

IČ : 04000498

DIČ : CZ04000498

Réseaux sociaux

  • Mentions légales | TRAITEMENT ET PROTECTION DES DONNÉES PERSONNELLES

    Les performances passées ne constituent pas une garantie de succès futur. Toutes les informations doivent être considérées à des fins pédagogiques uniquement

    Avertissement des ÉTATS-UNIS requis par le gouvernement - La Commodity Futures Trading Commission précise : Le trading sur les contrats à terme et les options présente d'importantes opportunités de gains, mais implique également un risque potentiel élevé. Vous devez être conscient des risques et être prêt à les accepter afin d'investir sur les marchés des contrats à terme et des options. Ne tradez pas avec de l'argent que vous ne pouvez pas vous permettre de perdre. Ceci ne constitue ni une sollicitation ni une offre d'achat/de vente de contrats à terme, d'actions ou d'options sur ces mêmes instruments. Aucune déclaration n'est faite garantissant qu'un compte réalisera ou est susceptible de réaliser des profits ou des pertes similaires à ceux présentés dans ce document. Les performances passées de tout système ou méthode de trading ne sont pas nécessairement représentatives des résultats futurs.

    RÈGLE CFTC 4.41 - LES RÉSULTATS DE PERFORMANCE HYPOTHÉTIQUES OU SIMULÉS COMPORTENT CERTAINES LIMITES. CONTRAIREMENT AUX RÉSULTATS DE PERFORMANCE RÉELS, LES RÉSULTATS SIMULÉS NE REPRÉSENTENT PAS DES OPÉRATIONS DE TRADING RÉELLES. DE PLUS, DANS LA MESURE OÙ LES TRANSACTIONS N'ONT PAS ÉTÉ EXÉCUTÉES, LES RÉSULTATS ONT PU COMPENSER L'IMPACT DE CERTAINS FACTEURS DE MARCHÉ, LE CAS ÉCHÉANT, TELS QUE LE MANQUE DE LIQUIDITÉ. LES PROGRAMMES DE TRADING SIMULÉ EN GÉNÉRAL SONT ÉGALEMENT SUJETS AU FAIT QU'ILS SONT CONÇUS EN BÉNÉFICIANT D'UN RECUL HISTORIQUE. AUCUNE DÉCLARATION N'EST FAITE GARANTISSANT QU'UN COMPTE RÉALISERA OU EST SUSCEPTIBLE DE RÉALISER DES PROFITS OU DES PERTES SIMILAIRES À CEUX INDIQUÉS.

    AUCUNE DÉCLARATION N'EST FAITE GARANTISSANT QU'UN COMPTE RÉALISERA, OU EST SUSCEPTIBLE DE RÉALISER, DES PROFITS OU DES PERTES SIMILAIRES À CEUX ÉVOQUÉS SUR CE SITE. SI VOUS DÉCIDEZ D'INVESTIR DE L'ARGENT RÉEL, TOUTES LES DÉCISIONS DE TRADING SUR LES MARCHÉS FINANCIERS VOUS APPARTIENNENT.

    © StrategyQuant 2026

    Propulsé par Klaudie.ai

    Retour au marketplaceDIGITAL

    Plus grand MAE sur plusieurs trades

    StrategyQuantPlugins
    Plus grand MAE sur plusieurs trades

    Calcule l'excursion défavorable maximale (MAE) combinée la plus défavorable lorsque plusieurs positions sont ouvertes simultanément, vous aidant à quantifier les drawdowns dans les stratégies d'entrées échelonnées (basket).

    Biggest MAE - utile pour analyser les stratégies avec des ordres uniques ou multiples.

    Ordres multiples vs Ordre unique

    Il est plus efficace de répartir le risque sur un panier d'ordres plutôt que sur un ordre unique. Les entrées multiples offrent plus de flexibilité sans exiger une précision absolue sur une entrée unique.

    Lors de l'ouverture simultanée de plusieurs ordres dans la même direction, calculez le MAE total de toutes les positions ouvertes. Si les positions sont dans des directions opposées (hedging), soustrayez le MFE des positions opposées du MAE le plus important pour obtenir le MAE global.

    Quatre snippets

    BiggestMAEallTrade - Plus grand MAE pour un contrat, normalisé par contrat pour des résultats précis même si la stratégie augmente la taille de contrat pendant le backtesting.

    package SQ.Columns.Databanks;
    import com.strategyquant.lib.L;
    import com.strategyquant.lib.SQUtils;
    import com.strategyquant.lib.SettingsMap;
    import com.strategyquant.tradinglib.*;
    import java.util.List;
    import java.util.ArrayList;
    import java.util.*;
    import java.lang.*;  
    // Mode in France by Emmanuel Evrard for the StrategyQuantX Community :)
    public class BiggestMAEallTrade extends DatabankColumn 
    {
        public BiggestMAEallTrade() 
        {
            super(L.tsq("Biggest Multiple MAE"), DatabankColumn.Decimal2PL, ValueTypes.Minimize, 0, 0, 100);
            setWidth(140);
            setTooltip(L.tsq("Biggest Multiple MAE - is the worst Maximum Adverse Excursion of all trades open at once"));
        }
        //------------------------------------------------------------------------
        @Override
        public double compute(SQStats stats, StatsTypeCombination combination, OrdersList ordersList, SettingsMap settings, SQStats statsLong, SQStats statsShort) throws Exception 
        {
            double worstMAE = -Double.MAX_VALUE;
            Date date = new Date();
            Date dateTemp = new Date();
            double Total1 = 0;
            double Size1 = 0;
            for(int i = 0; i<ordersList.size(); i++) 
            {
                Order order = ordersList.get(i);
                dateTemp = new Date(order.CloseTime);
                Size1 = order.Size;
                if (Size1 == 0) { Size1 = 0.01; }
                if (dateTemp.equals(date))
                {
                    Total1 += order.MAE;
                }
                else
                {
                    date = new Date(order.CloseTime);
                    Total1 = order.MAE;
                }
                if((Total1 / Size1)  > worstMAE) 
                {
                    worstMAE = (Total1/order.Size);
                }
            }
            return -1*worstMAE;
        }
    }
    

    BiggestMAEallTradePct - Plus grand MAE en pourcentage du solde du compte. Indique si la stratégie utilise un risque adéquat par rapport au compte (par exemple, en comparaison avec une perte quotidienne maximale de 5 %).

    package SQ.Columns.Databanks;
    import com.strategyquant.lib.L;
    import com.strategyquant.lib.SQUtils;
    import com.strategyquant.lib.SettingsMap;
    import com.strategyquant.tradinglib.*;
    import java.util.List;
    import java.util.ArrayList;
    import java.util.*;
    import java.lang.*;  
    // Mode in France by Emmanuel Evrard for the StrategyQuantX Community :)
    public class BiggestMAEallTradePct extends DatabankColumn 
    {
        public BiggestMAEallTradePct() 
        {
            super(L.tsq("Biggest Multiple MAE %"), DatabankColumn.Decimal2Pct, ValueTypes.Minimize, 0, 0, 100);
            setWidth(70);
            setTooltip(L.tsq("Biggest Multiple MAE % - is the worst Maximum Adverse Excursion of all trades open at once compared to AccountBalance"));
        }
        @Override
        public double compute(SQStats stats, StatsTypeCombination combination, OrdersList ordersList, SettingsMap settings, SQStats statsLong, SQStats statsShort) throws Exception 
        {
            double worstMAE = -Double.MAX_VALUE;
            Date date = new Date();
            Date dateTemp = new Date();
            double Total1 = 0;
            double Total2 = 0;
            for(int i = 0; i<ordersList.size(); i++) 
            {
                Order order = ordersList.get(i);
                dateTemp = new Date(order.CloseTime);
                if (dateTemp.equals(date))
                {
                    Total1 += order.MAE;
                }
                else
                {
                    date = new Date(order.CloseTime);
                    Total1 = order.MAE;
                }
                Total2 = SQUtils.safeDivide(Total1, order.AccountBalance - order.PL) * 100.0;
                if(Total2  > worstMAE) 
                {
                    worstMAE = Total2;
                }
            }
            return -1*worstMAE;
        }
    }
    

    BiggestMAEallHedgingTrade & BiggestMAEallHedgingTradePct - Pour les positions couvertes (hedging) dans des directions opposées. Prend le plus grand MAE et soustrait le MFE de la direction opposée. Fonctionne lorsque des trades opposés sont ouverts pendant le plus grand MAE.

    package SQ.Columns.Databanks;
    import com.strategyquant.lib.L;
    import com.strategyquant.lib.SQUtils;
    import com.strategyquant.lib.SettingsMap;
    import com.strategyquant.tradinglib.*;
    import java.util.List;
    import java.util.ArrayList;
    import java.util.*;
    import java.lang.*;  
    // Mode in France by Emmanuel Evrard for the StrategyQuantX Community :)
    public class BiggestMAEallHedgingTrade extends DatabankColumn 
    {
        public BiggestMAEallHedgingTrade() 
        {
            super(L.tsq("Biggest Multiple Hedging MAE"), DatabankColumn.Decimal2PL, ValueTypes.Minimize, 0, 0, 100);
            setWidth(140);
            setTooltip(L.tsq("Biggest Multiple Hedging MAE - is the worst Maximum Adverse Excursion of all trades open at once"));
        }
        //------------------------------------------------------------------------
        @Override
        public double compute(SQStats stats, StatsTypeCombination combination, OrdersList ordersList, SettingsMap settings, SQStats statsLong, SQStats statsShort) throws Exception 
        {
            double worstMAE1= -Double.MAX_VALUE;
            double worstMAE2 = -Double.MAX_VALUE;
            double BesttMFE1= -Double.MAX_VALUE;
            Date date = new Date();
            Date dateTemp = new Date();
            double Total1 = 0;
            double Size1 = 0;
            int direction = 0;
            for(int i = 0; i < ordersList.size(); i++) 
            {
                Order order = ordersList.get(i);
                dateTemp = new Date(order.CloseTime);
                Size1 = order.Size;
                direction=order.getDirection();
                if (direction == 1)     								// Bullish positions
                {
                    if (Size1 == 0) { Size1 = 0.01; }
                    if (dateTemp.equals(date))
                    {
                        Total1 += order.MAE;
                    }
                    else
                    {
                        date = new Date(order.CloseTime);
                        Total1 = order.MAE;
                    }
                    if((Total1 / Size1)  > worstMAE1) 
                    {
                        worstMAE1 = (Total1/order.Size);
                    }
                }
            }
            Total1 = 0;
            for(int i = 0; i < ordersList.size(); i++) 
            {
                Order order = ordersList.get(i);
                dateTemp = new Date(order.CloseTime);
                Size1 = order.Size;
                direction=order.getDirection();
                if (direction == -1)     								// Bearish positions
                {
                    if (Size1 == 0) { Size1 = 0.01; }
                    if (dateTemp.equals(date))
                    {
                        Total1 += order.MAE;
                    }
                    else
                    {
                        date = new Date(order.CloseTime);
                        Total1 = order.MAE;
                    }
                    if((Total1 / Size1)  > worstMAE2) 
                    {
                        worstMAE2 = (Total1/order.Size);
                    }
                }
            }
            if (worstMAE1 >= worstMAE2)
            {
                Total1 = 0;
                for(int i = 0; i < ordersList.size(); i++) 
                {
                    Order order = ordersList.get(i);
                    dateTemp = new Date(order.CloseTime);
                    Size1 = order.Size;
                    direction=order.getDirection();
                    if (direction == -1)     								// Bearish positions
                    {
                        if (Size1 == 0) { Size1 = 0.01; }
                        if (dateTemp.equals(date))
                        {
                            Total1 += order.MFE;
                        }
                        else
                        {
                            date = new Date(order.CloseTime);
                            Total1 = order.MFE;
                        }
                        if((Total1 / Size1)  > BesttMFE1) 
                        {
                            BesttMFE1 = (Total1/order.Size);
                        }
                    }
                }
                return -1*(worstMAE1 - BesttMFE1);
            }
            else if (worstMAE2 > worstMAE1)
            {
                Total1 = 0;
                for(int i = 0; i < ordersList.size(); i++) 
                {
                    Order order = ordersList.get(i);
                    dateTemp = new Date(order.CloseTime);
                    Size1 = order.Size;
                    direction=order.getDirection();
                    if (direction == 1)     								// Bullish positions
                    {
                        if (Size1 == 0) { Size1 = 0.01; }
                        if (dateTemp.equals(date))
                        {
                            Total1 += order.MFE;
                        }
                        else
                        {
                            date = new Date(order.CloseTime);
                            Total1 = order.MFE;
                        }
                        if((Total1 / Size1)  > BesttMFE1) 
                        {
                            BesttMFE1 = (Total1/order.Size);
                        }
                    }
                }
                return -1*(worstMAE2 - BesttMFE1);
            }
            return 0;
        }
    }
    
    package SQ.Columns.Databanks;
    import com.strategyquant.lib.L;
    import com.strategyquant.lib.SQUtils;
    import com.strategyquant.lib.SettingsMap;
    import com.strategyquant.tradinglib.*;
    import java.util.List;
    import java.util.ArrayList;
    import java.util.*;
    import java.lang.*;  
    // Mode in France by Emmanuel Evrard for the StrategyQuantX Community :)
    public class BiggestMAEallHedgingTradePct extends DatabankColumn 
    {
        public BiggestMAEallHedgingTradePct() 
        {
            super(L.tsq("Biggest Multiple Hedging MAE %"), DatabankColumn.Decimal2Pct, ValueTypes.Minimize, 0, 0, 100);
            setWidth(100);
            setTooltip(L.tsq("Biggest Multiple Hedging MAE % - is the worst Maximum Adverse Excursion of all trades open at once compared to AccountBalance"));
        }
        @Override
        public double compute(SQStats stats, StatsTypeCombination combination, OrdersList ordersList, SettingsMap settings, SQStats statsLong, SQStats statsShort) throws Exception 
        {
            double worstMAE1= -Double.MAX_VALUE;
            double worstMAE2 = -Double.MAX_VALUE;
            double BesttMFE1= -Double.MAX_VALUE;
            Date date = new Date();
            Date dateTemp = new Date();
            double Total1 = 0;
            double Total2 = 0;
            int direction = 0;
            for(int i = 0; i<ordersList.size(); i++) 
            {
                Order order = ordersList.get(i);
                dateTemp = new Date(order.CloseTime);
                direction=order.getDirection();
                if (direction == 1)      								// Bullish position
                {
                    if (dateTemp.equals(date))
                    {
                        Total1 += order.MAE;
                    }
                    else
                    {
                        date = new Date(order.CloseTime);
                        Total1 = order.MAE;
                    }
                    Total2 = SQUtils.safeDivide(Total1, order.AccountBalance - order.PL) * 100.0;
                    if(Total2  > worstMAE1) 
                    {
                        worstMAE1 = Total2;
                    }
                }
            }
            Total1 = 0;
            for(int i = 0; i<ordersList.size(); i++) 
            {
                Order order = ordersList.get(i);
                dateTemp = new Date(order.CloseTime);
                direction=order.getDirection();
                if (direction == -1)      								// Bearish position
                {
                    if (dateTemp.equals(date))
                    {
                        Total1 += order.MAE;
                    }
                    else
                    {
                        date = new Date(order.CloseTime);
                        Total1 = order.MAE;
                    }
                    Total2 = SQUtils.safeDivide(Total1, order.AccountBalance - order.PL) * 100.0;
                    if(Total2  > worstMAE2) 
                    {
                        worstMAE2 = Total2;
                    }
                }
            }
            if (worstMAE1 >= worstMAE2)
            {
                Total1 = 0;
                for(int i = 0; i<ordersList.size(); i++) 
                {
                    Order order = ordersList.get(i);
                    dateTemp = new Date(order.CloseTime);
                    direction=order.getDirection();
                    if (direction == -1)      								// Bearish position
                    {
                        if (dateTemp.equals(date))
                        {
                            Total1 += order.MFE;
                        }
                        else
                        {
                            date = new Date(order.CloseTime);
                            Total1 = order.MFE;
                        }
                        Total2 = SQUtils.safeDivide(Total1, order.AccountBalance - order.PL) * 100.0;
                        if(Total2  > BesttMFE1) 
                        {
                            BesttMFE1 = Total2;
                        }
                    }
                }
                return -1*(worstMAE1 - BesttMFE1);
            }
            else if (worstMAE2 > worstMAE1)
            {
                Total1 = 0;
                for(int i = 0; i<ordersList.size(); i++) 
                {
                    Order order = ordersList.get(i);
                    dateTemp = new Date(order.CloseTime);
                    direction=order.getDirection();
                    if (direction == 1)      								// Bullish position
                    {
                        if (dateTemp.equals(date))
                        {
                            Total1 += order.MFE;
                        }
                        else
                        {
                            date = new Date(order.CloseTime);
                            Total1 = order.MFE;
                        }
                        Total2 = SQUtils.safeDivide(Total1, order.AccountBalance - order.PL) * 100.0;
                        if(Total2  > BesttMFE1) 
                        {
                            BesttMFE1 = Total2;
                        }
                    }
                }
                return -1*(worstMAE2 - BesttMFE1);
            }
            return 0;
        }
    }
    
    Les performances passées ne préjugent pas des performances futures. Toutes les informations doivent être considérées comme ayant un but purement éducatif ÉTATS-UNIS Avertissement requis par le gouvernement - La Commodity Futures Trading Commission précise : Le trading de contrats à terme et d'options comporte d'importantes perspectives de gain, mais aussi d'importants risques potentiels. Vous devez être conscient des risques et accepter de les assumer afin d'investir sur les marchés des contrats à terme et des options. Ne tradez pas avec de l'argent que vous ne pouvez pas vous permettre de perdre. Ce document ne constitue ni une sollicitation ni une offre d'achat/de vente de contrats à terme, d'actions ou d'options sur ces derniers. Aucune déclaration n'est faite garantissant qu'un compte réalisera ou est susceptible de réaliser des profits ou des pertes similaires à ceux mentionnés dans ce document. La performance passée de tout système ou méthode de trading n'est pas nécessairement indicative des résultats futurs. RÈGLE CFTC 4.41 - LES RÉSULTATS DE PERFORMANCE HYPOTHÉTIQUES OU SIMULÉS COMPORTENT CERTAINES LIMITES. CONTRAIREMENT À UN HISTORIQUE RÉEL DE PERFORMANCE, LES RÉSULTATS SIMULÉS NE REPRÉSENTENT PAS UN TRADING RÉEL. DE PLUS, ÉTANT DONNÉ QUE LES TRANSACTIONS N'ONT PAS ÉTÉ RÉELLEMENT EXÉCUTÉES, LES RÉSULTATS ONT PU SOUS-ÉVALUER OU SURÉVALUER L'IMPACT DE CERTAINS FACTEURS DE MARCHÉ, TELS QUE LE MANQUE DE LIQUIDITÉ. LES PROGRAMMES DE TRADING SIMULÉ EN GÉNÉRAL SONT ÉGALEMENT SOUMIS AU FAIT QU'ILS SONT CONÇUS AVEC LE RECUL DU TEMPS. AUCUNE DÉCLARATION N'EST FAITE GARANTISSANT QU'UN COMPTE RÉALISERA OU EST SUSCEPTIBLE DE RÉALISER DES PROFITS OU DES PERTES SIMILAIRES À CEUX AFFICHÉS. AUCUNE DÉCLARATION N'EST FAITE GARANTISSANT QU'UN COMPTE RÉALISERA, OU EST SUSCEPTIBLE DE RÉALISER, DES PROFITS OU DES PERTES SIMILAIRES À CEUX ÉVOQUÉS SUR CE SITE. SI VOUS DÉCIDEZ D'INVESTIR DE L'ARGENT RÉEL, TOUTES LES DÉCISIONS DE TRADING SUR LES MARCHÉS FINANCIERS DOIVENT ÊTRE LES VÔTRES.
    Gratuit

    Fichiers

    • Snippet-BiggestMAEonmultipletrades.sqm14 KBVerrouillé

    Le téléchargement se débloque après l’achat ou avec un niveau actif.

    Détails
    Version1.0.0
    Publié le19 octobre 2026
    Dernière mise à jour2 novembre 2026
    AppSQ
    TypeSnippet
    AuthorEmmanuel
    App version145.3058
    Codebase categoryDatabank / Filter