www.pudn.com > MakeGrid.zip > MakeGrid.mq4
//+------------------------------------------------------------------+
//| MakeGrid.mq4 |
//| Copyright ? 2005, hdb |
//| http://www.dubois1.net/hdb |
//+------------------------------------------------------------------+
#property copyright "Copyright ? 2005, hdb"
#property link "http://www.dubois1.net/hdb"
//#property version "1.0beta"
extern string GridName = "Grid"; // identifies the grid. allows for several co-existing grids
extern double Lots = 0.1; //
extern double GridSize = 6; // pips between orders
extern double GridSteps = 40; // total number of orders
extern double GridLong = 1; // not used
//+------------------------------------------------------------------+
//| script program start function |
//+------------------------------------------------------------------+
int start()
{
//----
int doit, i, j,k, ticket, entermode, totalorders;
double point, startrate, traderate;
#property show_inputs // shows the parameters - thanks Slawa...
//----
point=MarketInfo(Symbol(),MODE_POINT);
startrate = ( Ask + point*GridSize/2 ) / point / GridSize; // round to a number of ticks divisible by GridSize
k = startrate ;
k = k * GridSize ;
startrate = k * point - GridSize*GridSteps/2*point ; // calculate the lowest entry point
// startrate = startrate + GridSize/2*point; // add half a mesh to be away from current rate
for( i=0;i Ask )
{ entermode = OP_BUYSTOP; }
else
{ entermode = OP_BUYLIMIT ; }
ticket=OrderSend(Symbol(),entermode,Lots,traderate,0,0,traderate+point*GridSize,GridName,16384,0,Green);
}
}
return(0);
}
//+------------------------------------------------------------------+