Skip to main content

NinjaScript To HyperionXScript Migration Guide

HyperionX can import ideas from NinjaScript-style indicators and strategies, but scripts must be converted to HyperionX APIs. Do not paste another platform script and expect it to run unchanged.

Migration Process

  1. Identify the script type: indicator, strategy, optimizer, commission, or addon.
  2. Create a new HyperionX script in the correct Code Lab category.
  3. Move only the useful calculation logic first.
  4. Convert lifecycle methods.
  5. Convert plots and panels.
  6. Convert drawing calls.
  7. Convert order calls.
  8. Convert extra series and multi-timeframe logic.
  9. Compile.
  10. Fix diagnostics.
  11. Compare output against the original platform on the same data.
  12. Test in simulation/playback with an explicitly selected LocalPaper account before live use. Playback does not select the account automatically; the current release-candidate build rejects external-account order mutations while Playback is active.

Concept Mapping

External conceptHyperionX direction
indicator classpublic class MyIndicator : Indicator
strategy classpublic class MyStrategy : Strategy
defaults stateState.SetDefaults
configure/data-loaded setupState.Configured
bar updateOnBarUpdate()
market data eventOnMarketData(MarketDataEventArgs marketData)
market depth eventOnMarketDepth(MarketDepthEventArgs marketDepth)
current barCurrentBar
bars in progressBarsInProgress
current closeClose[0]
prior closeClose[1]
custom output seriesSeries<double> plus AddSeries(...)
plotPlot plus AddPanePlot(...)
overlay settingpanes and plots, not IsOverlay
fixed textDraw.FixedText(...) or Ctx.Drawing.FixedText(...)
text position enumChartHudAnchor
managed market entry/exitEnterLong(...), EnterShort(...), ExitLong(...), ExitShort(...), or the matching Ctx.Orders managed helpers
managed limit/stop entryEnterLongLimit(...), EnterShortLimit(...), EnterLongStopMarket(...), EnterShortStopMarket(...)
managed stop/targetSetStopLoss(...), SetProfitTarget(...)
advanced unmanaged order controlSubmitOrder(...) with explicit OrderAction, OrderType, price, OCO, and signal values

Calls To Replace

Replace these patterns:

Draw.TextFixed(...)
TextPosition.TopRight
IsOverlay
Buy(...)
Sell(...)
ShortSell(...)
Cover(...)

with HyperionX equivalents:

Draw.FixedText(this, "tag", "Text", ChartHudAnchor.TopRight);
AddPanePlot(plot);
EnterLong(quantity, "Buy");

For normal strategy ports, translate entries, exits, stops, and targets to managed helpers first. Preserve direct order submission only when the original logic genuinely depends on advanced unmanaged behavior such as custom OCO groups, partial-fill handling, or explicit order-state transitions:

Order entry = SubmitOrder(
0,
OrderAction.Buy,
OrderType.Limit,
quantity,
limitPrice,
0,
ocoId,
"Advanced Buy Limit");

An unmanaged port must also translate its order-update, cancellation, rejection, partial-fill, and OCO recovery logic. Validate those paths in simulation before enabling live trading.

Generated Support Regions

Do not paste external generated support/cache regions. HyperionX generates its own helper methods after Code Lab builds the custom assembly.

If helper methods are missing, fix the source script and rebuild.

Namespaces

Use HyperionX namespaces:

using HyperionX.Chart.Classes;
using HyperionX.Chart.Enums;
using HyperionX.Core.Attributes;
using HyperionX.Core.DataCalc;
using HyperionX.Core.Enums;

Strategies usually also use:

using HyperionX.Core.Market;
using HyperionX.Custom.Indicators;

Validation Checklist

Before considering a port complete:

  • The script compiles in Code Lab.
  • It appears in the correct platform window.
  • The chart output matches expected values.
  • Early bars do not throw.
  • Multi-series indexes are guarded.
  • Drawings update without duplicating old tags.
  • Strategy orders are correct in simulation.
  • Backtest results include commission and realistic costs.
  • Logs are clean except known unrelated warnings.