test_audusd5ticks





/*-----------------------------+
|			       |
| Shared by www.Aptrafx.com    |
|			       |
+------------------------------*/

//+------------------------------------------------------------------+
//|Simple counter-indicated trader for AUD/USD                       |
//+------------------------------------------------------------------+
#property copyright "Ron T"
#property link      "http://www.lightpatch.com"

#property indicator_chart_window
#property indicator_buffers 3
#property indicator_color1 Red
#property indicator_color2 White
#property indicator_color3 DeepSkyBlue

//---- buffers
double ExtMapBuffer1[];
double ExtMapBuffer2[];
double ExtMapBuffer3[];


//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//|------------------------------------------------------------------|

int init()
  {
   
   SetIndexStyle(0,DRAW_ARROW);
   SetIndexBuffer(0, ExtMapBuffer1);
   SetIndexArrow(0,234); //down red
   
   SetIndexStyle(1,DRAW_ARROW);
   SetIndexBuffer(1, ExtMapBuffer2);
   SetIndexArrow(1,233); //up white

   SetIndexStyle(2,DRAW_ARROW);
   SetIndexBuffer(2, ExtMapBuffer2);
   SetIndexArrow(2,159); //dot blue
 
   return(0);
  }


//+------------------------------------------------------------------+
//| Cursor indicator deinit                                          |
//+------------------------------------------------------------------+
int deinit()
  {
   int i;
   
   for( i=0; i<Bars; i++ ) ExtMapBuffer1[i]=0;
   for( i=0; i<Bars; i++ ) ExtMapBuffer2[i]=0;
   for( i=0; i<Bars; i++ ) ExtMapBuffer3[i]=0;

   return(0);
  }


//+------------------------------------------------------------------+
//| Custom indicator iteration function                              |
//+------------------------------------------------------------------+
int start()
  {
   double curTYP=0;
   double oldTYP=0;
   double xxxTYP=0;
   double change=0;
   int    ticket=1;
   
   Print ("tick at ",CurTime());

   //trades no more often than once a minute 
   if(CurTime()-OrderOpenTime()<60) return(0);
 
   xxxTYP=(High[3]+Low[3]+Close[3])/3;
   ExtMapBuffer3[3]=xxxTYP;

   oldTYP=(High[2]+Low[2]+Close[2])/3;
   curTYP=(High[1]+Low[1]+Close[1])/3;
   change=curTYP-oldTYP;
      
   // buffer1 Red    down
   if ( change < -0.0004 )
     {
      ExtMapBuffer1[1]=curTYP;
      ExtMapBuffer2[2]=0;
      
      ticket=OrderSend(Symbol(),OP_BUY,0.1,Ask,0,Ask-10*Point,Ask+10*Point,"ASD/USD BUY  order",525125,0,Green);
      if(ticket<0)
        {
         Print("OrderSend BUY  failed with error #",GetLastError());
         return(0);
        }
     }
       
   // buffer2 White  up
   if ( change > 0.0004 )
     {
      ExtMapBuffer1[1]=0;
      ExtMapBuffer2[2]=curTYP;

      ticket=OrderSend(Symbol(),OP_SELL,0.1,Ask,0,Ask+10*Point,Ask-10*Point,"ASD/USD SELL order",525525,0,Red);
      if(ticket<0)
        {
         Print("OrderSend SELL failed with error #",GetLastError());
         return(0);
        }
     }
          
   return(0);
  }
 



Sample





Analysis



Market Information Used:

Series array that contains close prices for each bar
Series array that contains the highest prices of each bar
Series array that contains the lowest prices of each bar


Indicator Curves created:

Implements a curve of type DRAW_ARROW


Indicators Used:



Custom Indicators Used:

Order Management characteristics:
It automatically opens orders when conditions are reached

Other Features: