Production hardening: kill switch, circuit breaker, trailing stops, log level, holiday calendar
Some checks failed
Build and Test / build (push) Has been cancelled
Some checks failed
Build and Test / build (push) Has been cancelled
This commit is contained in:
59
src/NT8.Adapters/Strategies/MinimalTestStrategy.cs
Normal file
59
src/NT8.Adapters/Strategies/MinimalTestStrategy.cs
Normal file
@@ -0,0 +1,59 @@
|
||||
// File: MinimalTestStrategy.cs
|
||||
using System;
|
||||
using NinjaTrader.Cbi;
|
||||
using NinjaTrader.Data;
|
||||
using NinjaTrader.NinjaScript;
|
||||
using NinjaTrader.NinjaScript.Strategies;
|
||||
|
||||
namespace NinjaTrader.NinjaScript.Strategies
|
||||
{
|
||||
/// <summary>
|
||||
/// Minimal test strategy to validate NT8 integration and compilation.
|
||||
/// </summary>
|
||||
public class MinimalTestStrategy : Strategy
|
||||
{
|
||||
private int _barCount;
|
||||
|
||||
protected override void OnStateChange()
|
||||
{
|
||||
if (State == State.SetDefaults)
|
||||
{
|
||||
Name = "Minimal Test";
|
||||
Description = "Simple test strategy - logs bars only";
|
||||
Calculate = Calculate.OnBarClose;
|
||||
BarsRequiredToTrade = 1;
|
||||
}
|
||||
else if (State == State.DataLoaded)
|
||||
{
|
||||
_barCount = 0;
|
||||
Print("[MinimalTest] Strategy initialized");
|
||||
}
|
||||
else if (State == State.Terminated)
|
||||
{
|
||||
Print(string.Format("[MinimalTest] Strategy terminated. Processed {0} bars", _barCount));
|
||||
}
|
||||
}
|
||||
|
||||
protected override void OnBarUpdate()
|
||||
{
|
||||
if (CurrentBar < BarsRequiredToTrade)
|
||||
return;
|
||||
|
||||
_barCount++;
|
||||
|
||||
if (_barCount % 10 == 0)
|
||||
{
|
||||
Print(string.Format(
|
||||
"[MinimalTest] Bar {0}: {1} O={2:F2} H={3:F2} L={4:F2} C={5:F2} V={6}",
|
||||
CurrentBar,
|
||||
Time[0].ToString("HH:mm:ss"),
|
||||
Open[0],
|
||||
High[0],
|
||||
Low[0],
|
||||
Close[0],
|
||||
Volume[0]));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user