Download MetaTrader 5

Experts: Progressive Grid Positionning System (Entry and Exit)

To add comments, please log in or register
MetaQuotes Software Corp.
Moderator
185446
MetaQuotes Software Corp.  

Progressive Grid Positionning System (Entry and Exit):

This systems allows you to progressively enter and exit the market. You define the amount you want to risk (%) and it calculates automatically the different levels of entering and exiting the market according to the amount of levels you have defined.

Author: laurent

Bluesky
138
Bluesky  

HI, sounds interesting indeed. Any chance you can explain more about which are the two modes and to add couple of screenshots?

Thanks!

David

laurent
11
laurent  
BlueSkyThinking:

HI, sounds interesting indeed. Any chance you can explain more about which are the two modes and to add couple of screenshots?

Thanks!

David

Screen capture coming soon

just try on a demo account for the moment the following parameters to see the principle :

You can copy and past the following code instead of the previous one

extern string     ________1________                = "********* GEST. - URGENCES *********";
extern bool       FERMER.TOUTES.LES.POSES          = false;    // Close all opened orders
extern bool       FERMER.POSES.ACHETEUSES          = false;    // Close all buy orders
extern bool       FERMER.POSES.VENDEUSES           = false;    // Close All sell orders
extern string     Cible                            = "--- Fermeture Ciblйe ---";
extern string     MAGIC.NUM.POUR.FERM.             = "";       // see below
extern bool       FERMER.POSE                      = false;    // Close a specific order by entering its magic number
extern bool       RUN.ON.INIT                      = false;    // Start ea when placed on chart
 
               // ############# TRADES-PARAMETRES ############# //
extern string     ________2________                = "*********** PARAM.-ORDRES **********";
// Choix du MODE ENTRY :
extern bool       Afficher.Montant.Perte           = false;    // Show the amount of losses
extern string     INFO.ORDRE                       = "0:Rien 1:Comptant 2:Stop 3:Limite 4:Stop Suiv.";
extern int        Type.Ordre                       = 1;        // Order type you want to send (4 types)
extern string     INFO.ORDRE.2                     = "0:Pas dйpendant ; Si ordre mиre exйcutй -> 1:Exйcuter  2:Effacer 3:Clфturer";
extern int        MagicNum.Ordre.Mиre              = 0;        // Magic number of mother order
extern int        Dйpendance                       = 0;        // Action to do with others orders (Execute/Erase/Close) when mother order is executed
extern string     Mini.Sep                         = "----------";
extern int        Trailing.Stop                    = 0;        // 
extern int        Trail.Entry.Pips                 = 0;        // Level in points at which ea start trailing stops
extern double     Exposition.Au.Risque             = 0.02;     // Risk exposure in %
extern int        Dist.Stop.Min.En.pips            = 50;       // Minimum distance between stop and entry point
extern int        Ecart.Entre.Niveaux              = 50;        // Distance defined between levels
extern string     ________3________                = "-----------------------------------------------------";
extern bool       ACHETER                          = true;    // BUY
extern bool       VENDRE                           = false;    // or SELL
 
               // ############# GRILLE - OPTIONS ############# //
extern string     ________4________                = "******* CHOIX OPTIONS GRILLE *******";               
extern bool       UTILISATION_GRILLE               = true;    // Security Use Grid : must be set to TRUE
extern string     ________5________                = "-----------------------------------------------------";
extern double     Niveau.De.Protection             = 1.18;        // Stopping price level 
extern double     Prix.Achat                       = 1.28;        // Buying price
extern double     Prix.Vente                       = 0;        // Selling Price
 
extern string     ________6________                = "-----------------------------------------------------";
// Choose calculation type :
extern bool       Grille.Centrйe.?                 = false;    // Level calculated from Grid Center level or by its boundering levels
// if you choose boundering levels calculation mode :
extern double     Grille.Borne.Sup                 = 1.5;        // Highest level price
extern double     Grille.Borne.Inf                 = 1.45;        // Lowest level price
// if you choose grid center calculation mode :
extern double     Grille.LC.Niv                    = 0;        // Grid center price
extern double     Grille.LC.Pas                    = 0;        // Levels step in points   
// Maximum levels number :
extern double     Grille.Nbre.Niveaux              = 10;        // Levels number
 
               // ############# EFFACER - TRACES - ORDRE ############# //
