I want to able to back test using 2 stocks, buy only one at a time. So when I hold stock 1, I can't buy stock 2. Then when I sell stock 1, I could buy either stock 1 or stock 2 but not both. It seems that when back testing 2 stocks, WLP will go through the time period and set the buy/sell dates. Then if stock 1 is bought, and then as time goes on and a signal to buy stock 2 comes before stock 1 is sold, there is not enough money to buy stock 2 and so the potential buy is passed. Can I work around this problem some how.
Size:
Color:
How about the built-in "One Trade Per Symbol" PosSizer?
Wealth-Lab User Guide > Reference > Data Panel > Position Size Control > Portfolio Simulation Mode > PosSizer
Size:
Color:
Eugene,
That doesn't work. Here is what I see. I'm working with 2 ETFs, both the regular and the contra. Ideally when one is sold, the other is purchased. Generally that's how it works. But as I mentioned WLP goes through the strategy and finds the buy/sell date-time. Then it steps through, one candlestick period at a time. Assume ETF 1 has been purchased and market is about to say Sell. But before ETF 1 gets the sell signal, the strategy says to buy ETF 2. The money is all tied up with ETF 1 and so ETF 2 purchase is bypassed. But a couple more candlestick periods and ETF 1 is sold and ETF 2 is not purchased around this time period. This is sort of like paying your rent once a month and the owner comes by to pick up the rent once a month. At the first of the month the owner comes by to collect. But you don't have the money. You say can you come by tomorrow to collect, then I will have the money. The owner says I'll come by next month and get 2 months rent payment.
Ideally, if there was some way for the strategy to know when ETF 1 would be sold and then ETF 2 would be sold after ETF 1 is sold. Or the strategy could borrow the money needed and then pay it back when ETF 1 is sold. It would be just a short time loan.
Do you see any solution out there.
Gary
Size:
Color:
Sounds like you can work around it by trading (or backtesting) your stocks in two different accounts using two different Strategies. One strategy for ETF1 and another for ETF2.
Size:
Color:
Gary, your strategy seems to better fit a "Symbol Rotation" pattern, pointing at one and using GetExternalSymbol or SetContext to access the other's data. Caution: There may be synchronization issues to deal with.
Start by creating all needed DataSeries for both, synchronized, ahead of the buy loop.
In the bar loop, initially run buy rules for both, each using its own DataSeries. After one signals a buy, run only that one's sell rules until it sells, then revert to running both buy rules again. Remember to SetContext ahead of Buy/Sell orders for the secondary symbol and RestoreContext after.
A little complicated for a WealthLab newbie, but it should be possible.
Thoughts, Eugene? This might be a useful pattern.
Len
Size:
Color:
My work-around is record the stock name and the buy date and price along with the sell date and price. Then enter the information in another application that creates a portfolio. This takes more time works out very well.
Gary
Size:
Color: