I'm sorry. My English is not really good, but i have some problem, with my indicator.
What does it do?
1) First of all, it puts the data into the TempBuffer[i] from linear weighted MA with period 13.
2) Then from each bar's low is subtract MA and puts data into the M_Range[i].
3) After all, it finds the arithmetic average all bars and draws the static line from this average number.
I have 2 same indicators for Low and for High.
#property indicator_separate_window
#property indicator_buffers 1
#property indicator_color1 Silver
//---- input parameters
extern int BearsPeriod=13;
extern double Mult = 1.00;
//---- buffers
double BearsBuffer[];
double LevBuffer[];
double TempBuffer[];
//+------------------------------------------------------------------+
//| Custom indicator initialization function |
//+------------------------------------------------------------------+
int init()
{
string short_name;
//---- 1 additional buffer used for counting.
IndicatorBuffers(3);
IndicatorDigits(Digits);
//---- indicator line
SetIndexStyle(0,DRAW_HISTOGRAM);
SetIndexBuffer(0,BearsBuffer);
SetIndexBuffer(1,LevBuffer);
SetIndexBuffer(2,TempBuffer);
//---- name for DataWindow and indicator subwindow label
short_name="Bears("+BearsPeriod+")";
IndicatorShortName(short_name);
SetIndexLabel(0,short_name);
SetLevelValue(0,0.00);
//----
return(0);
}
//+------------------------------------------------------------------+
//| Bears Power |
//+------------------------------------------------------------------+
int start()
{
int
i,
counted_bars=0;
//----
if(Bars<=BearsPeriod)
return(0);
//----
int
limit=Bars-counted_bars;
if(counted_bars>0)
limit++;
for(i=0; i<limit; i++)
TempBuffer[i]=iMA(NULL,0,BearsPeriod,0,MODE_LWMA,PRICE_MEDIAN,i);
//----
double M_Range[];
ArrayResize(M_Range,Bars);
i=Bars-BearsPeriod-counted_bars-1;
while(i>=0)
{
BearsBuffer[i]=Low[i]-TempBuffer[i];
M_Range[i]=MathAbs(BearsBuffer[i]);
i--;
}
for(i=0; i<=Bars-BearsPeriod-1; i++)
double Volume_B = Volume_B+M_Range[i];
double Value = NormalizeDouble(Volume_B/(Bars-BearsPeriod-1),5)*Mult;
for(i=0; i<=Bars-BearsPeriod-1; i++)
LevBuffer[i]=Value;
SetLevelValue(1,Value);
SetLevelValue(2,-Value);
//----
return(0);
}
And for High
#property indicator_separate_window
#property indicator_buffers 1
#property indicator_color1 Silver
//---- input parameters
extern int BullsPeriod=13;
extern double Mult = 1.00;
//---- buffers
double BullsBuffer[];
double LevBuffer[];
double TempBuffer[];
//+------------------------------------------------------------------+
//| Custom indicator initialization function |
//+------------------------------------------------------------------+
int init()
{
string short_name;
//---- 1 additional buffer used for counting.
IndicatorBuffers(3);
IndicatorDigits(Digits);
//---- indicator line
SetIndexStyle(0,DRAW_HISTOGRAM);
SetIndexBuffer(0,BullsBuffer);
SetIndexBuffer(1,LevBuffer);
SetIndexBuffer(2,TempBuffer);
//---- name for DataWindow and indicator subwindow label
short_name="Bulls("+BullsPeriod+")";
IndicatorShortName(short_name);
SetIndexLabel(0,short_name);
SetLevelValue(0,0.00);
//----
return(0);
}
//+------------------------------------------------------------------+
//| Bulls Power |
//+------------------------------------------------------------------+
int start()
{
int
i,
counted_bars=0;
//----
if(Bars<=BullsPeriod) return(0);
//----
int limit=Bars-counted_bars;
if(counted_bars>0) limit++;
for(i=0; i<limit; i++)
TempBuffer[i]=iMA(NULL,0,BullsPeriod,0,MODE_LWMA,PRICE_MEDIAN,i);
//----
double M_Range[];
ArrayResize(M_Range,Bars);
i=Bars-BullsPeriod-counted_bars-1;
while(i>=0)
{
BullsBuffer[i]=High[i]-TempBuffer[i];
M_Range[i]=MathAbs(BullsBuffer[i]);
i--;
}
for(i=0; i<=Bars-BullsPeriod-1; i++)
double Volume_B = Volume_B+M_Range[i];
double Value = NormalizeDouble(Volume_B/(Bars-BullsPeriod-1),5)*Mult;
for(i=0; i<=Bars-BullsPeriod-1; i++)
LevBuffer[i]=Value;
SetLevelValue(1,Value);
SetLevelValue(2,-Value);
//----
return(0);
}
//+------------------------------------------------------------------+
This is indicators in Metatrader.

This is in JForex, after compilation.

Please, could you help me with this problem?