Eliminate overnight trades
Author: suncity9
Creation Date: 3/27/2017 5:41 PM
profile picture

suncity9

#1
I create Strategies from Rules available which often shows trades being open over night, however, I close all trades at the end of the day and do not want my Performance to show effect of overnight trades when I do back testing. How do I get Strategy to close trades at the end of the day?
profile picture

Eugene

#2
Assuming intraday data:

1. In code: Wealth-Lab Wiki > Knowledge Base > Intraday / Multi-Time Frame | Keep from holding positions overnight

2. In Rules and for intraday data: Community.Rules, "Intraday Rule: Is Last Bar of Day" rule. Please create a support ticket to verify WLP entitlement before you're able to download C.Rules.
profile picture

backtesttrillionaire

#3
I have implemented the code version of this and I am running my strategy using a paper trading account.
It did not trigger an auto trade for the sell today.
If I look at the trades in the strategy though - it did sell at 4pm.
Is this method for sell at close only good for backtesting or can it be implemented for auto-trading also?
profile picture

Eugene

#4
If you reread the Wiki article you will see the problem with ExitAtClose (that you've seemingly implemented) outlined there. A proposed solution can also be found there in "Code" section. Note that it requires intraday data to execute your strategy.

For EOD strategies, a possible workaround is exemplified in the WealthScript Programming Guide > Programming Trading Strategies > Alerts > How to: Alert for AtClose Signals.