Ranking indicators across all equities

Discussion in 'Strategy Building' started by Rocko Bonaparte, Oct 14, 2009.

  1. OK this is something new to me. I'll have to look in to it. It looks like it would make use of multiple indicators. Eventually I may get there, though my issue starting out in this thread is getting one that seems to work at least little bit.

    I had come up with two ideas that I hope to implement tonight:
    1. Buy and hold like the indicator seems to normally be used. That is, keep the stocks after the buy trigger and stay with them until I either hit my stop loss or it gets a second sell trigger.
    2. Try some different things with the indicator so that it's not just shooting off for one day that the initial trigger condition happens. I'm all stuffed on cold meds and such so I don't want to get into a stream-of-consciousness ramble about what I might try to do, but I hope the end result would be an indicator that continues to issue some information after the crossovers.
     
    #11     Oct 15, 2009
  2. For anybody follow the thread, I think I have to put this on ice since the cross-market backtesting I'm doing is showing that for individual stocks I'm not necessarily doing better than chance either. I have to fix the algorithm a little bit before I continue here. I think the whole thing is still an interesting problem, but I don't think I should try tweaking an algorithm to work across a basket of equities before I can handle trading one at a time.
     
    #12     Oct 19, 2009
  3. I actually think differently. IMO it is easier to get something that works on a basket. Say there is a predictable component of a stock's return and an unpredictable surprise component. In an individual stock your return can be dominated by the surprise component even if your algorithm predicts perfectly. In a basket some of the good surprises and bad surprises cancel and you get closer to the predictable part.
     
    #13     Oct 19, 2009
  4. Yes that's all well and good--when there isn't a bug in the source code like I'm dealing with :p

    But to keep the ball rolling, what if outliers tend to always come up on top? If I create a sufficiently diverse portfolio, I can eventually cancel that out, but how do I know how much to spread it? Why not just ignore the first x picks outright?
     
    #14     Oct 19, 2009
  5. I use amibroker backtester a lot. Be careful there is a design flaw in handling entry/exit value. it will give you most favorable values on the specific bar, if you do not consciously avoid it.
     
    #15     Oct 19, 2009
  6. I'm using something I slapped together myself. It turns out the problem is in details of how to implement a strategy more than anything else.

    Here are some of the problems I am dealing with
    1. Holding for one day just isn't working out too well. Lately I've been skimming more and more stuff from people that, when swing trading, will hold for "a few" days (up to three) before selling. Maybe I can make a hard rule to hold for one day, but I think for the sake of discussing strategy with people I here, I'll want to use what is standard. Otherwise, that's another factor to nitpick.
    2. When trading based on a single equity, the algorithm often triggers, buys, then hits a 2% stop loss. The indicator will still buy high despite this, and the next day it'll turn around and buy it again, often hitting another stop loss. Rinse and repeat. I had been reading on here about this 2% stop loss rule and thought it was arbitrary. Am I interpreting the idea incorrectly?
    3. A day ago I changed the sell strategy so that it wouldn't sell until the indicator went negative. What would then happen was--if the stop loss never triggered in the first place--the algorithm would trigger a buy, and then it would sit on it over the entire window of opportunity, before selling it for break-even or worse.
    4. When I ran it across all equities, often the same symbols would come up a few times in a row. This is like the situation in #2, except now all equities are in play. I was testing from September 2008 to September 2009, and AIG could pop up pretty often in a row, losing most of the time. I suppose one could blacklist some of these, but I feel like that should be a last resort.

    Something I read elsewhere about MACD is that one shouldn't even be trying to go long with it unless the equity is above it's 200 day EMA. That might cull some of this out.

    Today I have it humming on single equities, seeing again if I can be successful on single stocks. I implemented something like rolling stop; every night it looks at the closing price and sets a new stop based on that. There can be a situation where over a week I lose > 2% then if, say, every day it's losing just a little bit, but never enough to trigger a stop. It's just something I'm trying until I implement something I figure is more realistic. Come to think of it, what would be a realistic expectation for a rolling stop order? I do feel like this is worrying about the wrong stuff though.
     
    #16     Oct 20, 2009
  7. Here's some more stuff I've been seeing that anybody else considering this should be thinking about:

    1. Data integrity. When I'm looking at individual equities, I tend to better maintain that the data I'm looking at is good. It's a bit harder for multiple symbols across multiple exchanges. I've been using a mysql database, and sometimes stuff just screws up in there. The problem is that the database doesn't always crash when this happens. So a price might change, and screw everything up. Suddenly you're trading a stock that has a bogus, extremely ridiculous value, and you go from having $20k to -$177k. Yeah. I have to rebuild the database tonight and I expect that'll go away.
    2. Penny stocks. This thing sure does love them. I was running the assumption that I could only fill an order that was 1% of the total volume of the preceding day, so it'll keep piling on orders until I've accounted for all my cash. So even if I have a penny stock moving, say, 100000 shares, it will go for 1000 of them and move on. next in line in the rankings is often another penny stock. Not only does the transaction costs add up, but there are volumes on how these stocks (mis)behave. Without governing this in some way, a strategy open to the whole market will inhale penny stocks.

    I'd say two thirds of the orders were running less than a dollar, and almost all of them less than five dollars.

    The fast solution would be to put a $5 restriction, but it would be better to eventually have some kind of indicator that naturally excludes penny stocks.
     
    #17     Oct 21, 2009
  8. I fixed my data integrity problem with new RAM. For those computer savvy, the machine was passing memory self-tests perfectly fine, but things are much better now with new RAM sticks.

    Anyways, I started testing a new strategy that has no AI in it. I am likely still going to find some trouble because I did some parameter mining, which runs a big risk of curve fitting. I am trying to develop a formula that looks at different parameter sets for each stock and tries to come up with a final decision, as a way to try to mitigate this.

    What would probably be more interesting to everybody is how often the system will pick stocks with a particular pattern and then get crushed by them. I guess you can say I'm looking at a mean reversion system, or at least something looking for oversold stocks. It tends to pick things when they're trying to rebound, which implies they've gone down previously. Unfortunately, sometimes a stock will have experienced a ridiculous drop, probably related to a news event or something else tragic. It will show up either as a non-contiguous drop (a bar floating in mid air on the chart, or one day's bar significantly higher than the next day's with no reconciliation). Or else it'll be a ridiculously low drop. I would think when situations like that happen, whatever system is in place should just walk away.

    Mean reversion traders would say this is obvious, but consider that if you're only looking at a handful of stocks normally, and your selection is among more "regular" stocks, then this kind of thing doesn't happen too often. But when you're sweeping across the market, it pops up all the time.
     
    #18     Dec 19, 2009