Is it possible to backtest a rotation strategy that calculates buys and sells with EOD data ?
Rename
For that, you can set "Rebalance Frequency" to Daily.
With Tradestation I can backtest with "this bar on close" or "next bar on open".
Wealthlab Rotational Strategy backtests with "next bar on open".
How can I backtest with "this bar on close" ?
Wealthlab Rotational Strategy backtests with "next bar on open".
How can I backtest with "this bar on close" ?
WL8 has only next bar on open.
It's most accurate to say that WealthLab has only next bar on open for Rotation Strategy types.
For Block and C# coded strategies you can create strategies that trade at the close on the signal bar by "peeking". This strategy demonstrates how to do it for the exit signal. Run it, and change the parameter between 0 and 1 to see the effect between selling at the next open or at the close of the signal bar.
That said, the same principle can be applied to a C#-coded rotation strategy. If you can't code it yourself, we have the Concierge Service for custom programming jobs and consulting. Send in your requirements.
Finally, we recently introduced a feature that lets the Strategy Monitor actually Auto-trade "At Close" based on the day's partial bar prior to the close. See the Build 99 Video for a demonstration: https://youtu.be/Z39A55OEudM
For Block and C# coded strategies you can create strategies that trade at the close on the signal bar by "peeking". This strategy demonstrates how to do it for the exit signal. Run it, and change the parameter between 0 and 1 to see the effect between selling at the next open or at the close of the signal bar.
CODE:
using WealthLab.Backtest; using System; using WealthLab.Core; using WealthLab.Indicators; using System.Collections.Generic; namespace WealthScript14 { public class AtCloseDemo : UserStrategyBase { public AtCloseDemo() { _p = AddParameter("AtClose = 1", ParameterType.Int32, 0, 0, 1, 1); } public override void Initialize(BarHistory bars) { _s1 = SMA.Series(bars.Close, 5); _s2 = SMA.Series(bars.Close, 10); PlotIndicator(_s1); PlotIndicator(_s2); _atClose = _p.AsInt == 1; if (_atClose) DrawHeaderText("Exit: At Close on Crossunder bar", WLColor.Red, 14); else DrawHeaderText("Exit: At Open after Crossunder bar", WLColor.Green, 14); } public override void Execute(BarHistory bars, int idx) { if (!HasOpenPosition(bars, PositionType.Long)) { if (_s1.CrossesOver(_s2, idx)) { Transaction t = PlaceTrade(bars, TransactionType.Buy, OrderType.Market); } } else if (_atClose) { int index = idx + 1; // evaluate the condition on the "next bar" by peeking if (index < bars.Count) // signals for exits are disabled { if (_s1.CrossesUnder(_s2, index)) ClosePosition(LastPosition, OrderType.MarketClose); } } else { if (_s1.CrossesUnder(_s2, idx)) ClosePosition(LastPosition, OrderType.Market); } } SMA _s1; SMA _s2; Parameter _p; bool _atClose; } }
That said, the same principle can be applied to a C#-coded rotation strategy. If you can't code it yourself, we have the Concierge Service for custom programming jobs and consulting. Send in your requirements.
Finally, we recently introduced a feature that lets the Strategy Monitor actually Auto-trade "At Close" based on the day's partial bar prior to the close. See the Build 99 Video for a demonstration: https://youtu.be/Z39A55OEudM
Your Response
Post
Edit Post
Login is required