cutz_trend





//+------------------------------------------------------------------+
//|                                                   cutz_TREND.mq4 |
//|                                                           CutzMF |
//|                                                                  |
//+------------------------------------------------------------------+
#property copyright "CutzMF"
#property link      ""

#property indicator_chart_window
#property indicator_buffers 2
#property indicator_color1 Green
#property indicator_color2 Red
//---- input parameters
extern double    BarBody=0.0094;
extern int CountBars=350;
//---- buffers
double UP[];
double DN[];
//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int init()
  {
//---- indicators
   SetIndexStyle(0,DRAW_ARROW);
   SetIndexArrow(0,167);
   SetIndexBuffer(0,UP);
   SetIndexEmptyValue(0,0.0);
   SetIndexStyle(1,DRAW_ARROW);
   SetIndexArrow(1,167);
   SetIndexBuffer(1,DN);
   SetIndexEmptyValue(1,0.0);
   BarBody=BarBody*BarBody;
//----
   return(0);
  }
//+------------------------------------------------------------------+
//| Custom indicator deinitialization function                       |
//+------------------------------------------------------------------+
int deinit()
  {
//----
   
//----
   return(0);
  }
//+------------------------------------------------------------------+
//| Custom indicator iteration function                              |
//+------------------------------------------------------------------+
int start()
  {
   int    shift,i,counted_bars=IndicatorCounted(); 
   double bar;
   double csma2,psma2,
          csma7,psma7;
//----
   for (shift = CountBars; shift>=0; shift--)  
     {
     bar=Close[shift]-Open[shift];
     bar=(bar)*(bar);
     for (i=0;i<=3;i++)
     {
     psma2=iMA(NULL,0,2,0,i,PRICE_CLOSE,shift+1);//ïðåäûäóùèå
     psma7=iMA(NULL,0,7,0,i,PRICE_CLOSE,shift+1);
     csma2=iMA(NULL,0,2,0,i,PRICE_CLOSE,shift);//íàñòîÿùèå
     csma7=iMA(NULL,0,7,0,i,PRICE_CLOSE,shift);
     
     if ((csma2>psma2)&&(csma7>=psma7)&&(bar>=BarBody)) { UP[shift]=Low[shift]-10*Point; }
     if ((csma2<psma2)&&(csma7<=psma7)&&(bar>=BarBody)) { DN[shift]=High[shift]+10*Point; }
     }
     } 
//----
   return(0);
  }
//+------------------------------------------------------------------+



Sample





Analysis



Market Information Used:

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


Indicator Curves created:

Implements a curve of type DRAW_ARROW


Indicators Used:

Moving average indicator


Custom Indicators Used:

Order Management characteristics:

Other Features: