Hello, One of AmiBroker users brought this to my attention:
http://forum.tssupport.com/viewtopic.php?t=6058 Rarely I see so much nonsense posted about AmiBroker. Below is the AFL that does what MC people were thinking is "impossible" in AB: SetPositionSize( 10000, spsValue ); // dollar value of each position Buy = True; // just open long trade at very first bar of test Sell = Short = Cover = False; // the rest done in custom backtester code. SetOption("MaxOpenPositions", 2 ); SetOption("UseCustomBacktestProc", True ); if( Status("action") == actionPortfolio ) { bo = GetBacktesterObject(); bo.PreProcess(); // Initialize backtester for(bar=0; bar < BarCount; bar++) { bo.ProcessTradeSignals( bar ); totalprofit = 0; for( pos = bo.GetFirstOpenPos(); pos; pos = bo.GetNextOpenPos() ) { totalprofit += pos.GetProfit(); } if( totalprofit > 2000 ) { for( pos = bo.GetFirstOpenPos(); pos; ) { price = pos.GetPrice( bar + 1, "O" ); symb = pos.Symbol; pos = bo.GetNextOpenPos(); bo.ExitTrade( bar + 1, symb, price ); // exit long bo.EnterTrade( bar + 1, symb, False, price, 10000 ); // enter short } } } bo.PostProcess(); // Finalize backtester } Best regards, Tomasz Janeczko amibroker.com ------------------------------------ **** IMPORTANT PLEASE READ **** This group is for the discussion between users only. This is *NOT* technical support channel. TO GET TECHNICAL SUPPORT send an e-mail directly to SUPPORT {at} amibroker.com TO SUBMIT SUGGESTIONS please use FEEDBACK CENTER at http://www.amibroker.com/feedback/ (submissions sent via other channels won't be considered) For NEW RELEASE ANNOUNCEMENTS and other news always check DEVLOG: http://www.amibroker.com/devlog/ 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:[email protected] mailto:[email protected] <*> 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/
