OnOrderTrace()

<< Click to Display Table of Contents >>

Navigation:  NinjaScript > Language Reference > Strategy >

OnOrderTrace()

Previous page Return to chapter overview Next page

Definition

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

 

Warning:  Overriding this method with 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

timestamp

The time that the order trace was generated

message

The message that is generated

 

 

Examples

ns


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 the NinjaScript Educational Resources section of our support forum.