using Serilog;
using System.IO;
// This namespace holds all strategies and is required. Do not change it.
namespace NinjaTrader.Strategy
{
/// <summary>
/// Enter the description of your strategy here
/// </summary>
[Description("Enter the description of your strategy here")]
public class testloggingstrateg : Strategy
{
#region Variables
// Wizard generated variables
private int myInput0 = 1; // Default setting for MyInput0
// User defined variables (add any user defined variables below)
#endregion
private ILogger log;
/// <summary>
/// This method is used to configure the strategy and is called once before any strategy method is called.
/// </summary>
protected override void Initialize()
{
CalculateOnBarClose = false;
}
protected override void OnStartUp()
{
log = new LoggerConfiguration()
.WriteTo.File(@"c:\temp\" + Instrument.FullName + "log.txt")
.CreateLogger();
log.Information("Hello again!" + Instrument.FullName);
}
/// <summary>
/// Called on each bar update event (incoming tick)
/// </summary>
protected override void OnBarUpdate()
{
log.Information("Hello again!" + Instrument.FullName);
}
protected override void OnTermination()
{
// Clean up your resources here
}