I tried to convert the mom indicator to work values on volume rather than price, but the indicator seems to be producing values per tick and at a great range, can someone look over this and see if you can ammend to produce a simlar indicaor to mom yet using my volume calculation, it is too volitile i was looking for more of a ma on the close of each bar for the selected period ie 14 or 40
hope you can help
//+------------------------------------------------------------------+
int init()
{
string short_name;
//---- indicator line
SetIndexStyle(0,DRAW_LINE);
SetIndexBuffer(0,MomBuffer);
//---- name for DataWindow and indicator subwindow label
short_name="Mom("+MomPeriod+")";
IndicatorShortName(short_name);
SetIndexLabel(0,short_name);
//----
SetIndexDrawBegin(0,MomPeriod);
//----
return(0);
}
//+------------------------------------------------------------------+
//| Momentum |
//+------------------------------------------------------------------+
int start()
{
int i,counted_bars=IndicatorCounted();
//----
if(Bars<=MomPeriod) return(0);
//---- initial zero
if(counted_bars<1)
for(i=1;i<=MomPeriod;i++) MomBuffer[Bars-i]=0.0;
//----
i=Bars-MomPeriod-1;
if(counted_bars>=MomPeriod) i=Bars-counted_bars-1;
while(i>=0)
{
spd[i]=(High[i]-Low[i]);
Print("high,low",High[i],Low[i]);
MomBuffer[i]=(((Close[i]- Low[i])/(High[i+MomPeriod]-Low[i+MomPeriod]))-50*Point)*Volume[i];
Print(MomBuffer[i]);
i--;
}
return(0);
hope you can help
//+------------------------------------------------------------------+
int init()
{
string short_name;
//---- indicator line
SetIndexStyle(0,DRAW_LINE);
SetIndexBuffer(0,MomBuffer);
//---- name for DataWindow and indicator subwindow label
short_name="Mom("+MomPeriod+")";
IndicatorShortName(short_name);
SetIndexLabel(0,short_name);
//----
SetIndexDrawBegin(0,MomPeriod);
//----
return(0);
}
//+------------------------------------------------------------------+
//| Momentum |
//+------------------------------------------------------------------+
int start()
{
int i,counted_bars=IndicatorCounted();
//----
if(Bars<=MomPeriod) return(0);
//---- initial zero
if(counted_bars<1)
for(i=1;i<=MomPeriod;i++) MomBuffer[Bars-i]=0.0;
//----
i=Bars-MomPeriod-1;
if(counted_bars>=MomPeriod) i=Bars-counted_bars-1;
while(i>=0)
{
spd[i]=(High[i]-Low[i]);
Print("high,low",High[i],Low[i]);
MomBuffer[i]=(((Close[i]- Low[i])/(High[i+MomPeriod]-Low[i+MomPeriod]))-50*Point)*Volume[i];
Print(MomBuffer[i]);
i--;
}
return(0);