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 before live use.

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
order submitSubmitOrder(...) or Ctx.Orders
managed stop/targetSetStopLoss(...), SetProfitTarget(...)

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);
SubmitOrder(0, OrderAction.Buy, OrderType.Market, quantity, 0, 0, "", "Buy");

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.