Please help with this quick bit of coding...

[Deleted]  

Hello

I have this code that I downloaded and use:

//+------------------------------------------------------------------+
//|                                               Daily High Low.mq4 |
//|                                           Copywrong 2005, RonT   |
//|                                 http://www.lightpatch.com/forex/ |
//+------------------------------------------------------------------+
#property copyright "RonT"
#property link      "http://www.lightpatch.com/forex/"

#property indicator_chart_window
#property indicator_buffers 2

double LOBuffer[];
double HIBuffer[];



//+------------------------------------------------------------------+
//| Custor indicator deinitialization function                       |
//+------------------------------------------------------------------+
int deinit()
  {
   return(0);
  }


//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int init()
  {
   SetIndexStyle(0,DRAW_LINE,0,1,DarkTurquoise);
   SetIndexBuffer(0,LOBuffer);

   SetIndexStyle(1,DRAW_LINE,0,1,Crimson);
   SetIndexBuffer(1,HIBuffer);

   return(0);
  }



//+------------------------------------------------------------------+
//| Custom indicator iteration function                              |
//+------------------------------------------------------------------+
int start()

  {
   int    counted_bars=IndicatorCounted();
   int    limit, i;

   double dayhigh=0;
   double daylow=999;
   
   if(counted_bars<0) return(-1);
   limit=(Bars-counted_bars)-1;

   for (i=limit; i>=0;i--)
     { 
      if (dayhigh<High[i]) {dayhigh=High[i];}
      if (daylow>Low[i])   {daylow=Low[i];  }

      if (TimeDay(Time[i])!=TimeDay(Time[i+1]))
        { 
         // reset limits when day changes
         dayhigh=High[i];
         daylow=Low[i];
        }
   
      LOBuffer[i]=daylow;
      HIBuffer[i]=dayhigh;

     }
   return(0);
  }

I would like for this code to act on the close of the highest and lowest bars, and to discount the shadows.

Can anyone help with this?

I have tried this myself with little success.

Thank you

Antony

 

show your code

[Deleted]  


//+------------------------------------------------------------------+
//| Daily High Low.mq4 |
//| Copywrong 2005, RonT |
//| http://www.lightpatch.com/forex/ |
//+------------------------------------------------------------------+
#property copyright "RonT"
#property link "http://www.lightpatch.com/forex/"

#property indicator_chart_window
#property indicator_buffers 2

double LOBuffer[];
double HIBuffer[];

//+------------------------------------------------------------------+
//| Custor indicator deinitialization function |
//+------------------------------------------------------------------+
int deinit()
{
return(0);
}


//+------------------------------------------------------------------+
//| Custom indicator initialization function |
//+------------------------------------------------------------------+
int init()
{
SetIndexStyle(0,DRAW_LINE,0,1,DarkTurquoise);
SetIndexBuffer(0,LOBuffer);

SetIndexStyle(1,DRAW_LINE,0,1,Crimson);
SetIndexBuffer(1,HIBuffer);

return(0);
}

//+------------------------------------------------------------------+
//| Custom indicator iteration function |
//+------------------------------------------------------------------+
int start()

{
int counted_bars=IndicatorCounted();
int limit, i;

double dayhigh=0;
double daylow=999;

if(counted_bars<0) return(-1);
limit=(Bars-counted_bars)-1;

for (i=limit; i>=0;i--)
{
if (dayhigh<High[i]) {dayhigh=High[i];}
if (daylow>Low[i]) {daylow=Low[i]; }

if (TimeDay(Time[i])!=TimeDay(Time[i+1]))
{
// reset limits when day changes
dayhigh=High[i];
daylow=Low[i];
}

LOBuffer[i]=daylow;
HIBuffer[i]=dayhigh;

}
return(0);
}

[Deleted]  

Its a code that a got from the code base on mql4.com

Thanks

Antony

 

this isn't your code that's what you downloaded (this is what wrote above)

[Deleted]  

Yes I wrote that above:

"Its a code that a got from the code base on mql4.com "

It can still be modifed to suit individual needs?

Thanks

Antony

 

opps sorry (then what is your problem)

[Deleted]  

Thats ok, right, the indicator shows where that market is trending in relation to the high and low of the day.

The indicator counts the shadow of each candle, I would like this to use the close instead.

I hope I explaine that ok, my explanations are never the best.

Thanks

Antony

 
//+------------------------------------------------------------------+
//|                                               Daily High Low.mq4 |
//|                                           Copywrong 2005, RonT   |
//|                                 http://www.lightpatch.com/forex/ |
//+------------------------------------------------------------------+
#property copyright "RonT"
#property link      "http://www.lightpatch.com/forex/"

#property indicator_chart_window
#property indicator_buffers 2

double LOBuffer[];
double HIBuffer[];



//+------------------------------------------------------------------+
//| Custor indicator deinitialization function                       |
//+------------------------------------------------------------------+
int deinit()
  {
   return(0);
  }


//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int init()
  {
   SetIndexStyle(0,DRAW_LINE,0,1,DarkTurquoise);
   SetIndexBuffer(0,LOBuffer);

   SetIndexStyle(1,DRAW_LINE,0,1,Crimson);
   SetIndexBuffer(1,HIBuffer);

   return(0);
  }



//+------------------------------------------------------------------+
//| Custom indicator iteration function                              |
//+------------------------------------------------------------------+
int start()

  {
   int    counted_bars=IndicatorCounted();
   int    limit, i;

   double dayhigh=0;
   double daylow=999;
   
   if(counted_bars<0) return(-1);
   limit=(Bars-counted_bars)-1;

   for (i=limit; i>=0;i--)
     { 
      if (dayhigh<High[i]) {dayhigh=High[i];}
      if (daylow>Low[i])   {daylow=Low[i];  }

      if (TimeDay(Time[i])!=TimeDay(Time[i+1]))
        { 
        if (Open[i] < Close[i])
         {
         // reset limits when day changes
         dayhigh=Close[i];
         daylow=Open[i];
         }
        else if (Open[i] > Close[i])
         {
         dayhigh=Open[i];
         daylow=Close[i];
         }
        }
   
      LOBuffer[i]=daylow;
      HIBuffer[i]=dayhigh;

     }
   return(0);
  }
 

& the name of it u should change to Daily OPEN CLOSE.mq4 LOL

[Deleted]  

Thanks it works a lot better, but just to be a pain in the backside :( I find it is still following the lows and highs of the shadows of the candles throughout the day instead of the close.

Basically, if the market makes a new low for that day then the indicator shows it with the line accross the close of the lowest bear candle of that trading day.

Thanks again

Antony