Can anyone help me edit this code so that it only checks for this formation on close

babymush

Active member
Messages
221
Likes
1
Hi GUys,

Can anyone help me edit this indicator that will search for a certain bar formation ONLY say 5 mins before the close of the bar on the timeframe I am on.

Thank you

Code:
//+------------------------------------------------------------------+
//|                                             outside_days_v01.mq4 |
//|                                       Copyright © 2008, Akuma99. |
//|                                    http://www.beginnertrader.com |
//+------------------------------------------------------------------+
#property copyright "Copyright © 2008, Akuma99."
#property link      "http://www.beginnertrader.com"
#property indicator_chart_window
#property indicator_buffers 2
#property indicator_color1 Blue
#property indicator_color2 Red

double upArrows[];
double downArrows[];

//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int init()
{
   //---- indicators
   SetIndexStyle(0,DRAW_ARROW);
   SetIndexBuffer(0,upArrows);
   SetIndexArrow(0,233);

   SetIndexStyle(1,DRAW_ARROW);
   SetIndexBuffer(1,downArrows);
   SetIndexArrow(1,234);
   //----
   return(0);
}

//+------------------------------------------------------------------+
//| Custom indicator deinitialization function                       |
//+------------------------------------------------------------------+
int deinit()
{
//----

//----
return(0);
}

//+------------------------------------------------------------------+
//| Custom indicator iteration function                              |
//+------------------------------------------------------------------+
void start()
  {
   int    counted_bars=IndicatorCounted();

   if (counted_bars < 0) {
      return(-1);
   } else {
      counted_bars--;
   }

   int    limit = Bars - counted_bars;

   int i;
   for (i=0; i<limit; i++) {
      if (Close[i] >= (Low[i]+0.7*(High[i]-Low[i])) && (Open[i] >= Low[i]+0.7*(High[i]-Low[i])) && (Open[i] >= Low[i+1]) && (Close[i] >= Low[i+1]) && (Open[i] <= High[i+1]) && (High[i] <= High[i+1]) && (Close[i] <= High[i+1]) && (Low[i] <= Low[i+1] - 0.3*(High[i]-Low[i])) && (1*(High[i] - Low[i]) >= ((High[i+1] - Low[i+1]) + (High[i+2] - Low[i+2]) + (High[i+3] - Low[i+3]) + (High[i+4] - Low[i+4]) + (High[i+5] - Low[i+5]))/5)) {
         if (Close[i] >= Low[i+1]) {
            upArrows[i] = Low[i] -0.3*(High[i]-Low[i]);
           // PlaySound("Alert.wav");
            Alert(Symbol(), " Bullish Pin Bar");
         } else if (Close[i] < Low[i+1]) {
            downArrows[i] = High[i];
           // PlaySound("Alert.wav");
            Alert(Symbol(), " Bullish Pin Bar");
         }
      }
   }

  }
 
Hi GUys,

Can anyone help me edit this indicator that will search for a certain bar formation ONLY say 5 mins before the close of the bar on the timeframe I am on.

Thank you

Code:
//+------------------------------------------------------------------+
//|                                             outside_days_v01.mq4 |
//|                                       Copyright © 2008, Akuma99. |
//|                                    http://www.beginnertrader.com |
//+------------------------------------------------------------------+
#property copyright "Copyright © 2008, Akuma99."
#property link      "http://www.beginnertrader.com"
#property indicator_chart_window
#property indicator_buffers 2
#property indicator_color1 Blue
#property indicator_color2 Red

double upArrows[];
double downArrows[];

//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int init()
{
   //---- indicators
   SetIndexStyle(0,DRAW_ARROW);
   SetIndexBuffer(0,upArrows);
   SetIndexArrow(0,233);

   SetIndexStyle(1,DRAW_ARROW);
   SetIndexBuffer(1,downArrows);
   SetIndexArrow(1,234);
   //----
   return(0);
}

//+------------------------------------------------------------------+
//| Custom indicator deinitialization function                       |
//+------------------------------------------------------------------+
int deinit()
{
//----

//----
return(0);
}

//+------------------------------------------------------------------+
//| Custom indicator iteration function                              |
//+------------------------------------------------------------------+
void start()
  {
   int    counted_bars=IndicatorCounted();

   if (counted_bars < 0) {
      return(-1);
   } else {
      counted_bars--;
   }

   int    limit = Bars - counted_bars;

   int i;
   for (i=0; i<limit; i++) {
      if (Close[i] >= (Low[i]+0.7*(High[i]-Low[i])) && (Open[i] >= Low[i]+0.7*(High[i]-Low[i])) && (Open[i] >= Low[i+1]) && (Close[i] >= Low[i+1]) && (Open[i] <= High[i+1]) && (High[i] <= High[i+1]) && (Close[i] <= High[i+1]) && (Low[i] <= Low[i+1] - 0.3*(High[i]-Low[i])) && (1*(High[i] - Low[i]) >= ((High[i+1] - Low[i+1]) + (High[i+2] - Low[i+2]) + (High[i+3] - Low[i+3]) + (High[i+4] - Low[i+4]) + (High[i+5] - Low[i+5]))/5)) {
         if (Close[i] >= Low[i+1]) {
            upArrows[i] = Low[i] -0.3*(High[i]-Low[i]);
           // PlaySound("Alert.wav");
            Alert(Symbol(), " Bullish Pin Bar");
         } else if (Close[i] < Low[i+1]) {
            downArrows[i] = High[i];
           // PlaySound("Alert.wav");
            Alert(Symbol(), " Bullish Pin Bar");
         }
      }
   }

  }

Anyone?
 
Top