Exit all positions on friday

Created at 07 Jul 2022, 07:43
How’s your experience with the cTrader Platform?
Your feedback is crucial to cTrader's development. Please take a few seconds to share your opinion and help us improve your trading experience. Thanks!
AL

Alfie

Joined 23.06.2022

Exit all positions on friday
07 Jul 2022, 07:43


Hi All,,

Since the market is closed on the weekend , how do we exist all opened positions on Friday at the end.??


@Alfie
Replies

PanagiotisCharalampous
07 Jul 2022, 08:28

Hi Alfie,

You can try something like this

  if (Server.Time.DayOfWeek == System.DayOfWeek.Friday && Server.Time.TimeOfDay > TimeSpan.ParseExact("21:00", "hh\\:mm", null))
            {
                foreach (var position in Positions)
                    position.Close();
            }

Best Regards,

Panagiotis 

Join us on Telegram and Facebook


@PanagiotisCharalampous