Hi Bruce, Thanks very much for the feedback. I'll give it a try.
--- In [email protected], "Bruce" <bru...@...> wrote: > > Diego - > > I saw this the other day and it is the type of broader topic that I want > to cover on AmibrokerU.com soon with a demo app. I'll call it a "Score > Mask" coding pattern. I'll briefly explain the approach now, though, > and hope that it gets you pointed in a useful direction. > > PROBLEM - In a rotational trading system, define periods where tickers > in the filter are available to be held in the portfolio. This has > several appplications - > > * Only trading tickers that trade above a certain price. > * Only trading tickers that have a volume MA or a money flow above a > certain threshold. > * Only trading tickers that appear on a recommended list (ValueLine, > IBD100, etc.) > > In coding this, I'd suggest thinking of it in steps. The steps could be > done in a different order, but it is probably easier to see this way - > > 1. You have a watchlist that will build up over time, or you can just > run against all stocks if processing time is not important. For each > stock, calculate a proprietary position score for all days. > > 2. Create a function that does the following. Initialize the return > date mask to 0. Read a text file, called RECOMMENDED_FILE, where each > line contains a mask for dates that the current ticker was > "recommended". Say the ratings are released on Mondays. Then, for > example, a line might be - "AAPL,7/13/09,7/31/09" - representing > starting on Monday, and ending on a Friday. Set the mask to 1 for that > date range. Do the same for other lines that match the current ticker. > Return the resulting mask called DATE_ MASK. > > 3. Modify the position score array to contain the score for days that > the DATE_ MASK is 1 and 0 for days that the mask is 0. Call this the > DATE_ MASKED_ SCORE. > > 4. Create a array that contains 1 on days that you want to rotate and > 0 otherwise. For example, Monday. Call this the TRADING_ MASK. If the > recommended list comes out on Monday, then this would be the day. > > 5. Set the final position score to the DATE_MASKED_SCORE when the > TRADING_MASK is 1. and to ScoreNoRotate (a keyword) for days when the > TRADING_MASK is 0. > Depending on the size of the recommended list, number of tickers over > the backtest, size of recommended list, etc., there are optimizations > that can be done to reduce run time. Also, if the test file that is > used to set the DATE_MASK is in chrono order and recommendations are > repeated each week, you can obviate the need for the end date on each > line. But, the above steps will get the basic idea going. > > Hope this helps. > > -- BruceR > > > --- In [email protected], Diego Zviovich <zviovich@> wrote: > > > > Dear all, > > > > I'm migrating from Wealth-Lab to Amibroker to take advantage of > > Amibroker's functionality and brokerage house independence. As with > > any new language, it tak > > es a while to get through the learning curve. > > Please, would someone be kind to point me to any existing document or > > example that would tackle the following type of trading system as > > explained below? > > The subset of issues in which the rotational system operates is > > reviewed on a weekly basis, based on an unknown propietary rating > > system (Think of Valueline T1, MSN 100, IBD, etc) . Some symbols are > > dropped from the list, some new symbols are added to the list. If the > > symbol is dropped from the list the position is closed, it will be > > replaced by a new issue from the updated list for which a position is > > not already open. The rest of the system operates the same way as the > > standard rotational system operates, based on some position scoring > > condition. > > Thanks. > > >
