AFL Help needed

VJAY

Well-Known Member
#1
Dear friends/AFL experts,
Please help to modify following afl code.....
Its ma line which change colour with its movement ...eg up-green down-red.flat blue...Now i want to show fig (approximate) of opposite change of colour ...eg...when currently its in green then I want to show the fig (aprox)when it change to blue or red.....is it possible?i need this fig right side of chart where current rate shows...with colour...



_SECTION_BEGIN("MA");
Len = Param("Periods", 30, 10, 60, 10 );
Av = MA(C, Len);
Color = IIf(Av > Ref(Av,-1) AND C > Av, colorGreen, IIf(Av < Ref(Av,-1) AND C < Av, colorRed, colorBlue));
Plot(Av, "", Color, ParamStyle("Av",styleThick, maskAll));
 
Last edited:
#2
Dear friends/AFL experts,
Please help to modify following afl code.....
Its ma line which change colour with its movement ...eg up-green down-red.flat blue...Now i want to show fig (approximate) of opposite change of colour ...eg...when currently its in green then I want to show the fig (aprox)when it change to blue or red.....is it possible?i need this fig right side of chart where current rate shows...with colour...



_SECTION_BEGIN("MA");
Len = Param("Periods", 30, 10, 60, 10 );
Av = MA(C, Len);
Color = IIf(Av > Ref(Av,-1) AND C > Av, colorGreen, IIf(Av < Ref(Av,-1) AND C < Av, colorRed, colorBlue));
Plot(Av, "", Color, ParamStyle("Av",styleThick, maskAll));
Hello Vijay

As long as it is a simple MA the code can be easily done . . .

try this

Code:
Plot(SelectedValue(Ref(C,-Len+1)),"",colorLightGrey,styleDashed,0,0,10);
this code will plot the level which decides if MA is increasing (Av > Ref(Av,-1)) or decreasing (Av < Ref(Av,-1),)
if current price is above this, we have MA increasing, price below this level then MA is decreasing

if you want only the value and don't want the horizontal line then use

Code:
Plot(SelectedValue(Ref(C,-Len+1)),"",colorLightGrey,stylenoline,0,0,10);


if you insist on colors etc then will give it another try . . .

:) Happy
 
Last edited:

VJAY

Well-Known Member
#3
Hello Vijay

As long as it is a simple MA the code can be easily done . . .

try this

Code:
Plot(SelectedValue(Ref(C,-Len+1)),"",colorLightGrey,styleDashed,0,0,10);
this code will plot the level which decides if MA is increasing (Av > Ref(Av,-1)) or decreasing (Av < Ref(Av,-1),)
if current price is above this, we have MA increasing, price below this level then MA is decreasing

if you want only the value and don't want the horizontal line then use

Code:
Plot(SelectedValue(Ref(C,-Len+1)),"",colorLightGrey,stylenoline,0,0,10);


if you insist on colors etc then will give it another try . . .

:) Happy
Thanks happy singh.......its same which i needed ...:thumb:
 
#7
Thanks...noproblem ...take your time...for me its need for some testing purpose :)
Code:
_SECTION_BEGIN("MA");
Len =	Param("Len",20,2,100,1);
Av	 =	MA(C, Len);
Color =	IIf(Av > Ref(Av,-1) AND C > Av, colorGreen, IIf(Av < Ref(Av,-1) AND C < Av, colorRed, colorBlue));
Plot(Av, "", Color, ParamStyle("Av",styleThick, maskAll));

Plot(SelectedValue(Ref(C,-Len)),"",colorBrightGreen,styleDashed,0,0,10); // Slope of MA  up/down 
Plot(SelectedValue(Ref(MA(C,Len-1),-1)),"",colorBlueGrey,  styleDashed,0,0,10); // Price Close  above/below Av
_SECTION_END();
check this . . .


:) Happy
 
Last edited:

Similar threads

Trade in Rs 20, No more % brokerage

Name:Phone:
Email:City:
State:
Are you a day trader?