Prevent trade signals for certain condition in CBT

Hi Guys,

I’m using the mid-level custom backtester with a rotational strategy and I want to prevent it from processing any trade signals under certain circumstances.

if(worstrank > 134){

for(sig = bo.GetFirstSignal(bar); sig; sig = bo.GetNextSignal(bar)){

sig.Price = -1;

}

bo.ProcessTradeSignals(bar);

}else{   

bo.ProcessTradeSignals(bar);
}

I have this code which prevents new buys from being bought on these bars but it still seems to process the sells. Does anyone know a better way to prevent trade signals from being processed on a given bar?

Cheers

You can use scoreNoRotate as described here: https://www.amibroker.com/guide/afl/enablerotationaltrading.html

1 Like