Thank you very much for cluing me in to Osaka. I will check it out. Much 
appreciated.

--- In [email protected], "droskill" <drosk...@...> wrote:
>
> The challenge in AB is that they don't have arrays by default so, storing the 
> symbol and the "score" for each is not available out of the box.  However, 
> there is a plug-in called Osaka which adds this functionality and would make 
> it possible for you to setup what you're describing.
> 
> --- In [email protected], "rmicalet" <rmicalet@> wrote:
> >
> > I would ultimately like the system to send trades through Interactive 
> > Brokers, but it doesn't necessarily have to do any bookkeeping or 
> > monitoring (other than figuring out when to enter or exit). 
> > 
> > It's an S&P 500 sector ETF model so there are only 9 ETFs to consider, but 
> > there are too many moving parts to track the model manually--although I 
> > could probably just use IB's Excel DDE to read in live prices and run the 
> > system in real-time that way. However, I was really hoping to be able to 
> > implement it in Amibroker in order to backtest different entry and exit 
> > options using intraday data (right now it enters at the close and exits at 
> > the open or the close).
> > 
> > Since there are only 9 ETFs, would it be possible to bypass the rotational 
> > backtesting mode and simply code this up using the "foreign()" function and 
> > "for" loops? Ranking 9 assets shouldn't be too much of a problem 
> > (particularly if amibroker has a function like Exel's "large" and "small", 
> > whereby one can identify the Nth largest or smallest element of an array).
> > 
> > 
> > 
> > --- In [email protected], "droskill" <droskill@> wrote:
> > >
> > > I think most of what you talk about is possible - some of it will be 
> > > challenging, but I still think doable.
> > > 
> > > Running the system in real time will likely take the most work - would 
> > > you want the system to interact with a broker to make the trades and then 
> > > monitor the positions?  That will be challenging.
> > > 
> > > --- In [email protected], "rmicalet" <rmicalet@> wrote:
> > > >
> > > > I have a rotational trading system that gets creative in the position
> > > > sizing. I was wondering if the following is possible in Amibroker:
> > > > 
> > > > 
> > > >     1. Rank a (small) universe of stocks by a single factor
> > > > 
> > > >     2. Select the top x% and bottom x% to go long and short, 
> > > > respectively
> > > >     3. Weight the individual long and short positions inversely
> > > > proportionally to their n-day volatility. For example, let's say the
> > > > system wants to go long and short two stocks on each side. Let IVL1 be
> > > > the n-day inverse volatility of long stock 1, IVL2, IVS1, and IVS2 be
> > > > the n-day inverse volatilities of long stock 2, short stock 1, and short
> > > > stock 2, respectively. Further, let WL1, WL2, WS1, and WS2 be the
> > > > percent weights of long stocks 1 and 2 and short stocks 1 and 2,
> > > > respectively. Then, the system wants WL1 = IVL1/(IVL1 + IVL2); WL2 =
> > > > IVL2/(IVL1 + IVL2); WS1 = IVS1/(IVS1 + IVS2); WS2 = IVS2/(IVS1 + IVS2).
> > > >     4. Then, as a further refinement, the system wants to beta-adjust 
> > > > the
> > > > short positions relative to the long positions. That is, if the
> > > > portfolio of long stocks (weighted according to their volatilities) have
> > > > an m-day beta of B with the portfolio of short stocks (again, weighted
> > > > according to their volatilities), the system wants to create a
> > > > long/short portfolio that has B dollars short for every dollar long.
> > > >     5. The system wants to buy on the close
> > > >     6. The system will exit at the following day's open if the portfolio
> > > > is up at the open, otherwise it will to hold until the following day's
> > > > close, when it will repeat steps 1 through 5
> > > > I'd like to both backtest the system (I've backtested it previously in
> > > > Excel/VBA) and run it in real-time in Amibroker. I'd be grateful for any
> > > > insight as to whether the weighting scheme (both the
> > > > inverse-volatility-based weighting, and the beta adjustment) is doable
> > > > in Amibroker, and if so, how complex a program I'd be looking at. The
> > > > rest of the system seems relatively straightforward.
> > > > 
> > > > In case steps 3 and 4 above were not clear, here's a little more detail.
> > > > After finding WL1, WL2, WS1, and WS2, I'd like to form two time series
> > > > of historical returns. The first time series take the historical returns
> > > > of the two long stocks and combines them using WL1 and WL2 (i.e., long
> > > > portfolio, PL = WL1*R1 + WL2*R2, where R1 and R2 are the time series of
> > > > returns for long stock 1 and 2, respectively). The second does the same
> > > > for the short stocks using WS1 and WS2. Then given the two portfolios,
> > > > PL (long) and PS (short), I want to find the beta of PL to PS. Finally,
> > > > I want to have the ultimate portfolio, P, to be as follows: P = PL -
> > > > B*PS (where B is the beta of PL to PS). The final weights with the beta
> > > > included would be:
> > > > 
> > > > WL1 = IVL1/(IVL1 + IVL2)
> > > > WL2 = IVL2/(IVL1 + IVL2)
> > > > WS1 = B*IVS1/(IVS1 + IVS2)
> > > > WS2 = B*IVS2/(IVS1 + IVS2)
> > > > 
> > > > (But, of course, one needs to find the weights sans B first in order to
> > > > find B.) Would be grateful for any pointers as to how to go about
> > > > implementing this, if it's indeed possible.
> > > > 
> > > > Regards,
> > > > Ray
> > > >
> > >
> >
>


Reply via email to