> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://docs.ninjatrader.com/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://docs.ninjatrader.com/_mcp/server.

# OnOrderTrace()

## Definition

An event driven method used for strategies which will allow you to customize the output of **TraceOrders**.

Warning: Overriding this method will disable the default order tracing that is generated by the NinjaTrader core. It is then up to you to pass the message generated to the NinjaTrader **output window** using the **Print()** method. Generally, overriding this method is not required.

## Method Return Value

This method does not return a value.

## Syntax

You must override the method in your strategy with the following syntax:

`protected override void OnOrderTrace(DateTime timestamp, string message)`

## Method Parameters

| Parameter     | Description                                 |
| ------------- | ------------------------------------------- |
| **timestamp** | The time that the order trace was generated |
| **message**   | The message that is generated               |

## Examples

```csharp
protected override void OnOrderTrace(DateTime timestamp, string message)
{
   // The below print would give us the default tracing
   Print(string.Format("{0} {1}", timestamp, message));
 
   // The extended example would also include the instrument fullname from our primary bars object
   if (BarsArray[0] != null)
       Print(string.Format("{0} {1} {2}", timestamp, message, BarsArray[0].Instrument.FullName));
}
```

## Additional Reference Samples

Additional reference code samples are available in the NinjaScript Educational Resources section of our support forum.