SEARCH

Custom Search

download free software

game

game
play game

Wednesday, July 16, 2008

finding out the percentage change in a time range


1.This AFL is written to find out the % change of a particular field(price,volume,high...) for time range.
2.time range is inputed by clicking in two different places(first click on the first date and then click on the second date)
3.there will be a green vertical line on the screen for first click andthen a red vertical line for second clisk.
Hope all of you will enjoy.
Just copy the  following code into your formula editor and run


field=ParamField("field",3);
y=EndValue(field);
x=BeginValue(field);
Change=(y-x)*100/x;
period=EndValue(BarIndex())-BeginValue(BarIndex());

Plot(period,"Time period in days",colorBlue,styleNoDraw|styleNoRescale);
Color=IIf(O>C,colorRed,colorBrightGreen);
Plot(C,"close",Color,styleCandle|styleNoTitle);
Plot(Change,"% change",colorGreen,styleNoDraw|styleNoRescale);

No comments: