?> QuantXpress – Deliver high performance automated trading and connectivity solutions



Strategy Logging


During the development phase, it is common practice to insert logging statement within the strategy code to produce informative logs at runtime, whether for troubleshooting or for analysis purposes. There are four category of output you can generate from your strategy implementation class. The output generated is shown in the strategy instance log window of the trading terminal.
TraceLogError is used to writes the error log to the trading terminal TraceLogWarning is used to writes the warning log to the trading terminal TraceLogInfo is used to writes the error log to the trading terminal TraceStrategyExecutionMessage is special log used by strategy to notify some important event of the strategy. This information publishes in a specific log window where traders can monitor the important state of the strategy. Most of the time here one can publish the Profit/Loss information after the completion of strategy logical cycle.
 
protected override void OnStopping()
{
    string errorString = string.Empty;
    if (!base.CancelAllOpenOrders(30, out errorString))
        TraceLogInfo("Cancel all open order operation failed. Reason : " + errorString);

    TraceLogInfo("Strategy Instance [" + base.GetStrategyInstanceInfo().InstanceName + "] Stopped.");
 }
...................
...................

base.TraceStrategyExecutionMessage(string.Format("SELL-IV-Difference:{0},
                                   Target-IV-Difference:{1}, 
                                   FirstLegExecutedIV:{2}, 
                                   SecondLegExecutedIV:{3}, 
                                   Un-HedgedQuantity:{4}",
                                   Math.Round(executedIVDiff * 100, 2),
                                   InputTargetSellIVBenchmark * 100,
                                   Math.Round(firstLegExecutedIV * 100),
                                   Math.Round(secondLegExecutedIV * 100),
                                   Output_UnHedgedDeltaQuantity));