Output signals of backtester

Hi

I'm new to the forum but I'm using AB for a couple of years now. Actually I used it mainly to run backtest but I'm also familiar with the scanner and explorer. With the beginning of next year I would like to use AB also for EOD signal generation.

My questions is:
Is there a way to generate/output the signals of the backtester (e.g using the _TRACE function in the CBT)?

I'm asking because I want to limit the signals to the actual portfolio. Means I don't want to see any possible Sell signal in the market using the Scanner or Explorer. I would like to limit the sell/stop signals to the positions in the portfolio of the backtest.

I have the feeling I'm missing something, but unfortunately I haven't found an answer in the forum, in the manual or on Google.

Thanks for your help - any link / hint is appreciated. :slight_smile:
Torsten

Or use RawTextOuput
https://www.amibroker.com/guide/a_custombacktest.html

SetPositionSize( 1, spsShares );

period = 20;
m = MA( Close, period ); 
Buy = Cross( Close, m ); 
Sell = Cross( m, Close ); 

StaticVarSet( "Date_" + Name(), DateTime() );

SetCustomBacktestProc("");
if( Status("action") == actionPortfolio )  {
	
	bo = GetBacktesterObject(); 
	bo.PreProcess();

	/// @link https://forum.amibroker.com/t/access-datetime-of-signal-bar-within-a-custom-backtest/9346
	for (i = 0; i < BarCount; i++) {
		for (sig = bo.GetFirstSignal(i); sig; sig = bo.GetNextSignal(i)) {
			if (sig.IsEntry()) {
				sig_dt = StaticVarGet( "Date_" + sig.Symbol );
				currentEntryDateTime = sig_dt[i];
				//_TRACEF( "Sig Entry Date (%s): %s", sig.Symbol, DateTimeToStr( currentEntryDateTime ) );				
				bo.RawTextOutput( StrFormat("Sig Entry Date (%s): %s", sig.Symbol, DateTimeToStr( currentEntryDateTime )) );
			}
		}
        
		bo.ProcessTradeSignals( i );
	}
    
	bo.PostProcess();
}
4 Likes

Hi fxshrat,

Many thanks - that's exactly what I was loking for.