Friday, December 14, 2012

Advanced Examples for our Formula Editor Part 3

I recently posted some examples of how I use our formula editor.  I got a lot of good feedback.  If you missed Parts 1 and 2, you can read Part 1 here, and Part 2 here. Several people asked if there are any secrets that we haven't shared yet.  Here are more examples, including a few secrets.  Shhh!

Dollar Volume

v_up_5*[Price]
[Price]*[TV]
The first line reports the approximate number of dollars traded for this stock in the last 5 minutes.  The second line reports the number of dollars traded today.  (We have a standard filter for the average dollar volume.)  This is just a small variation on a common idea.  That's the beauty of the formulas.  Formulas offer a lot more options than you can get from just the GUI.


More Tests

sin([Dec])
cos(bid)+tan(ask)+asin(sma_2_5)+acos(sma_5_5)+atan(sma_15_5)
Some users requested trigonometry functions.  I'm not sure what these are used for.  My job was just to make sure they were available.


Next Support or Resistance

[=u]
[=p]
These only makes sense for new high and low alerts.  These will report the same value that you see in the text description of the alerts.  The first one will port the next support or resistance level.  The second one will report the amount of change since the last new high or low.

Items that start with [= are new.  We don't have any documentation yet as they are somewhat complicated.  These all apply to the text that you see in the descriptions of various alerts.  There are a lot more that I haven't listed here.  If you need help, contact brad@trade-ideas.com.


Hidden Filters

p_up_1
v_up_1
[Dec]
These are available as normal filters in an alert window.  Normally these do not appear in the top list.  However, if you really want these, you can have them.  Just punch in one of these formulas and it will appear at the bottom of your config window, with all of your other custom formulas.


Smart Volume

[RV]??[PV]/100
This solves an interesting problem.  Relative volume is generally preferred to percent volume because the former takes the time of day into account.  The problem is that relative volume isn't available in the pre-market.  This filter will use the better one if it's available, and the other one if it is not.

Notice that we divide the percent volume by 100.  Relative volume is a ratio.  When we divide percent volume by 100, that changes it from a percent to a ratio.  Now the two are more similar.


Satan

Formula not Available
This is an interesting one.  It's very special and it can't be written out in our normal formula language.  But if you ask, our support people can add it for you.

This is a special type of random number generator.  This is useful to avoid curve fitting.  The idea is to optimize your strategy using a randomly selected subset of the market.  When you think you're done, try your strategy on the rest of the market.  That gives you a better idea if you've found something real.

We use this and other tricks in our execution consulting.

Wednesday, December 12, 2012

Advanced Examples for our Formula Editor Part 2


In a recent article I showed you some of the magic you can do with our formula editor.  Here are some additional examples.

This is just a sample to show you what's available.  I want to spark your imagination so you can create your own favorite formula.

This article covers advanced topics.  Ask us if you need help.

Above VWAP

([Price]-vwap)/std_20
There are so many possible combinations.  This compares the current price to the VWAP.  Then it uses the 20 day standard deviation to set the scale.  Positive numbers mean that the price is above the VWAP.

Earnings Date

([EarningD]>=-1 && [EarningD]<=2)
([EarningD]>=-1 && [EarningD]<=2)??-1
[EarningD]??100
Here are three different ways to find stocks which are reporting earnings soon or recently reported earnings.  I wrote the one on top first, and the one on bottom last.

There are two common problems when looking at earnings.  The first is to convert what you're thinking (i.e. "next week") from words into a formula.  Make sure you use the calendar tool that's built into our config window.  That will make your life a lot easier.

The other issue is null values.  What if a stock is approximately half way between its last report and its next report?  What if a company hasn't scheduled an earnings report?  What if you're not looking at a real company at all?  QQQ never reports earnings!  In all of these cases, the value for EarningD will be null.  If you display the earnings date as a column, null will show up as blank.  If you set a minimum or maximum value for these filters, you will not get any stocks where this value is null.

The first version of my filter will report a 1 for stocks which are reporting soon or just reported.  It will report 0 for stocks which will report in a few days or later, and for stocks which reported a few days back or sooner.  But you will still see nulls in the same cases.  Nulls are inconvenient!

My second attempt replaced the nulls with a -1.  It reported a 0 or 1 in the same cases as before.  This was a step in the right direction, but it still wasn't convenient enough.

My third version looks different, although it solves the same problem.  This is just like the normal earnings date filter, except I got rid of the nulls.  If something was null, we now report 100.  (I.e. way in the future.)  Mathematically, that's not entirely accurate.  However, this turned out to be very convenient.  If you're looking for a stock that's not reporting earning right now, is QQQ really any different from a stock that reported 1 1/2 months ago?

Pivot

([Price]-(high_p+low_p+last_price)/3)/[Price]*100
This one isn't very useful any more.  But it was very important at the time.  We didn't always have pivots as standard filters.  So I took some time and created the formulas myself.  And I shared these formulas with a few people who asked.  This became so popular that we made these formulas into a standard formula.  A lot of our standard formulas start this way.

Big 2 Minute Moves

abs([DUp2])
This reports the absolute value of the move in the last two minutes.  This is especially useful in a top list.  You can sort by this field to see all of the big moves together.  I.e. big down moves and big up moves at the top of the list.

Big Price

[Price]*1000000
This was another test.  We were testing what happens when you make your columns too small or your numbers too big.  You may have already noticed, we prefer to write "4,500,000", but we will write "4.5M" if you don't have enough space.

Stock is Moving Up.

sma_60_8>sma_60_20
This is a very simple binary expression.  It will return 1 if the faster SMA is above the slower SMA, or 0 if it is not.  

Move Relative to Standard Deviation

[DUp5]/standard_deviation
[DUp10]/standard_deviation
[DUp15]/standard_deviation
[DUp30]/standard_deviation
[DUp30]/[YSD]
These have been very popular in our execution consulting.  Again there are a lot of variations on a theme available to you.  But the OddsMaker just works really well with these formulas.

The last two lines are pretty much the same.  At one time the yearly standard deviation was only available in a custom formula.  That's why it's written out in words.  The last line was written later, after we added yearly standard deviation as a standard filter.

Coming soon, part 3... 

This article is the second of a three part series showing examples of some of the different ways to use the formula editor. If you missed Part 1, you can read it here. The next article will cover some advanced topics and some previously unpublished secrets. 


Sunday, December 09, 2012

Advanced Examples for our Formula Editor Part 1

I have many custom formulas in my Trade-Ideas account. Some of these were used to help a specific customer or to work on a special project. I decided to share these so you can see some real examples of formulas.

This article is for people who already know how to make custom formulas. If you're just getting started, look here.

Estimated Daily Liquidity

[TV]/shares_per_print*23400.0/max(min(seconds_after_open, 23400), 60)
This one is measured in prints, not $ or shares.  This looks at the amount traded today, and extrapolates to our expectation at the end of the day.  Notice that there are 23400 seconds in the trading day.

Yesterday's Gap

(open_p-close_p)/close_p*100.0
This is pretty simple. Notice that I added *100 at the end to make this a percent. Leave that off if you prefer a ratio.

Adjusted Relative Volume

[RV]*if([Vol]>10000000,1,if([Vol]>5000000,1.25,1.5))
I wrote this to show someone how to make a three way if statement. For stocks typically trading more than 10 million shares per day, this formula is just like our normal relative volume filter. For stocks typically trading between 5 and 10 million shares, this reports a number 25% bigger than the relative volume. For stocks typically trading fewer than 5 million shares per day, this reports 50% more than our relative volume.

This could be useful if you like stocks with a high relative volume, and you especially like stocks that don't trade as much on a normal day. However, I suspect I wrote this just as a sample for someone. Relative volume automatically takes so many things into account, you don't usually need an if statement like this. The if statement causes big jumps in the function; relative volume is usually smooth.

Test (“Hello world!”)

1+2+3
I have a lot of these. (I won't share them all.) You don't want to jump right in and try something big and complicated. Try something simple first and work your way up the big stuff. Usually I just send people the final result. You don't see all the simpler versions that I started with to get there.

This will, of course report the number 6. If you display this as a column, you'll see a lot of 6's. If you add a filter asking for stocks where this value is greater than 9, you won't see any stocks!

Total $ Traded today

[VWAP]*[TV]
A different way to look at how active a stock is.  A lot of mathematicians care more about $ than shares.

Very Short Term Volume Spike

v_up_1/(v_up_5-v_up_1)/4
This one compares the volume in the last minute to the volume in the previous 4 minutes.  (There are so many ways to look at volume.)  The result is a ratio; if volume is completely consistent, this will be 1.

Alert Specific Filters

quality
This seems pretty simple. In fact “quality” was originally designed to be part of a bigger formula. This is the same as the various alert specific filters. i.e. I want to see new highs, but only 10 day highs. Normally you can only use that field as a minimum value. When you say 10 day highs, you're also going to get 20 day highs. By creating a custom filter out of this, you get more control. You can say, show me stocks making new highs, but get rid of the 20 day highs. You can set the minimum or the maximum or both, just like any other window specific filter.

Log Scale

log(64,[PV]/200)*100
log(64,[PV]/100)*100
Marissa and I worked on some examples for a video a while back.


More to Come...

This article is the first of a three part series showing examples of some of the different ways to use the formula editor. The next articles will show more advanced topics. 

Tuesday, December 04, 2012

Don’t Always Believe What You Think

Don’t Always Believe What You Think

I saw this expression on a bumper sticker one day and I've loved it ever since. Like so many concepts that are seemingly unrelated to trading, when you dig deeper this one has lessons for all traders.


I believe it was Dr. Van Tharp who said something to the effect of “Traders don’t trade the markets, they trade their beliefs about the markets.” This is one of the catch-22s for new traders. You can only develop beliefs about the markets with experience and new traders don’t have the experience to develop their beliefs.  So how do you get started? It’s a difficult question.

Trading gurus will of course suggest that you follow their teachings and picks. This is an ok first step for some folks. The problem with this approach is that what you’re doing is trading someone else’s beliefs about the markets. You’re shoehorning someone else’s style to hopefully fit your own. Without a plan this is doomed for failure.

The answer is to develop your own beliefs. The best way to do that is through testing your own theories about how the markets work. A good place to start is by testing some commonly believed “truths” about the markets. Take a popular one like when a stock reaches a new high, go long. This seems intuitive at first glance. Look at AAPL over time and look at all the new highs. Of course this is a winning strategy, right?

Take that idea and put it to the test by backtesting it. You’ll probably be surprised at how non-universal this “universal” truth really is. I’m not saying that it can’t be traded profitably (it certainly can) but it’s way more nuanced than buying new highs. How old was the previous new high? How’s the market been acting recently? Is the volume higher or lower than normal? There are a million data points that may or may not make a difference in the profitability of this strategy.

Backtesting can help you quickly find out how these data relate to each other. Slowly but surely your beliefs become more and more robust and tailored to your psyche. In the long run this approach of developing your own beliefs is really the only one that works.

Explore the potential of your strategies using The OddsMaker

Visit our site to learn more about Strategy Development, backtesting using The OddsMaker, and how to sign up for our Execution Consulting services.

Monday, December 03, 2012

How I Nailed $FRX

How I use a multifaceted approach to beat the average

In the last blog post we discussed how our brain will often lead us in the wrong direction when it comes to investing and trading the markets. In his book Blink, Malcolm Gladwell writes more about this topic and the term “rapid cognition.” Rapid Cognition is the process of making decisions and coming to conclusions in the blink of an eye.

We want to recognize patterns in stocks because it is in our nature. We want to quickly see a pattern that is familiar. Patterns that yield results are comforting and reinforcing. Similar to how a glimpse of a grizzly bear is immediately registered as a threat (big animal, sharp claws, run!).

There is a tremendous amount of literature written and marketed about what works in the markets. And most of it is completely wrong because the markets constantly evolve to process and discount information in different ways. There is no one right way. Philosophically speaking, in the markets, most of us ought to listen to our inner George Costanza  and do the opposite of what we "think" is the right thing to do. It is much easier said than done however.

Nailing $FRX - Forest Labs at 32 dollars.

We walk the walk. Anyone who subscribes to Trade Ideas knows we built this technology first for ourselves.  We, the partners at Trade Ideas, are investors and traders. We use our own money for research and development, a litmus test for how well we design the software.

Here is a snapshot of my current E*Trade portfolio (Figure 1):

Figure 1: E*TRADE blotter. Note E*TRADE is a entreprise licensee of Trade Ideas technology in their Power E*TRADE Pro platform for active investors

$FRX was the most recent addition to my portfolio.  Here's how I discovered it, why I made the trade/investment and why many of you did not. Figure 1 shows I went long $FRX on Nov 16th at $32.22. Technically it was looking pretty weak coming down quickly from October highs of $37. In fact $FRX may have been a technical breakdown candidate play as shown below in Figure 2.

Figure 2: Chart of $FRX

I went long. First, I throw away cliches like “don't pick bottoms,” “sell lower lows,” “buy higher highs,” “stay with the trend,” “overbought,” “oversold,” etc. They are anecdotal pieces of information and work unreliably.  What I treat as gospel has nothing to do with technical patterns but rather with money management: “don't lose big” and “don't stay in losing trades a long time.” These are my cornerstones from which I make asset allocation decisions.

I scan for what the market is overlooking. I try to see both technical and fundamental information together because they tell more of the story. Thankfully this has recently been easier at Trade Ideas. New fundamental indicators help spot opportunities in a more optimal way. For $FRX I did a search for companies that make money, having the highest Estimated Annual Earnings Growth as shown in Figure 3:

Figure 3: Top List results http://www.trade-ideas.com/Cloud.html?code=a3dcafea3d9e6ca5960c6b4cc20bbad0
Now here are some interesting data points made more so by surrounding my sorted search with columns that give me more information about the stocks. As a secondary sort using color (patent pending) I painted the search results on a gradient based on the Amount Up from Jan 1. 

What made $FRX stand out? Well it was number one on the list of Estimated Annual Earnings Growth (the last column, column 11, in Figure 3 that is indented), a high income to debt ratio, and one of the higher EPS (column 10) - all things that are good in general. Price action showed, however, a different story. At the time it was on 4 month lows, so I described my hypothesis and the risk picture as: If it breaks August lows, get out because obviously the thesis is not proving itself. Otherwise stay in the position and manage it opportunistically.  So I took a chance, with my stops at lows below August lows. The rest is history.

Success is not the same for everyone. YMMV.  I'm hoping to show how I use a multifaceted approach to try to beat the average and the average Joes :-)

UPDATE 12/5/2012

The strategy in the article above starts with the premise that stocks with positive estimated earnings are good candidates to buy on a pullback or breakdown.  It turns out that recent research cited by Business Intelligence supports this strategy.

Drivers of total stock returns come from different sources. In his new 2013 market strategy report, LPL Financial's Jeff Kleintop examines the main contributors of stock returns throughout market history and points to Earnings as its biggest driver since Q1 of 2009.  Here is the chart below.  Click on it to go to the full summary of the report.

Figure 4: Business Intelligence