It appears that my trades in WealthLab and what is published have gotten out of synch (i.e. trades are closed out in my system, but I do not recall getting a signal to sell, thus I have open positions in WealthSignals that should have been sold according to my system). I have been very observant when staging buy and sell signals. Do you have any tips for keeping trades in sync or is there specific reasons they may become out of sync?
Size:
Color:
Let's be specific and we'll check that. What were the symbol, date, OHLC in Wealth-Lab on that date, order type?
Size:
Color:
QUOTE:
(i.e. trades are closed out in my system, but I do not recall getting a signal to sell,
Check the email records of your signals and bounce them against your backtest. If your backtest sold a position but you didn't get an Alert to sell it, then there could be a problem with the data you used (maybe the symbol missed an update) or potentially an error in the code.
Also, make sure that you're using Position.Priority so that the backtest results do not change! This is especially important for high-exposure market orders systems, for which you should only enter orders for which you have buying power... in order of priority. Stop/Limit system should use
SetTimeOfDayPriority, which requires intraday data.
Size:
Color:
I am using Postion.Priority and now SetTimeOfDayPriority, although my thought is I will still get problems. Now that I think of it, it is likely due to the fact that each week I change the WealthSignals data set based on a stock screener criteria. I make sure to keep any current open positions within the new data set thinking it will close them, but the reality is that by changing the data set, this changes which stocks get Position.Priority. Hence, if a trade occurred last week on one group of stocks, doesn't mean that the same trade would occur on a different set of stocks even though the same stock is in both data sets. Would you agree?
If this is the case, then I need to develop a new approach. Currently each week I screen the WealthSignal stocks to capture those assigned a proprietary value based on a scale of 1 -5, where 1 is the best and 5 the worst. I then use those stocks ranked 1 as my data set whereas I run my trading system. Since this appears to be getting my trades out of sync, a better way to do this would be to keep the WealthSignal dataset static and somehow make an external call to these values. Is there a way to code rules into my strategy and have wealthlab call to an external file stored locally on my machine (e.g. xml file, excel file) to determine which stocks meet this criteria? Thus, I would have a rule that would call to the external file using the stock symbol as the unique identifier and only those stocks with the specified value would be returned (i.e stocks ranked 1)? Each week I would then just update the file with the new values.
Size:
Color:
Changing the DataSet that way will surely cause a portfolio mode backtest to get out of synch with reality, especially if you use Portfolio Equity for Position Sizing. Although a Position.Priority value shouldn't change (generally it's based on an indicator, or time of day for stop/limit), relative priority will be affected by removing and adding symbols, which in turn would affect stock selection in the backtest.
There are at least a couple approaches that will work for you.
Use Raw Profit mode
In R.P. mode you could keep your current workflow. Except for open positions, you don't need to stay in synch because you will be entering all signal candidates for stop/limit. (In the case of a market order system, you should still calculate a priority and publish signals in order of highest priority up to point that buying power remains non-zero.) If sizing is based on equity, adjust the fixed dollar size each week.or two based on the WealthSignals equity. When exiting positions, just make sure that you edit the share size to be equal (or higher) than the WealthSignals position.
Portfolio Sim mode
I think you should keep a database (of sorts) of Zacks rankings, load the values for a particular symbol, access the values by date, and applying a trade filter based on those values. It's a little work to program, but still a somewhat small task. Exactly how to do it depends on how you use it, which isn't precisely clear to me.
This said, keeping in synch with WealthSignals should be approximately the same task as keeping in synch with a live account. Having traded systems for years, I can tell you that using Raw Profit mode for live trading will simplify the task.
Size:
Color:
Thanks cone, I believe I will utilize the raw profit mode.
QUOTE:
Portfolio Sim mode
I think you should keep a database (of sorts) of Zacks rankings, load the values for a particular symbol, access the values by date, and applying a trade filter based on those values. It's a little work to program, but still a somewhat small task. Exactly how to do it depends on how you use it, which isn't precisely clear to me.
Are there any examples of this type of approach in this forum (i.e. calling to a database)?
Size:
Color:
Depending on how you access and store the data, the solutions are many. For example, if you actually use a database, a straightforward way (I think) may be to use the
Database Provider. This is probably overkill, but it would mean that you'd have a new symbol for each one of your Zack's series. Then you could pull in the series as an external symbol from your "Zacks" DataSet. e.g.;
CODE:
Please log in to see this code.
Size:
Color:
Cool, I have actually managed to connect my Excel data of the Zacks Rank using the Database Provider in WealthLab. My Excel Data fields are Symbol, Date and Zacks Rank. If I utilize the "Named series" field in the Database Provider for the Zacks Rank, how do I pull that value in as you describe above? Would the code below be correct?
CODE:
Please log in to see this code.
Further, since I rerun the screen each week, I theoretically can begin to build a weekly time series of Zacks Rank for the the Symbols. The identifier would become the Date parameter. How would the code look if I wanted to pull the Rank for a Symbol by Date value (i.e where date value would be the most recent week)? Note: My database comprises of symbols in column A, Date in column B and Rank in column C in Excel, thus I would have 518 rows of new data added each week. The Date would be the unique identifier when trying to retrieve a symbols Rank.
Size:
Color:
QUOTE:
Cool, I have actually managed to connect my Excel data of the Zacks Rank using the Database Provider in WealthLab.
The
Excel provider might probably have been even easier.
QUOTE:
If I utilize the "Named series" field in the Database Provider for the Zacks Rank, how do I pull that value in as you describe above?
CODE:
Please log in to see this code.
If something doesn't work (e.g. returns
null), make sure you've read the QuickRef (i.e. NamedSeries, FindNamedSeries, HasNamedSeries).
Hint: name should be precisely as the Zacks Rank custom field was defined i.e. named in your Excel spreadsheet. If unsure, the QuickRef example for NamedSeries will help you find out how it's named.
Size:
Color:
Database is synced up using Excel Provider. Tried a few different approaches, and read the QuickRef, but I cannot seem to get the Zacks Rating to pull in. Here is the link to the the excel file and here is some mock code for illustrative purposes if you want to take a quick look at data. I tinkered with the Excel data to make sure it wasn't an issue with data being text or numbers, but didnt seem to matter. I even tried modifying date to see if that changed it.
https://dl.dropbox.com/u/6514555/TestAAPL.xlsxCODE:
Please log in to see this code.
Size:
Color:
Question is, did you define the named series when creating the DataSet?
Size:
Color:
QUOTE:
Question is, did you define the named series when creating the DataSet?
If you mean did I select the appropriate field for the Named Series when creating the dataset then the answerer is YES.
Size:
Color:
Not sure what went wrong: there are no known issues with regard to NamedSeries with either provider. Let's avoid the NamedSeries thing for now. When you define a DataSet, use the Zacks Rank as OHLC. Then you'll be able to access its data with GetExternalSymbol(...).Close and chart it easily.
Size:
Color:
QUOTE:
Then you'll be able to access its data with GetExternalSymbol(...).Close and chart it easily.
Thanks Eugene that solved that problem for 1 symbol in the dataset. Can I not have all the symbols in one column in the excel data sheet and just use the Bars.Symbol illustrated below to pull the value for the appropriate symbol.
CODE:
Please log in to see this code.
When I try to run this I get "Runtime error: Plotted DataSeries has fewer bars than the Symbol being charted at WealthLab.Strategies.MyStrategy.Executed() at WealthLab.WealthScript.PlotSeries(ChartPane pane, DataSeries series, color color, LineStyle style, Int32 width) at WealthLab.WealthScript.a(DataSeries A_0)
Size:
Color:
QUOTE:
Can I not have all the symbols in one column in the excel data sheet and just use the Bars.Symbol illustrated below to pull the value for the appropriate symbol.
Yes, multiple symbols are supported. You should be able to do it this way using both Database and Excel providers.
QUOTE:
When I try to run this I get "Runtime error: Plotted DataSeries has fewer bars than the Symbol being charted at
Synchronize() to the charted Bars manually.
Size:
Color:
QUOTE:
Synchronize() to the charted Bars manually.
??? Not sure what it means, but this is what I tried
CODE:
Please log in to see this code.
This is the error I get now.
Runtime error: Index was out of range. Must be non-negative and less the the size of the collection
Size:
Color:
I don't have much to suggest here. Since it's easier for you to do debugging using your Strategy, your DataSet and your data than for me, please go through the checklist that sums up the 3 likely groups of reasons behind this error:
Errors | Strategy >
Index was out of rangeI bet it's something related to #2 i.e.
your DataSet contains the price data for a symbol that stopped trading, and you select the data range that goes beyond that date, and do not account for this fact in your Strategy.
Size:
Color:
By the way, got a spare minute to look at the issue from your post #10. Installed AccessDatabaseEngine_x64.exe, set up an Excel DataSet and was unable to reproduce:
CODE:
Please log in to see this code.
Everything worked perfectly. My opinion is that it has something to do with trying to use the rank on a symbol that does not have dates in the data range of ZacksRank.
Size:
Color:
QUOTE:
Installed AccessDatabaseEngine_x64.exe, set up an Excel DataSet and was unable to reproduce:
I appreciate your work on it. I will check that out. I wanna say I installed that, but will have to double check. I got the "AAPL" symbol to work using the Zacks Rank in the Close which was good; unfortunalty, I want to be able to pull multiple symbols sotred within the same collumn in the same worksheet (e.g. AA, AAPL, etc. in Collumn A, Dates in Collumn B, and Rank for each in Collumn C). Obviously each symbol would be listed in multiple rows for each date that the rank is assigned. I plan on only udpating weekly so that will keep my database smaller.
Size:
Color:
I am having trouble with trade synchronization on all my strategies still. you mention to use this
QUOTE:
Limit system should use SetTimeOfDayPriority, which requires intraday data.
One thing that stood out to me was that in the usage notes it says only valid for 1 symbol, thus I used IntradayFillPriorityEstimate method instead.
So on end of day data for the wealth signals data set which method should I use (SetTimeOfDayPriority or IntradayFillPriorityEstimate)?
Size:
Color:
Any one you like.
Re: "valid for one symbol only" actually means that it does not support Rotation, Pair Trading and other context-switching systems that loop over DataSetSymbols and use SetContext to trade.
Size:
Color: