Login Page - Create Account

Support Board


Date/Time: Wed, 27 Nov 2024 16:34:42 +0000



Post From: Spreadsheet study - How to flatten all positions just on Fridays

[2023-07-31 14:51:03]
Rui S - Posts: 190
Hi Tom,

I am really sorry to bother you again.

From your post #5:

Try this:
=OR(OR(FRACTIME(J41<TIMEVALUE("14:00:00"),FRACTIME(J41)>TIMEVALUE("19:28:00")),AND(FRACTIME(J41)>TIMEVALUE("15:20:00"),FRACTIME(J41)<TIMEVALUE("17:00:00")),AND(FRACTIME(J41)>TIMEVALUE("17:30:00"),FRACTIME(J41)<TIMEVALUE("18:00:00")))

and from you post #2:

Try this:
=AND(WEEKDAY(J41)=6,FRACTIME(J41)>TIMEVALUE("20:59:00"))


Those formulas are both working very well.

However, during my experiments and backtesting, I had to "upgrade" my Auto Trading time windows formula to the following one, with 4 "recesses":

=OR(OR(FRACTIME(J41<TIMEVALUE("06:00:00"),FRACTIME(J41)>TIMEVALUE("23:30:00")),AND(FRACTIME(J41)>TIMEVALUE("08:30:00"),FRACTIME(J41<TIMEVALUE("14:00:00")),AND(FRACTIME(J41)>TIMEVALUE("15:30:00"),FRACTIME(J41<TIMEVALUE("16:00:00")),AND(FRACTIME(J41)>TIMEVALUE("17:00:00"),FRACTIME(J41)<TIMEVALUE("19:00:00")),AND(FRACTIME(J41)>TIMEVALUE("20:30:00"),FRACTIME(J41)<TIMEVALUE("21:10:00")))

I don't know if this formula is correctly done, but it seems to be working.

The problem is with the formula that was closing the positions on Fridays -
(=AND(WEEKDAY(J41)=6,FRACTIME(J41)>TIMEVALUE("23:20:00")) - it stopped working with this my "upgraded" formula. It never closes the open positions, leaving them open during the weekends.


After unsuccessfully spending the whole weekend trying to figure out a solution for it, here I am once more asking for help.

Would you please take a look and see what I have done wrong to cause this problem?

Thank you so much.


P.S. - I totally understand if you don't have the time to address this issue.