extern string     ________7________                = "****** PROCEDURES NETTOYAGE ******";
extern bool       Clean.Trace.Prise.Profit         = true;     // Clean profits arrows
extern bool       Clean.Trace.Stop.Perte           = true;     // Clean stops arrows             
extern bool       Clean.Trace.Entree.Sortie        = false;    // Clean entry arrows
To activate the ea go into tools / global variables / and set $_ACTIVATION_EXPERT_$" to 1
 
laurent
11
laurent  

hi excuse me please replace the function (because if you open a demo account without history it won't work)

Condit_Pass_Ord_are_Ok_?
// ****************************************************************** //
// ************** Conditions Passage Ordres Remplies ? ************** //
// ****************************************************************** //
bool Condit_Pass_Ord_are_Ok_?()
   {
      double Risque.Résid. = 0, Margin.Lots.Risk = 0;
      // Calcul du risque résiduel pouvant être pris sous forme de lots
      if (OrdersTotal() > 0)      
         {      
            // :::::::::::::::: EXPOSITION ::::::::::::::: //
            for (int i = OrdersTotal(); i >= 0; i--)
               {
                  OrderSelect(i, SELECT_BY_POS, MODE_TRADES);
            
                  // Ne considérer que les ordres déjà en cours
                  if (OrderType() <= OP_SELL) 
                     {
                        Margin.Lots.Risk += MathAbs((OrderOpenPrice() - OrderStopLoss()) / Point) 
                                    * OrderLots() * MarketInfo(Symbol(), MODE_TICKVALUE);
                     }
               }
            // ---
         
            Risque.Résid. = Exposition.Maximale - (Margin.Lots.Risk / AccountBalance());
         }
      // !!!!!!!!!!!! ADD THIS LITTLE PIECE OF CODE TO FIX THE LACK OF HISTORY ON DEMO ACCOUNT !!!!!!!!!! //
      if (OrdersTotal() == 0) return(true);
      // !!!!!!!!  <END> !!!!!!!! //
       
      // :::::::::::::::: TEST CONDITION ::::::::::::::: //      
      return(Risque.Résid. > Exposition.Au.Risque);    
   }
laurent
11
laurent  



example :

you risk *2% of your equity and the system defines (lots are automatically calculated):

4 exit levels

1 buying level

1 stop level for all 4 orders


if all trades loose money the waste amount represent for all 4 orders 2% of equity


You have also so many pôssibilities like :

- defining 10 pending orders levels (a grid for buying/selling progressively)

- defining 4 order types (market/limit/stop/linked orders)

- clean your chart with all those arrows

- try every possibility and enjoy I make the support...

nano fx
35
nano fx  

IT IS NOT WORKING IN BACK TEST COULD U EXPLAIN WHY

REGARDS

laurent
11
laurent  
nanoforex:

IT IS NOT WORKING IN BACK TEST COULD U EXPLAIN WHY

REGARDS



It could not work in backtest like it is designed to work in real trading. That's why you must open a demo account.

First you analyse the market and its trend and then you decide to enter at different levels. This ea is not designed to work on its own, but to help the investor to enter by steps without risking too much money at the first time. I believe in half-automated trading. Your brain and experience are the most powerful tools you have to my mind, to analyse the markets. But you do not want to be continuously in front of your screen to wait for entry and exit.

So you use this ea to progressively enter the market it is to say the more the trend is confirming the more you are engaged. For exiting you don't want to lose all your profits so you close your trades by step too.

Regards too

///////////////////////////////////////////////////////////////////////////////////////////////////////////////

PS : Do not forget to fix the "bug" on demo account by adding a little piece of code see below

//////////////////////////////////////////////////////////////////////////////////////////////////////////////

laurent
11
laurent  

Hello, that's me again. I know I write a lot, but I receive some requests on MP for a manual for this ea . I will try to give my best to write a functional one. So don't worry it's coming soon. For those who are more familiar with MQL4, I think you could start tests on a demo account without waiting anymore like you could learn by trading effectively. Hope you the best

Lobev

laurent
11
laurent  

Hello, just to say I am very happy for some encouraging private messages I received. It's motivating for further developments of this ea. I do not have too much time these days, but It will be very cool if you send me all your suggestions of improvement. Colibri will grow up to become a big bird by inspiring from ideas from every one of us. If you think there is a better way to code some aspects, or an essential functionality to add don't be shy, just write it :-). I will take a great pleasure to read your ideas. Sharing is always exciting. Have fun dear fellows...

Lobev

cm69
32
cm69  
lobev:

See this Scalper EA

To add comments, please log in or register