Dear Community,
I would like to carry out a backtest for an IPO strategy. However, some things are not quite clear to me:
1) Are the IPOs listed in the extension data encompassing all US stocks or only stocks issued at a certain exchange (e.g NYSE) ?
2) I would like to set an all-time high on the fifth day after the first listing as a buy criterion. When I go to “Indicator crosses new high”, I only see the option of setting a period of n bars. However, I would like to consider only the period 5 days after the IPOs first listing and ignore all later all-time highs.
Thank you very much for your help!
Timo
I would like to carry out a backtest for an IPO strategy. However, some things are not quite clear to me:
1) Are the IPOs listed in the extension data encompassing all US stocks or only stocks issued at a certain exchange (e.g NYSE) ?
2) I would like to set an all-time high on the fifth day after the first listing as a buy criterion. When I go to “Indicator crosses new high”, I only see the option of setting a period of n bars. However, I would like to consider only the period 5 days after the IPOs first listing and ignore all later all-time highs.
Thank you very much for your help!
Timo
Rename
1) All.
1. Per the User Guide (F1), it's whatever is provided by nasdaq.com and marketwatch.com. (Probably IPOs for any U.S. exchange.)
2. If the buy criteria is that an all-time high has to be on the 5th day (bar index 4) then you need to load All Data and use a C#-Coded strategy like this. (This sells after 10 days, so adjust the exit logic as you wish.)
2. If the buy criteria is that an all-time high has to be on the 5th day (bar index 4) then you need to load All Data and use a C#-Coded strategy like this. (This sells after 10 days, so adjust the exit logic as you wish.)
CODE:If you're looking for an all-time high Close, then replace .High with .Close in 2 places.
using System; using WealthLab.Backtest; using WealthLab.Core; using WealthLab.Data; using WealthLab.Indicators; namespace WealthScript3 { public class MyStrategy : UserStrategyBase { public override void Initialize(BarHistory bars) { StartIndex = 4; } public override void Execute(BarHistory bars, int idx) { if (!HasOpenPosition(bars, PositionType.Long)) { if (idx == 4) { double ath = Highest.Value(idx, bars.High, 5); if (bars.High[idx] == ath) { Transaction t = PlaceTrade(bars, TransactionType.Buy, OrderType.Market); } } } else { Position p = LastPosition; if (idx - p.EntryBar + 1 >= 10) ClosePosition(p, OrderType.Market); } } } }
Many thanks for your quick and helpful reply. Is there also a way to built that strategy making use of the building blocks instead of the code editor ?
No, because that's a very custom rule to check that something occurs only on the Nth bar of a daily series. Blocks are very versatile but they'll never be able to 'everything'.
That said, the Concierge Service exists for custom programming jobs and consulting if you want to "buy your own block". Then it's possible.
That said, the Concierge Service exists for custom programming jobs and consulting if you want to "buy your own block". Then it's possible.
Your Response
Post
Edit Post
Login is required