Modifying MFI AFL-help

Sunny1

Well-Known Member
#1
Modifying MFI AFL-help me!!

_SECTION_BEGIN("MFI-BB");
P = ParamField("Price field",-1);
Periods = Param("Periods", 15, 2, 100, 1 );
Width = Param("Width", 2, 0, 10, 0.05 );
Color = ParamColor("Color", colorCycle );
Style = ParamStyle("Style");
b1 = BBandTop( P, Periods, Width );
b2 = BBandBot( P, Periods, Width );
BB = (b1 - b2);
Plot( MFI(BB), _DEFAULT_NAME(), ParamColor("Color", colorCycle ), ParamStyle("Style") );
_SECTION_END();

I wanted to modify the MFI but I get this error
"Error 5. Argument #1 has incorrect type (the function expects different argument type here)"

what I wanted to do is replace the 'periods' with the difference between the
bbandtop and bbandbot i.e., width of bollinger bands

I am not a programmer .Please help me to modify this MFI in AFL
 
Last edited:

asnavale

Well-Known Member
#3
Re: Modifying MFI AFL-help me!!

_SECTION_BEGIN("MFI-BB");
P = ParamField("Price field",-1);
Periods = Param("Periods", 15, 2, 100, 1 );
Width = Param("Width", 2, 0, 10, 0.05 );
Color = ParamColor("Color", colorCycle );
Style = ParamStyle("Style");
b1 = BBandTop( P, Periods, Width );
b2 = BBandBot( P, Periods, Width );
BB = (b1 - b2);
Plot( MFI(BB), _DEFAULT_NAME(), ParamColor("Color", colorCycle ), ParamStyle("Style") );
_SECTION_END();

I wanted to modify the MFI but I get this error
"Error 5. Argument #1 has incorrect type (the function expects different argument type here)"

what I wanted to do is replace the 'periods' with the difference between the
bbandtop and bbandbot i.e., width of bollinger bands

I am not a programmer .Please help me to modify this MFI in AFL
Hi sunny,

MFI takes a constant as arguement. That means the period must be a single number. What you are using is difference between the BBtop and BBBot which is an array. That means it is a series of numbers. Therefore, the code will not work.

-Anant
 

Sunny1

Well-Known Member
#4
Re: Modifying MFI AFL-help me!!

Hi sunny,

MFI takes a constant as arguement. That means the period must be a single number. What you are using is difference between the BBtop and BBBot which is an array. That means it is a series of numbers. Therefore, the code will not work.

-Anant
thanks and sorry for late reply

I know that but is there any other way to writes this formula??
 
#5
Sunny1

The following code can serve your pupose

_SECTION_BEGIN("MFI-BB");
Color = ParamColor("Color",Colorcycle);
Style = ParamStyle("Style");
Periods = Param("Periods",15,1,100,1);
Width = Param("Width",2,0.5,10,0.5);
PeriodsM= Param("MFI Periods",14,1,100,1);
MFIBB = BBandTop(MFI(PeriodsM), Periods, Width) - BBandBot(MFI(PeriodsM), Periods, Width);
Plot(MFIBB,"MFI-BB",color,style);
_SECTION_END();

vidyasagar
 

Similar threads