Examples: Features of Experts Advisors

 

New article Features of Experts Advisors has been published:

Creation of expert advisors in the MetaTrader trading system has a number of features.

Author: MetaQuotes Software Corp.

 
//+------------------------------------------------------------------+
//|                                       GoldminerAbsoluteEntry.mq4 |
//|                                             Copyright © 2009, Me |
//+------------------------------------------------------------------+
#property copyright "Copyright © 2009, Me"

#property indicator_chart_window
#property indicator_buffers 2
#property indicator_color1 Magenta
#property indicator_color2 Yellow

extern string Remark1 = "-- Goldminer1 Settings --";
extern int RISK = 4;
extern int VerifyShift = 1;

//---- buffers
double ExtMapBuffer1[];
double ExtMapBuffer2[];
//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int init()
  {
//---- indicators
   SetIndexStyle(0,DRAW_ARROW);
   SetIndexArrow(0,234);
   SetIndexBuffer(0,ExtMapBuffer1);
   SetIndexEmptyValue(0,0.0);
   SetIndexStyle(1,DRAW_ARROW);
   SetIndexArrow(1,233);
   SetIndexBuffer(1,ExtMapBuffer2);
   SetIndexEmptyValue(1,0.0);
//----
   return(0);
  }
//+------------------------------------------------------------------+
//| Custom indicator deinitialization function                       |
//+------------------------------------------------------------------+
int deinit()
  {
   
   return(0);
  }
//+------------------------------------------------------------------+
//| Custom indicator iteration function                              |
//+------------------------------------------------------------------+
int start()
  {

   //+------------------------------------------------------------------+
   //| Goldminer Begin                                                  |
   //+------------------------------------------------------------------+

   double GN1,GN2;
   string GoldMiner;

   for(int a=0;a<Bars;a++){//For Loop
   GN1=iCustom(0,0,"goldminer1",RISK,Bars,0,a+VerifyShift);
   GN2=iCustom(0,0,"goldminer1",RISK,Bars,1,a+VerifyShift);

   if(GN2>GN1){GoldMiner="Up";
      ExtMapBuffer2[a]=Low[a];}
   else if(GN1>GN2){GoldMiner="Down";
      ExtMapBuffer1[a]=High[a];}
   else {GoldMiner="None";}

   }//End Of For Loop

   //+---------------------------------------------------------------+
   return(0);
  }
//+------------------------------------------------------------------+
 
Sumit Dutta:
any one help i want my indicator alart up when back singel candel is green or alart down when back sigel candel is reed filter signal
Reason: