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. 

No comments: