Closing operations Friday night at 22:00h
Forums › ProRealTime English forum › ProOrder support › Closing operations Friday night at 22:00h
- This topic has 5 replies, 2 voices, and was last updated 8 years ago by
Juan Salas.
-
-
08/10/2017 at 10:47 AM #42862
Dear all,
I have coded the closing of my operations in my system on Friday night at 22:00h to avoid having open position during weekends and expose those positions to weekends gaps and charges from the broker.
I have opted for the command QUIT, but I am not sure if that will stop the system or just will close the operation until Monday at 00:00h
I am including the code and would appreciate any comments or even suggestions or alternative options.
Thanks so much.
Juan
1234567891011// Days of the weekIF DayOfWeek = 0 OR Dayofweek = 6 THENtradeok = 0ELSEtradeok = 1ENDIF// Friday 22:00 STOP operationsIF Dayofweek = 5 AND TIME = 220000 THENQUITENDIF08/10/2017 at 5:36 PM #42947Hi,
I am answering myself, :))
I think that:
IF Dayofweek = 5 THEN
DEFPARAM Flatafter = 220000
ENDIF
08/10/2017 at 5:42 PM #42948Hi,
It doesn’t work. DEFPARAM can’t be used like that.
Any suggestions???
(Reminder: I want to close the operations on Friday night at 220000, but I want the system to run from Monday to Friday without interruption)
Thanks in advance,
Juan
08/10/2017 at 5:54 PM #42949Try this one (I did not):
1234IF DayOfWeek = 5 AND time = 220000 THENSELL AT MARKETEXITSHORT AT MARKETENDIFYou close any trade, either LONG or SHORT at the time you want, on the day you want to.
You can’t use DEFPARAM in conditional statements, it’s an unchangeable directive to ProOrder, not an instruction.
08/10/2017 at 6:30 PM #42951Hi Roberto,
Gracie mille. I will try it right now and will let you know the results.
Juan
08/10/2017 at 6:57 PM #42954Hi Roberto,
It works. I have also added something to avoid launch any operation after 22:0000 on Friday.
1234567// Friday 22:00 Close ALL operations.IF DayOfWeek = 5 AND time = 220000 THENSELL AT MARKETEXITSHORT AT MARKETENDIFFridaynight = Dayofweek = 5 AND time>220000Oil Market close at around 23:00, and reopens after 00:00 everyday. At least at this hour there is a gap or inactivity everyday, but sometimes close before. In some cases I have noticed that cease all the trading around 220000, so just to be safe I have decided to set up closing operations on Friday at 22:00.
After that I noticed in the backtest that the system bought at 22:45 on Friday in two occasions, causing in one of them a gap of 243 points until Monday. So to avoid any involuntary buying or selling after 22:00 I have included the Fridaynight (doesn’t sound very professional, but it works 😉
Thanks again,
Juan
-
AuthorPosts
Find exclusive trading pro-tools on