Thanks Mike. I'm using Quotes Plus as a database and had some problems recently (crashes of AB when using too many GetExtraData calls), which is currently under AB support's investigation. Today I've noticed that I get signals (and trades) for indexes, although I have them excluded in AB's filter. Additional crashes as well. There suddenly seem to be strange things going on with my AB + QP installation...
Thanks very much for trying. PS: How did you include the date in the trace output? Been trying this as well, but I couldn't find the corresponding function. --- In amibroker@yahoogroups.com, "Mike" <sfclimb...@...> wrote: > > Works fine for me. I've added a simple trading system to your code (as > well as a date to your Trace output). > Running it against the AmiBroker trial version database with a watchlist > of (AA, CAT, ^DJI) works fine. Note that trades are never taken for ^DJI > since there is insufficient equity (initial equity set to 10,000). > _SECTION_BEGIN( "Money Manager: Percent Volatility" ); > systemMMVolatilityPercent = Param( "Percent", 2, 0.1, 10, 0.1 ); > systemMMVolatilityATR = Param( "ATR Period", 20, 1, 250, 1 ); > _SECTION_END(); > > StaticVarSet( "MyAtr" + Name( ), ATR( systemMMVolatilityATR ) ); > > fast = MA( Close, 5 ); > slow = MA( Close, 50 ); > Buy = Cross( fast, slow ); > Sell = Cross( slow, fast ); > SetPositionSize( 2, spsPercentOfEquity ); > > SetCustomBacktestProc( "" ); > > if ( Status( "action" ) == actionPortfolio ) > { > bo = GetBacktesterObject(); > bo.PreProcess(); > dates = DateTime(); > > for ( bar = 0; bar < BarCount; bar++ ) > { > for ( sig = bo.GetFirstSignal( bar ); sig; sig = > bo.GetNextSignal( bar ) ) > { > if ( sig.IsEntry() ) > { > CurrentEquity = bo.Equity; > Test = StaticVarGet( "MyAtr" + sig.Symbol ); > _TRACE( NumToStr( dates[bar], formatDatetime ) + " " + > sig.symbol + " " + NumToStr( Test[bar] ) + " " + " " + NumToStr( bar ) > ); > // units = CurrentEquity * ( systemMMVolatilityPercent / 100 ) / > Test[bar]; > // sig.PosSize = sig.Price * units; > } > } > > bo.ProcessTradeSignals( bar ); > } > > bo.PostProcess(); > } > Mike > --- In amibroker@yahoogroups.com, "rise_t575" <rise_t@> wrote: > > > > Thank you Mike. > > > > My knowledge of the custom backtester is still pretty limited (my > first > > try), although I have been readining everything I could get my hands > on. > > > > Now the ticker symbols the _TRACE window is giving me are completely > > different (exclusive) than the ticker symbols that come up in the > > backtesting window. > > > > Could someone look over the code & tell me what is wrong here? > > > > Thanks in advance! > > > > > > _SECTION_BEGIN( "Money Manager: Percent Volatility" ); > > systemMMVolatilityPercent = Param( "Percent", 2, 0.1, 10, 0.1 ); > > systemMMVolatilityATR = Param( "ATR Period", 20, 1, 250, 1 ); > > _SECTION_END(); > > > > StaticVarSet( "MyAtr"+Name( ), ATR(systemMMVolatilityATR) ); > > > > SetCustomBacktestProc(""); > > > > if ( Status( "action" ) == actionPortfolio ) > > { > > bo = GetBacktesterObject(); > > bo.PreProcess(); > > > > for ( bar = 0; bar < BarCount; bar++ ) > > { > > for ( sig = bo.GetFirstSignal( bar ); sig; sig = > > bo.GetNextSignal( bar ) ) > > { > > if(sig.IsEntry()) > > { > > CurrentEquity = bo.Equity; > > Test = StaticVarGet( "MyAtr"+sig.Symbol); > > _TRACE(sig.symbol + " " + NumToStr(Test[bar])+" " + " > " > > + NumToStr(bar)); > > // units = CurrentEquity * ( systemMMVolatilityPercent > / > > 100 ) / Test[bar]; > > // sig.PosSize = sig.Price * units; > > } > > } > > bo.ProcessTradeSignals( bar ); > > } > > bo.PostProcess(); > > >