Hello, I want to try this idea on major stock index.
I want to be 100% invested in the index if c>ma(c,200), and want to be 50% invested in the index when c<ma(c,200) I tried this AFL, and it seems to work. Buy=true;//always have a position in the market sell=cross(ma(c,200),c) or cross(c,ma(c,200));//on a cross of the close above or below MA positionsize=IIF(c>ma(c,200),-100,-50);//if c> ma then 100% Long else 50% long; My questions are, is this a valid AFL? Does it do what I want it to do? Second how can I code it for many stock index at a time? Let's say I want to be 5% long when above and 2% long when below the moving average. Any ideas appreciated Antonio ------------------------ Yahoo! Groups Sponsor --------------------~--> Great things are happening at Yahoo! Groups. See the new email design. http://us.click.yahoo.com/TISQkA/hOaOAA/yQLSAA/GHeqlB/TM --------------------------------------------------------------------~-> 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 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/ <*> To unsubscribe from this group, send an email to: [EMAIL PROTECTED] <*> Your use of Yahoo! Groups is subject to: http://docs.yahoo.com/info/terms/
