NewOne





//+------------------------------------------------------------------+
//|                                                       NewOne.mq4 |
//|                                  Copyright © 2006, GwadaTradeBoy |
//|                                        http://www.metaquotes.net |
//+------------------------------------------------------------------+
//| IF (Close > Close. 12 Or Close > Lowest (Close , 4).1 + 16 pips) And
//| High - Low < MovingAvg (High - Low , 9).2 And
//| Close < Open And StochD (5 , 3 , 2) < 80
//|
//| Order (good for day): buy on stop tomorrow at today's high – 10 pips
//|
//| IF (( Close < Close. 30 And Close < Close.15) Or Close < Highest (Close , 13).1 – 20 pips) And
//| High - Low < MovingAvg (High - Low , 5) And
//| Close > Open
//|
//| Order (good for day): sell on stop tomorrow at today's low
//|
//| Use a 250 pip stop loss for long and short.
//|
//| Note that close.12 is the close 12 days ago, Lowest (Close, 4).1 
//| is the yesterdays value of the lowest close within the last 4 
//| days, etc.  If u need more help, let me know.
//|
//| Setup to go Long
//|
//| 1. You are in a up trend (the close is higher than the close x days ago 
//| or higher than the lowest close plus a bit over the past few days or 
//| something like that)
//| 2. Yesterdays range less than the last few days (range has dried up so 
//| range should expand again)
//| 3. Yesterdays close was lower than the open
//| If 1, 2 and 3 true, entry to go long (reverse) is to buy today on stop
//| if the market goes up by a certain amount.
//|
//| Setup to go Short
//|
//| 1. You are in a down trend (the close is lower than the close x days ago 
//| or lower than the highest close minus a bit over the past few days or 
//| something like that)
//| 2. Yesterdays range less than the last few days (range has dried up so 
//| range should expand again)
//| 3. Yesterdays close was higher than the open
//| If 1, 2 and 3 true, entry to go short (reverse) is to buy today on stop
//| if the market goes up by a certain amount.
//+------------------------------------------------------------------+
#property copyright "Copyright © 2006, GwadaTradeBoy"
#property link      "http://www.metaquotes.net"

#property indicator_chart_window
//----Section #property
#property indicator_buffers 6
#property indicator_color1 Red
#property indicator_color2 Red
#property indicator_color3 Aqua
#property indicator_color4 Yellow
#property indicator_color5 Green
#property indicator_color6 Red

//---- Indicateurs
double Close30,Close15,Close12,Close1;
extern double digit=0;
int    nShift,limit,i,j,counted_bars;

//---- buffers
double ExtMapBuffer1[];    //EMA18
double ExtMapBuffer2[];    //EMA28
double ExtMapBuffer3[];    //WMA5
double ExtMapBuffer4[];    //WMA8
double ExtMapBuffer5[];    //Fleche Haut
double ExtMapBuffer6[];    //Fleche Bas

//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int init()
   {
//---- indicators

//---- Styles et couleur des Fleches      
      SetIndexStyle(4, DRAW_ARROW, 0, 2);    // Fleche vers le haut
      SetIndexArrow(4, 233);
      SetIndexBuffer(5, ExtMapBuffer5);
      SetIndexStyle(5, DRAW_ARROW, 0, 2);    // Fleche vers le bas
      SetIndexArrow(5, 234);
      SetIndexBuffer(4, ExtMapBuffer6);
//----       
      switch(Period())
         {
            case     1: nShift = 1;   break;
            case     5: nShift = 3;   break;
            case    15: nShift = 5;   break;
            case    30: nShift = 10;  break;
            case    60: nShift = 15;  break;
            case   240: nShift = 20;  break;
            case  1440: nShift = 80;  break;
            case 10080: nShift = 100; break;
            case 43200: nShift = 200; break;
         }
//----
      return(0);
   }
//+------------------------------------------------------------------+
//| Custom indicator deinitialization function                       |
//+------------------------------------------------------------------+
int deinit()
   {
//----
   
//----
      return(0);
   }
//+------------------------------------------------------------------+
//| Custom indicator iteration function                              |
//+------------------------------------------------------------------+
int start()
   {
      counted_bars=IndicatorCounted();
//----
      double rates[1][6],yesterday_close,yesterday_high,yesterday_low;
      ArrayCopyRates(rates, Symbol(), PERIOD_D1);

      if(DayOfWeek() == 1)
         {
            if(TimeDayOfWeek(iTime(Symbol(),PERIOD_D1,1)) == 5)
               {
                  yesterday_close = rates[1][4];
                  yesterday_high = rates[1][3];
                  yesterday_low = rates[1][2];
               }
            else
               {
                  for(int d = 5;d>=0;d--)
                     {
                        if(TimeDayOfWeek(iTime(Symbol(),PERIOD_D1,d)) == 5)
                           {
                              yesterday_close = rates[d][4];
                              yesterday_high = rates[d][3];
                              yesterday_low = rates[d][2];
                           }
                     }  
               }
         }
      else
         {
            yesterday_close = rates[1][4];
            yesterday_high = rates[1][3];
            yesterday_low = rates[1][2];
         }
//----
      if(counted_bars<0) 
         return(-1);
      if(counted_bars>0) 
         counted_bars--;
      limit=Bars-counted_bars;
   

//---- Dessin des fleches, future entré en trade
//---- Buy
                  if (
                  (Close > Close12 || (Close > (iLowest((NULL,PERIOD_D1,MODE_CLOSE,4) + 16)) &&
                  (High - Low < iMA (NULL,0,9,0, High - Low ).2) &&
                  (Close < Open) && 
                  (iStochastic (NULL,0,5,3,2) < 80)
                  )
                     {
                        ExtMapBuffer5[i] = Low[i] - nShift*Point;
                     }
//---- Sell
                  if (
                  (Close < Close30 && Close < Close15) || (Close < iHighest(NULL,PERIOD_D1,MODE_CLOSE,13) - 20) &&
                  (High - Low < iMA (NULL,0,5,0,High - Low )) &&
                  (Close > Open)
                  )
                     {
                        ExtMapBuffer6[i] = High[i] + nShift*Point;            
                     }
               }
         }   
//----
      return(0);
   }
//+------------------------------------------------------------------+



Sample





Analysis



Market Information Used:

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:



Custom Indicators Used:

Order Management characteristics:

Other Features: