Script Troubleshooting
Use this page when Code Lab builds fail, scripts do not appear, indicators disable themselves, or strategies behave differently than expected.
Compile Errors
| Symptom | Likely cause | Fix |
|---|---|---|
| Script does not appear | Wrong namespace, wrong base class, duplicate class, or failed custom build. | Match the script category namespace and rebuild. |
Draw.TextFixed not found | Script uses another platform API. | Use Draw.FixedText(...) or Ctx.Drawing.FixedText(...). |
TextPosition not found | External enum. | Use ChartHudAnchor. |
IsOverlay not found | External overlay property. | Use HyperionX panes and plots. |
Buy, Sell, ShortSell, or Cover not found | External order helpers. | Use EnterLong, EnterShort, ExitLong, ExitShort, SubmitOrder, or Ctx.Orders. |
| Generated helper missing | The referenced indicator failed to compile. | Fix the indicator and rebuild custom scripts. |
DateTime.Now issue | DateTime resolves to bar series in script context. | Use System.DateTime.Now. |
Runtime Indicator Disabled
If an indicator disables itself, check:
- early-bar guards
- null child indicators
- missing extra data series
- invalid bars-ago reads
- divide-by-zero
- drawing tags using negative bar indexes
- UI-thread access from background work
Start with:
if (CurrentBar < RequiredBars)
return;
Strategy Runs But Does Not Trade
Check:
- strategy is enabled
- account is selected
- connection is connected
- script is calculating on the intended series
BarsInProgressguard is not blocking all logic- position state check is correct
- order quantity is greater than zero
- signal names and OCO groups are valid
- risk limits or account settings are not rejecting orders
Strategy Trades But Exits Are Missing
Check:
- stop/target methods are called before or with the entry
fromEntrySignalmatches the entry signal- OCO group is shared by paired exits
- position quantity is available before submitting exits
- exits are not being cancelled by later logic
Multi-Series Issues
Common fix:
if (CurrentBars[0] < 50 || CurrentBars[1] < 20)
return;
Then use BarsInProgress to route logic.
if (BarsInProgress == 1)
{
// Secondary series update.
return;
}
Drawing Problems
| Symptom | Fix |
|---|---|
| Drawing duplicates every bar | Reuse a stable tag if only one drawing should exist. |
| Drawing disappears | Check tag reuse and Draw.Remove(...) calls. |
| Drawing throws bar index out of range | Guard CurrentBar before using barsAgo. |
| HUD text uses wrong API | Use Draw.FixedText(...), not Draw.TextFixed(...). |
| Custom overlay lags | Precompute values outside OnRender and limit loops to visible bars. |
Build Hygiene
- Keep one public class name per script.
- Keep file names close to class names.
- Remove copied generated regions from other platforms.
- Do not store API keys in script parameters.
- Treat warnings as cleanup items, but fix errors immediately.
Debugging Tools
Use:
Print("debug message");
Log("log message");
Ctx.Log.Info("context log");
Ctx.Log.Error("error message");
Keep debug output concise. High-frequency printing can make chart interaction feel laggy.