regards to everyone,
nt is an excellent platform and support is also consistently excellent, i don't have any doubts that it should be easy to create the necessary code so that my strategies liquidate all positions before the close on friday and are always flat over the weekend.
i have been working on this same logic on another inferior platform i have used for a long time (ts) and it required two conditions, one to close all positions shortly before the end of the session and another so that strategies would not open any positions at the close of the last bar of the session.
- i first created a condition that would be true if dayofweek = 5 and time was between 16:58 and 17:01 exchange time. this condition would be false in any other case. my strategies would not generate entries if this condition was true.
- i then created commands to close all positions at 16:59.
i imagine this same structure should work beautifully in nt, but i'm having trouble with the code. this is what i have so far:
if ((Times[0][0].DayOfWeek == DayOfWeek.Friday) && (Times[0][0].TimeOfDay >= new TimeSpan(16, 58, 0)) && (Times[0][0].TimeOfDay <= new TimeSpan(17, 1, 0))) { Notrco = true; } if ((Times[0][0].DayOfWeek == DayOfWeek.Friday) && (Times[0][0].TimeOfDay == new TimeSpan(16, 59, 0)) && (Position.MarketPosition == MarketPosition.Long)) { ExitLong(Convert.ToInt32(Position.Quantity), @"clallopo", ""); } if ((Times[0][0].DayOfWeek == DayOfWeek.Friday) && (Times[0][0].TimeOfDay == new TimeSpan(16, 59, 0)) && (Position.MarketPosition == MarketPosition.Short)) { ExitShort(Convert.ToInt32(Position.Quantity), @"clalshpo", ""); }
well, thanks, regards.
Comment