Hello NinjaTrader Community,
I'm developing a strategy for NinjaTrader 8, and I've run into some compilation errors that I can't seem to resolve. I'm hoping someone can help me understand what I'm doing wrong and how to fix it.
## The Issues
When I try to compile my strategy, I get the following errors:
```
NinjaScript File;Error;Code;Line;Column;
SweepyBotcs;'BarsPeriod' does not contain a definition for 'SecondsPerBar' and no accessible extension method 'SecondsPerBar' accepting a first argument of type 'BarsPeriod' could be found (are you missing a using directive or an assembly reference?);CS1061;205;70;
SweepyBotcs;'BarsPeriod' does not contain a definition for 'SecondsPerBar' and no accessible extension method 'SecondsPerBar' accepting a first argument of type 'BarsPeriod' could be found (are you missing a using directive or an assembly reference?);CS1061;213;70;
```
## The Code
Here are the relevant parts of my code where the errors occur:
```csharp
private void PlaceBuyOrder()
{
double entryPrice = Low[0] - EntryLimitOffset * TickSize;
entryOrder = EnterLongLimit(0, true, 1, entryPrice, "Long Entry");
entryOrderExpirationTime = Time[0].AddSeconds(BarsPeriod.SecondsPerBar * DeleteLimitAfter);
}
private void PlaceSellOrder()
{
double entryPrice = High[0] + EntryLimitOffset * TickSize;
entryOrder = EnterShortLimit(0, true, 1, entryPrice, "Short Entry");
entryOrderExpirationTime = Time[0].AddSeconds(BarsPeriod.SecondsPerBar * DeleteLimitAfter);
}
```
The errors are pointing to the `BarsPeriod.SecondsPerBar` part in both methods.
## Questions
1. Why am I getting these errors? Is `BarsPeriod.SecondsPerBar` not a valid property in NinjaTrader 8?
2. If it's not valid, what's the correct way to get the number of seconds per bar in NinjaTrader 8?
3. Are there any other issues you can spot in the provided code snippets?
## Additional Information
- I'm using NinjaTrader 8 (latest version as of August 14, 2024)
- The strategy is intended to work with various timeframes (1 minute, 5 minutes, etc.)
- I've included all the necessary `using` statements at the top of my file
Any help or guidance would be greatly appreciated. If you need any more information or code snippets, please let me know.
Thank you in advance for your assistance!

Comment