How do I plot entry signals after CustomBackTest?

Hello I am facing to problem how to plot (as an arrow or just a true/false line) for entry-buy signals if I use a custom back testing and remove some signals here.

Example:
Normally I can plot a buy/sell arrows in this way:

PlotShapes(Buy*shapeUpArrow, colorGreen, 0, Low, -50, 1);
PlotShapes(Sell*shapeDownArrow, colorRed, 0, High, -50, 1);

But let's say I have removed some signals in custom back test:

SetBacktestMode(backtestRegularRaw);
SetOption("usecustombacktestproc", True);

if( Status("action") == actionPortfolio ) {
	bo = GetBacktesterObject();
	bo.PreProcess();
	
	for( i = 0; i < BarCount; i++ ) {		
		for( sig = bo.GetFirstSignal( i ); sig; sig = bo.GetNextSignal( i )) {		
			if (sig.IsEntry()) {			
				sig.Price = -1; // delete this signal (based on some my own logic)				
			

So how to plot only valid signals, which were not removed? I know it is only for BACKTEST.. but exist a way how to "transform" it back to Formula for "normal" chart?

Non-programmatic route...
Right click result list and choose e.g "Show arrows for actual trades".
7


Otherwise... programmatic route... if you want to output CBT results in chart pane then you may use static variables to store them in CBT (StaticVarSet) and call them in chart pane (StaticVarGet).

https://www.amibroker.com/guide/afl/staticvarset.html
https://www.amibroker.com/guide/afl/staticvarget.html

3 Likes

Hello fxshrat,
thank you for your reply. I was able to do what I need in the programmatic way ... it works exactly as I requested, but the menu option Shows arrows for actual trades does not work for me. (too many arrows).
See my screen, where you can see both solution:

image