the internet is filled up with a few idiots. lets focus on making use
of the best oppurtunites and forget the whiners.
--- In [email protected], "Tomasz Janeczko" <gro...@...> wrote:
>
> 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
>