need help setting a specific day and time to close trades .... i.e. Friday near market close
need help setting a specific day and time to close trades .... i.e. Friday near market close
23 Jan 2021, 17:41
I'm using this to try to close all positions on Friday near the close...
but it is not working...
System.DayOfWeek today = System.DateTime.Today.DayOfWeek;
if (Server.Time.DayOfWeek == DayOfWeek.Friday && reSet == 0 && reSetGo == 1)
{
reSetTime = Server.Time.AddHours(22);
if (Server.Time > reSetTime)
{
reSet = 1;
foreach (var position in Positions)
{
ClosePosition(position);
}
}
}
When I use this: Print("reSetTime = {0}", reSetTime);
I see this: reSetTime = 1/1/0001 12:00:00 AM
How can I do this?
Thanks!
ClickAlgo
23 Jan 2021, 19:20 ( Updated at: 23 Jan 2021, 19:22 )
I think this contains source code for closing positions on a Friday.
There is also a video:
@ClickAlgo