Code Library / Strategies

Grid Trading

Simple grid trading framework.

Language: MQL4 · Category: Strategies · Tags: grid, pending orders, MQL4

Source code

input double Grid=20; input double Lots=0.01;
void PlaceGrid(){
   double p=MarketInfo(Symbol(),MODE_POINT)*10*Grid;
   for(int i=1;i<=5;i++){
      OrderSend(Symbol(),OP_BUYLIMIT,Lots,Ask-p*i,3,0,0,"Grid",0,0);
   }
}

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.