Please find attached a NT indicator "TestTradingHours". This indicator identifies whether the current bar occurs within cash market hours for a US or Australian instrument.
This script works as expected as an indicator. However, as part of a strategy, it returns the error message:
- "AddDataSeries()" must occur in State.Configure
- "Instrument.Exchange" is not available in State.Configure (but is available in State.DataLoaded)
- Instrument.Exchange must be known to add the correct DataSeries
Any suggestions on how to refactor this code while remaining effecient would be greatly appreciated.
Regards
Shannon
Comment