[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[amibroker] AFL help



PureBytes Links

Trading Reference Links

Can anyone help

I'm trying to find the median profit after a number of event occur 
but am having trouble with Median(array,period) function.

If I copy the profit results from the exploration to Excel I can use 
the Median function in Excel but would like to plot it on my price 
chart from within AFL.

Any help or direction would be appreciated.
Art F

//CODE:
Plot( C, "Price", colorBlack,128 ); 
MA40=MA(C,40);
event=Cross(C,MA40);
eventnum = LastValue( Cum( event) ); 

IIf(event,day1profit=(Ref(C,1)-C)/C*100,Null);
IIf(event,day2profit=(Ref(C,2)-C)/C*100,Null);
IIf(event,day3profit=(Ref(C,3)-C)/C*100,Null);

day1profitMedian=Median(day1profit,eventnum );
day2profitMedian=Median(day2profit,eventnum );
day3profitMedian=Median(day3profit,eventnum );

Filter=event;
AddColumn(eventnum ,"Number of Events",1.0);
AddColumn(day1profit,"1st day P/L",1.2);
AddColumn(day2profit,"2nd day P/L",1.2);
AddColumn(day3profit,"3rd day P/L",1.2);


Title = StrFormat("{{NAME}} - {{INTERVAL}} {{DATE}} Open %g, Hi %g, 
Lo %g, Close %g", O, H, L, 

C)+EncodeColor(colorViolet )+
"\n            40 MA      "+"      Number of Events ="+eventnum ;
Title=Title+
"     Median 1st day P/L = "+NumToStr(day1profitMedian,1.2)+
"     Median 2nd day P/L = "+NumToStr(day2profitMedian,1.2)+
"     Median 3rd day P/L = "+NumToStr(day3profitMedian,1.2);
Plot (MA40,"40 DMA",colorViolet,styleThick ,1);
PlotShapes(    event * shapeCircle , colorGreen ,0, High, 25 ); 



------------------------------------

Please note that this group is for discussion between users only.

To get support from AmiBroker please send an e-mail directly to 
SUPPORT {at} amibroker.com

For NEW RELEASE ANNOUNCEMENTS and other news always check DEVLOG:
http://www.amibroker.com/devlog/

For other support material please check also:
http://www.amibroker.com/support.html
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/amibroker/

<*> Your email settings:
    Individual Email | Traditional

<*> To change settings online go to:
    http://groups.yahoo.com/group/amibroker/join
    (Yahoo! ID required)

<*> To change settings via email:
    mailto:amibroker-digest@xxxxxxxxxxxxxxx 
    mailto:amibroker-fullfeatured@xxxxxxxxxxxxxxx

<*> To unsubscribe from this group, send an email to:
    amibroker-unsubscribe@xxxxxxxxxxxxxxx

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/