Thanks for the responses all! On a related question now I'm trying to create a more detailed trade log function to diagnose my algo's performance.

Say that I am working with 5-min bars. I want to know each time a resting limit order is filled in simulation (as either an entry or stop loss/profit target), what the high and low of that bar in which the simulated order was filled. Output should be to a csv file with columns identifying the time, bar number, trade type (entry/stop loss/profit target) and the OHLC prices of the bar.

However, it's not clear to me from the manual how order fill events are handled in simulated trade...

Should I be using a TMF outside the main run() function like this? I ran the below and couldn't even get it to print to the default logfile. Also - how do I get the actual fill price of the simulated trade from Entry/Stop/TakeProfit and not the price offset variable I provided as an argument?

Code

int ExtremeHitLog()
{
	if(TradeIsEntry) {
			string line = strf(
			  "Entry, %02i/%02i/%02i %02i:%02i, %.5f, %.5f, %.5f, %.5f\n",
			  day(),month(),year()%100,hour(),minute(),
			  priceOpen(),priceHigh(),priceLow(),priceClose());
		
			file_append("Data\\extremehits.csv",line);
		}
	

	//if(TradeIsStop)

	//if(TradeIsProfit)

   return 16; // trigger tmf at next event
}