The perfect moving average

Discussion in 'Technical Analysis' started by aphexcoil, Sep 6, 2002.

  1. After manually reviewing tick by tick data for a few hours, along with their respective bid x ask levels and number of contracts, I've determined that there is a method to come up with the ultimate moving average.

    First, let's review what a moving average is -- a moving average is simply an average of X previous time-periods that constantly moves along with current price data. There is candle moving averages that are based on either the close, open, high, low, high-low / 2, etc. There are also exponential, triangular, variable, weighted and simple moving averages.

    Now, a moving average on a 1, 2, 5, 10, 30 minute-- whatever -- is not always a good representation of reality. Why?

    Here is an example. Let's say there is a wide range of movement within a 2 minute candle. Now, if the price is 890.50 for a long time and then spikes up to 891.25 for a second and then falls back down, that 891.25 will be used within some moving averages, even though it is more of an anomoly and doesn't deserve the same "weight" as the other numbers.

    Even tick data is imperfect. What if you have this scenerio:

    802.50 x 802.75 [1 contract x 193 contracts] -- Well, if someone actively sells into that 1 contract bid, the next tick gets knocked down to 802.25 x 802.50.

    So, I'm going to program a moving average that gives weight to each tick of data and is adjusted by the bid and ask weight. I think this will be far more reliable.

    I'll let you know what I come up with.

    aphie
     
  2. tntneo

    tntneo Moderator

    that would be a weighted moving average, not a perfect moving average :)

    anyway, it will still have the major problem of any MA : lag.

    what will be your use of this MA ?

    PS : I will move later this thread to the TA Forum. seems more logical.
     
  3. The use of the MA would be to help establish better exit points for my system. I was aware that weighted MA is based on volume, but does it go so far as down to the tick level based on number of contracts sold per tick?

    aphie
     
  4. "Even tick data is imperfect. What if you have this scenerio:

    802.50 x 802.75 [1 contract x 193 contracts] -- Well, if someone actively sells into that 1 contract bid, the next tick gets knocked down to 802.25 x 802.50.


    Hi Aphie,

    I'm not so sure this is a flaw. Isn't this exactly how price changes? The buyers at 802.50 dry up while the sellers are prevalent at 802.75. So, the price moving down represents change in supply/demand- just like it should. No?
     
  5. resinate,

    Right, it isn't a flaw. However, there are a few situations that I see occuring.

    I am watching ES tonight when it goes very slow (and the spread widens up pretty nicely). When you see that LAST SALE price move around, it could either be:

    a) A buyer buys at ask and moves the price up a quarter point.
    b) A seller sells at bid and moves the price up a quarter point.

    Now, if there are more sellers and/or buyers behind the receiving end, the bid x ask prices remain where they are. However, if all the contracts are exhausted on either side, the entire spread moves up or down.

    I guess what I'm trying to do is find some method that goes beyond just price-movements (based on how hard and fast sellers are hitting bid, or vice-versa). I may be going no where with this, but it is a fun academic exercise to at least play with the data.

    aphie
     
  6. ddefina

    ddefina

    An idealist at 25 becomes a realist at 35
     
  7. m_c_a98

    m_c_a98

    You should check into Interactive Brokers API or PATS API so you can integrate your own trading interface. IB's is fairly easy, at least with the ActiveX API. or you can use Java or C++ I believe.

    Regarding this moving average idea, I think you should abandon it immediately but thats just my opinion, test it out and see:)
     
  8. dottom

    dottom

    Alphie, before you try and reinvent the wheel, look at AMA, VIDYA, TEMA, DEMA, T3, MAMA, and JMA.

    There are many ways to create a "better" MA but there are tradeoffs depending on what you need the MA to do.

    For example, you can create an MA that has:

    1. less lag
    2. less overshoot
    3. less undershoot
    4. more smoothness

    but you usually have to tradeoff one attribute to gain in another. There are also several different approaches to achieve the above 3, the most common being filtering on volume, volatility, or frequency.

    You could try and create an MA filter based on bid/ask spread, but I bet your results will be very similar to just looking at volatility/volume/frequency/etc. of the price action itself. If you want to account for the volatility of the bid/ask spread, then take one of algorithms from the MA's I mentioned and just apply that to bid/ask movement rather than price movement. Same thing if you were looking at the frequency domain.

    Also, keep in mind that the bid/ask aren't actual trades. If you're looking at stocks, do you aggregate all the activity from all the ECN's? How do you account for tricks that specialists (on NYSE) or "the axe" (on NASDAQ) play like showing you a one lot bid on one ECN above all the other bids but a large ask lot on another ECN? How do you account for something that is offered for X period of time then removed?

    Then there's the problem of getting and processing the actual data itself. You can't just use Wealth-Lab or Tradestation. You know have to build your custom platform.

    Just some food for thought...
     
  9. It seems that your observatons would fall into the category of ROC or rate-of-change. When understood, the rate-of-change can be very useful, much as acceleration is the rate of change of speed.

    Even more refined is the ROC of the ROC. The calculation is the same, only applied to the primary ROC.

    I think your observation has merit. As much merit as volume spikes have in chart interpretation. That is all you are observing, and what you seem to be trying to quantify, and smooth. An ROC in volume will be the first order, providing you with the speed of buying or selling; and the ROC of the primary ROC will define when the acceleration of buying or selling is increasing or decreasing.
     
  10. dottom,

    I am probably reinventing the wheel, but when you program and actually look at the data yourself, you get a whole new appreciation for just how amazing the mathematics is behind all this.

    My observations are just on ES -- index movements. I'm not concerned about stocks at this time, because I'd like to focus my efforts on a highly liquid future-index that always has .25 spreads during the day.

    Thanks for your post. I am not aware of a few of those -- but I've heard and seen some of the other ones.

    Maybe in my attempt to reinvent the wheel, I'll come up with a better square?

    aphie
     
    #10     Sep 6, 2002