Idicator

 

Hi everyone,

Can anybody help me? I am looking for an indicator that will add the high and low together then divide by 2 and plot them on the main chart of any pair and time frame.

Also, it must be a straight line from point to point, no curves. I have been plotting them by hand on graph paper and it is very time consuming.

I don't seem to be getting any response, so I am trying to write the code but having problems. Can anybody go through it and give some guidance please.

#property indicator_chart_window

#property indicator_buffers 1

#property indicator_color1 Black

//---- input parameters

extern int ADRPeriod=0;

//---- buffers

double ADRBuffer[];

double TempBuffer[];

//+------------------------------------------------------------------+

//| Custom indicator initialization function |

//+------------------------------------------------------------------+

int init()

{

string short_name;

//---- 1 additional buffer used for counting.

IndicatorBuffers(2);

//---- indicator line

SetIndexStyle(0,DRAW_LINE);

SetIndexBuffer(0,ADRBuffer);

SetIndexBuffer(1,TempBuffer);

//---- name for DataWindow and indicator subwindow label

short_name="ADR("+ADRPeriod+")";

IndicatorShortName(short_name);

SetIndexLabel(0,short_name);

//----

SetIndexDrawBegin(0,ADRPeriod);

//----

return(0);

}

//+------------------------------------------------------------------+

//| Average Daily Range |

//+------------------------------------------------------------------+

int start()

{

//----Special function start()

{

int A=High;

int B=Low;

int C=Gipo (A,B)/2;

return;

int i,counted_bars=IndicatorCounted();

//----

if(Bars<=ADRPeriod) return(0);

//---- initial zero

if(counted_bars<1)

for(i=1;i<=ADRPeriod;i++) ADRBuffer[Bars-i]=0.0;

//----

i=Bars-counted_bars-1;

while(i>=0)

{

double high=High;
double low =Low;
if(i==Bars-1) TempBuffer=high-low;
else
{
double prevclose=Close[i+1];
TempBuffer=MathMax(high,prevclose)-MathMin(low,prevclose);
}
i--;
}
//----
if(counted_bars>0) counted_bars--;
int limit=Bars-counted_bars;
for(i=0; i<limit; i++)
int ADRBuffer[]=(PRICE_HIGH+PRICE_LOW/2);OnArray(TempBuffer,Bars,ADRPeriod,0,MODE_HIGH+MODE_LOW/2);
//----
return(0);
}
//+---------#property indicator_chart_window
int
//----Special function start()

//+------------------------------------------------------------------+
//| Custom indicator initialization function |
//+------------------------------------------------------------------+


//---- indicators
//----


//+------------------------------------------------------------------+
//| Custom indicator deinitialization function |
//+------------------------------------------------------------------+


//----

//-

//+------------------------------------------------------------------+
//| Custom indicator iteration function | Phillwon