Code Library / Grid Trading

MQL4 Anti-Grid Recovery System

Anti-grid recovery system increasing position size at each level.

Language: MQL4 · Category: Grid Trading · Tags: anti-grid, recovery, MQL4, position sizing, martingale

Source code

input double InitialLot=0.01; input double Multiplier=1.5;
input double GridPips=30; input int MaxLevels=6;
double LotForLevel(int level) {
   double lot=InitialLot;
   for(int i=1;i<level;i++) lot*=Multiplier;
   return NormalizeDouble(lot,2);
}

How to use this snippet

This is a building block, not a finished trading system. Paste it into your own MQL4 project, compile it, and test it on a demo account with your broker's real spreads before relying on it. If MetaEditor reports errors, the compilation error fixer can help.

Related snippets