[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Multiple Symbol Systems



PureBytes Links

Trading Reference Links

At 11:50 AM -0700 1/21/98, Neal Chabot wrote:

>I am asking for Help from the list on creating a multiple symbol system.
>
>I am developing a momentum system that analyze a basket of stocks, for
>example the Dow 30. The system is based on momentum, and thus identifies
>the "strongest" stocks in the basket to initiate a buy order. At first this
>will be daily data. The system keeps dynamically identifying the top three
>strongest stocks, so that if a particular stock is no longer in the top
>three then it is sold and the new front-runner is bought.
>
>The problem is that TS 4.0 has no capability of doing this, at least for
>historical testing.
>
>A multiple symbol window only gives signals on data1, so I would need 30
>windows open to get signals on 30 stocks, etc. In real time or for EOD
>analysis, I could run the system and get signals and use my personal
>discretion on which ones to take. The reason for this is that the system at
>times would want to buy more or less than the top three stocks.
>
>While I believe this is doable, the problem I have is doing the back testing.
>
>I would need the capability of testing on the basket of stocks, sorting
>them according to momentum criteria, and the choosing the top xx to
>initiate buy orders and selling those which had fallen out of the top xx.
>
>The only way I can figure how to do this is to import data files into Excel
>and write a program in VBA for historical testing. UUGH!
>
>Any suggestions would be appreciated.
>
>Neal Chabot

I posted a response to a similar question about a week ago. My original
response is attached below. The original system was intended to switch
between the Fidelity Select Mutual Funds. It picked the single best fund
based upon momentum as you described. I had also tried it on the Dow30 and
it worked about as expected.

I did learn that it is best to test the underlying momentum trading model
on individual stocks, basically getting in and out at points based upon
some momentum parameters you choose. Then, once this system is working
well, insert this model into the system that switched between the stocks.
Trying to optimize a trading model while switching between stocks is just
to many moving variables to keep track of.

As described below, I had to write code to simulate the trades and do the
accounting. With this, I was able to do backtesting satisfactorily by
printing the results of an optimization run to the print log and then to a
file which I could then sort and chart with excel to select the optimum
parameters.

The code was quite complex.

Bob Fulks

------------------------------------

Original post of Mon, 12 Jan 1998 follows:


I built a "system" that switched between 34 securities in TradeStation by
inserting all 34 prices as 34 data series. You then use, for example, a
loop to cycle through the data series.

    for Index = 1 to 34 begin
        if Close of data(Index) > Close[1] of data(Index) then ...
        ...
    end;

You probably need to make the securities "Hidden" so they don't clutter up
the screen. With this many securities, I couldn't save the workspace as it
said it was too big to save.

Most built-in functions, such as Average, do not work properly since they
are built to sequence through successive bars of a single price. You have
to include the code for the functions you need in-line and use arrays to
save intermediate values for each security. For example, I needed a
function that used the past six values of a variable, so I needed to store
the variable in an array, such as "SValue[34,6]", and sequence through the
values with two loops, one for the 34 securities and one for the past 6
values.

You cannot use the internal buy and sell commands since they only work on
data1 so you need to program your own accounting and print everything using
print statements. You need to include a false buy signal to make the system
verify. I used

      "if FALSE then Buy;"

You can, however, use the optimization functions to cycle through a range
of values if you send the results to the print log for manual inspection or
exporting to Excel.

In summary, it is very tricky and not without problems but it can be done
and allows you to use the price data collected in TradeStation.

Bob Fulks


--
Bob Fulks
bfulks@xxxxxxxxxxxx