I have created a strategy that runs during multiple time slots within the day (8-925AM; 10-11AM...). The time slots within my code however revert to zero in the strategy menu when I save them down as a template and reopen them ( or if I have a chart saved with a strategy and reopen it the next day). How do I get my time slots to be stored when saved down as templates or when ninjatrader reopens. This is how I have them coded currently in the different sections
public class and declarations:
private bool IsWithinTimeSlots(DateTime time)
{
TimeSpan currentTime = time.TimeOfDay;
return (currentTime >= TimeSlot1Start && currentTime <= TimeSlot1End) ||
(currentTime >= TimeSlot2Start && currentTime <= TimeSlot2End) ||
(currentTime >= TimeSlot3Start && currentTime <= TimeSlot3End);
--
[NinjaScriptProperty]
[Display(Name = "Time Slot 1 Start", Order = 19, GroupName = "Time Slots")]
public TimeSpan TimeSlot1Start { get; set; }
[NinjaScriptProperty]
[Display(Name = "Time Slot 1 End", Order = 20, GroupName = "Time Slots")]
public TimeSpan TimeSlot1End { get; set; }
[NinjaScriptProperty]
[Display(Name = "Time Slot 2 Start", Order = 21, GroupName = "Time Slots")]
public TimeSpan TimeSlot2Start { get; set; }
[NinjaScriptProperty]
[Display(Name = "Time Slot 3 Start", Order = 23, GroupName = "Time Slots")]
public TimeSpan TimeSlot3Start { get; set; }
[NinjaScriptProperty]
[Display(Name = "Time Slot 3 End", Order = 24, GroupName = "Time Slots")]
public TimeSpan TimeSlot3End { get; set; }
--
State.SetDefaults:
TimeSlot1Start = new TimeSpan(8, 0, 0);
TimeSlot1End = new TimeSpan(9, 25, 0);
TimeSlot2Start = new TimeSpan(9, 40, 0);
TimeSlot2End = new TimeSpan(10, 0, 0);
(State == State.DataLoaded)
sessionStartTime = new TimeSpan(8, 00, 0);
OnBarUpdate()
if (!IsWithinTimeSlots(Time[0]))
return;

Comment