Hi jcl. I was fooling with the ReverseAtStop script with different Assets and BarPeriods and got what looks a bit like a bug - please run this with XAU/USD and look at 2013-04-15. Is it correct? Other BarPeriods & Assets don't do this... Thanks.

Code:
// TMF that opens an opposite trade when stopped out,
// and opens a new trade when profit target is reached (Zorro 1.22 and above)
int ReverseAtStop()
{
	printf("#\nTick-price=%.8f",priceClose());
  if(TradeIsStop) { // stop loss hit?
    if(TradeIsShort)
      enterLong(ReverseAtStop); // enter opposite trade
    else 
      enterShort(ReverseAtStop);
  }
  if(TradeIsProfit) { // profit target hit?
    if(TradeIsShort)
      enterShort(ReverseAtStop); // enter same trade again
    else 
      enterLong(ReverseAtStop);
  }
// call the TMF at stop loss / profit target only  
  return 16;
}

function run()
{
	set(LOGFILE);
	set(PLOTNOW);
  set(TICKS);  // normally needed for TMF
  Weekend = 3; // don't run TMF at weekend
	BarPeriod	= 1440;
  Stop = 10000*PIP;
  TakeProfit = 10000*PIP;
  if(Bar == LookBack) // enter the first trade directly at the first bar
    enterLong(ReverseAtStop);
}