# Advanced Examples for our Formula Editor Part 1

### Dec 10, 2012

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.

#### 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.

[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!

[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.