Login Page - Create Account

Support Board


Date/Time: Mon, 28 Oct 2024 11:17:21 +0000



Post From: Flatten Positions outside of desired time ranges

[2015-07-20 22:57:37]
User424542 - Posts: 6
We currently trading Futures with simulation mode on and we would like to flatten and cancel our order before 06:00:00 and after 14:00:00. We are programming for automated trading and we are entering into a BuyEntry. For some reason the Buy Entry is not flattening and cancelling after the 14:00:00. We have the following code.


SCInputRef StartTime = sc.Input[7];
SCInputRef EndTime = sc.Input[8];

if (sc.SetDefaults)
{
StartTime.Name = "Start Time";
StartTime.SetTime(HMS_TIME(06, 00, 00));

EndTime.Name = "End Time";
EndTime.SetTime(HMS_TIME(14, 00, 00));


if (StartTime.GetTime() >= sc.CurrentSystemDateTime && EndTime.GetTime() <= sc.CurrentSystemDateTime) {
sc.FlattenAndCancelAllOrders(); }

The code compiles. Any help would be appreciated :)