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


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


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


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


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.
This website uses cookies to improve your experience. We'll assume you're ok with that, but you can opt-out if you wish (Read more).