tickscalping





//+------------------------------------------------------------------+
//|                                                tickscalping.mq4 |
//|                       Copyright ?2008, MetaQuotes Software Corp. |
//|                                        http://www.metaquotes.net |
//+------------------------------------------------------------------+
#property copyright "Copyright ?2008, MetaQuotes Software Corp."
#property link      "http://www.metaquotes.net"

double t[7];
double max=0,min=0;
//+------------------------------------------------------------------+
//| expert initialization function                                   |
//+------------------------------------------------------------------+
int init()
  {
//----
   ArrayInitialize(t,0);
   
//----
   return(0);
  }
//+------------------------------------------------------------------+
//| expert deinitialization function                                 |
//+------------------------------------------------------------------+
int deinit()
  {
//----
   
//----
   return(0);
  }
//+------------------------------------------------------------------+
//| expert start function                                            |
//+------------------------------------------------------------------+
int start()
  {
//----
   t[0]=t[1];
   t[1]=t[2];
   t[2]=t[3];
   t[3]=t[4];
   t[4]=t[5];
   t[5]=t[6];
   t[6]=Bid;
   Print("t0=",t[0]," t1=",t[1]," t2=",t[2]," t3=",t[3]," t4=",t[4]," t5=",t[5]," t6=",t[6]);
   Print("sum=",t[6]-t[0]);   
   closeprofit();
   if(t[0]!=0)
   {
      max=ArrayMaximum(t);
      min=ArrayMinimum(t);
      Print("max=",max," min=",min);
      if(max==4 && min==0)
      {
         OrderSend(Symbol(), OP_SELL, 0.1, Bid,1,Ask+5*Point,Ask-5*Point,NULL,0,0,Red);
         return (0);
      }
      if(min==4 && max==0)
      {
         OrderSend(Symbol(), OP_BUY, 0.1, Ask,1,Bid-5*Point,Bid+5*Point,NULL,0,0,Red);
         return (0);
      }
   }
//----
   return(0);
  }
//+------------------------------------------------------------------+

void closeprofit()
{
   if(OrdersTotal()>0)
   {
      for (int i = 0; i < OrdersTotal(); i++) 
      {
         OrderSelect(i, SELECT_BY_POS, MODE_TRADES);
         if (OrderSymbol() == Symbol() && OrderProfit()>0) 
         {
            OrderClose(OrderTicket(),OrderLots(),OrderClosePrice(),1);
         }
      }
   }
}





Sample





Analysis



Market Information Used:



Indicator Curves created:


Indicators Used:



Custom Indicators Used:

Order Management characteristics:
It automatically opens orders when conditions are reached
Checks for the total of open orders

It Closes Orders by itself

Other Features: