Fix deploy script: add NT8.Strategies.dll to deployment pipeline
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:
@@ -6,8 +6,8 @@ A single source of truth to ensure **first-time compile** success for all NinjaT
|
||||
## Golden Rules (Pin These)
|
||||
1. **NT8 only.** No NT7 APIs. If NT7 concepts appear, **silently upgrade** to NT8 (proper `OnStateChange()` and `protected override` signatures).
|
||||
2. **One file, one public class.** File name = class name. Put at the top: `// File: <ClassName>.cs`.
|
||||
3. **Namespaces:**
|
||||
- Strategies → `NinjaTrader.NinjaScript.Strategies`
|
||||
3. **Namespaces:**
|
||||
- Strategies → `NinjaTrader.NinjaScript.Strategies`
|
||||
- Indicators → `NinjaTrader.NinjaScript.Indicators`
|
||||
4. **Correct override access:** All NT8 overrides are `protected override` (never `public` or `private`).
|
||||
5. **Lifecycle:** Use `OnStateChange()` with `State.SetDefaults`, `State.Configure`, `State.DataLoaded` to set defaults, add data series, and instantiate indicators/Series.
|
||||
@@ -136,4 +136,127 @@ Compile Checklist (Preflight)
|
||||
DebugMode gating for Print() calls.
|
||||
""").format(date=datetime.date.today().isoformat())
|
||||
|
||||
files["NT8_Templates.md"] = textwrap.dedent("""
|
||||
files["NT8_Templates.md"] = textwrap.dedent("""
|
||||
|
||||
---
|
||||
|
||||
# NinjaScript Compiler Constraints
|
||||
|
||||
## CRITICAL: Two separate compilers exist in this project
|
||||
|
||||
This project uses TWO compilers with DIFFERENT rules:
|
||||
|
||||
1. **dotnet build** — compiles src/NT8.Core/ and src/NT8.Adapters/ as
|
||||
standard .NET Framework 4.8 assemblies. Errors here show up in the
|
||||
terminal.
|
||||
|
||||
2. **NinjaTrader NinjaScript compiler** — compiles the .cs files deployed
|
||||
to `C:\Users\billy\Documents\NinjaTrader 8\bin\Custom\Strategies\`.
|
||||
Errors here only show up inside the NT8 NinjaScript Editor, NOT in
|
||||
dotnet build output.
|
||||
|
||||
**dotnet build passing does NOT mean NT8 will compile successfully.**
|
||||
Always treat NT8 compilation as a required separate verification step.
|
||||
|
||||
---
|
||||
|
||||
## NinjaScript-specific API rules
|
||||
|
||||
### OnConnectionStatusUpdate — correct signature
|
||||
|
||||
```csharp
|
||||
// CORRECT — single ConnectionStatusEventArgs parameter
|
||||
protected override void OnConnectionStatusUpdate(
|
||||
ConnectionStatusEventArgs connectionStatusUpdate)
|
||||
{
|
||||
connectionStatusUpdate.Status // ConnectionStatus enum
|
||||
connectionStatusUpdate.PriceStatus // ConnectionStatus enum
|
||||
}
|
||||
|
||||
// WRONG — this signature does not exist in NT8
|
||||
protected override void OnConnectionStatusUpdate(
|
||||
Connection connection,
|
||||
ConnectionStatus status,
|
||||
DateTime time) // CS0115 — no suitable method found to override
|
||||
```
|
||||
|
||||
### [Optimizable] attribute — does not exist
|
||||
|
||||
```csharp
|
||||
// WRONG — OptimizableAttribute does not exist in NinjaScript
|
||||
[Optimizable]
|
||||
public int StopTicks { get; set; } // CS0246
|
||||
|
||||
// CORRECT — all [NinjaScriptProperty] params are optimizer-eligible
|
||||
// Use [Range] to set optimizer bounds
|
||||
[NinjaScriptProperty]
|
||||
[Range(1, 50)]
|
||||
public int StopTicks { get; set; }
|
||||
```
|
||||
|
||||
### Attributes that DO exist in NinjaScript
|
||||
|
||||
```csharp
|
||||
[NinjaScriptProperty] // exposes to UI and optimizer
|
||||
[Display(...)] // controls UI label, group, order
|
||||
[Range(min, max)] // sets optimizer/validation bounds
|
||||
[Browsable(false)] // hides from UI
|
||||
[XmlIgnore] // excludes from serialization
|
||||
```
|
||||
|
||||
### Attributes that do NOT exist in NinjaScript
|
||||
|
||||
```
|
||||
[Optimizable] — use [NinjaScriptProperty] + [Range] instead
|
||||
[JsonProperty] — not available
|
||||
[Required] — not available
|
||||
```
|
||||
|
||||
### Method overrides — always verify against NT8 documentation
|
||||
|
||||
Before adding any `protected override` method to NT8StrategyBase.cs or
|
||||
any NinjaScript file, verify the exact signature at:
|
||||
https://developer.ninjatrader.com/docs/desktop
|
||||
|
||||
Common signatures that differ from intuition:
|
||||
|
||||
| Method | Correct NT8 Signature |
|
||||
|---|---|
|
||||
| OnConnectionStatusUpdate | `(ConnectionStatusEventArgs e)` |
|
||||
| OnMarketData | `(MarketDataEventArgs e)` |
|
||||
| OnMarketDepth | `(MarketDepthEventArgs e)` |
|
||||
| OnOrderUpdate | `(Order order, double limitPrice, double stopPrice, int quantity, int filled, double avgFillPrice, OrderState orderState, DateTime time, ErrorCode error, string nativeError)` |
|
||||
| OnExecutionUpdate | `(Execution execution, string executionId, double price, int quantity, MarketPosition marketPosition, string orderId, DateTime time)` |
|
||||
|
||||
---
|
||||
|
||||
## Deployment reminder
|
||||
|
||||
The full deployment sequence is always:
|
||||
|
||||
```
|
||||
1. dotnet build NT8-SDK.sln --configuration Release
|
||||
2. deployment\deploy-to-nt8.bat
|
||||
3. NT8: Tools → NinjaScript Editor → Compile All
|
||||
4. Reload any open Strategy Analyzer or chart instances
|
||||
```
|
||||
|
||||
Steps 1-2 passing does NOT mean step 3 will pass. NT8 compilation is
|
||||
the only authoritative check for NinjaScript-specific code.
|
||||
|
||||
---
|
||||
|
||||
## Files compiled by NT8 (not dotnet build)
|
||||
|
||||
These files are deployed as source and compiled by NT8's embedded
|
||||
compiler. Any NT8-specific API usage in these files is invisible to
|
||||
dotnet build:
|
||||
|
||||
- `src/NT8.Adapters/Strategies/NT8StrategyBase.cs`
|
||||
- `src/NT8.Adapters/Strategies/SimpleORBNT8.cs`
|
||||
- `src/NT8.Adapters/Wrappers/BaseNT8StrategyWrapper.cs`
|
||||
- `src/NT8.Adapters/Wrappers/SimpleORBNT8Wrapper.cs`
|
||||
|
||||
Any new strategy or wrapper file added to these locations inherits the
|
||||
same constraint. When modifying these files, the NT8 compiler is the
|
||||
only valid test.
|
||||
|
||||
Reference in New Issue
Block a user