Author Topic: Using Black–Scholes in your custom Trade-Ideas formulas  (Read 12237 times)

braddoubleu

  • Administrator
  • Sr. Member
  • *****
  • Posts: 453
  • Karma: +8/-1
    • Trade-Ideas
Using Black–Scholes in your custom Trade-Ideas formulas
« on: June 28, 2011, 11:54:43 am »
One of the common requests we get goes like this.  "I want to see different filters in the middle of the day than at the end of the day."   There are several ways to do this.  They all rely on the seconds_after_open field.


The way some people phrase the question, you might want to use an "if" function.  A formula might look like this:
[some basic formula] * if(seconds_after_open < [early morning], 5, if (seconds_after_open < [afternoon], 3, if (seconds_after_open <[the close], 1.5, 1)))
So we broke the day into 4 periods, and we use a slightly different formula at different times.  You can do that if you want, but I think this next example is what most people really want.

Let's pick a very specific example.  At the end of the day I like to use the volume in shares filter.  But earlier in the day I know most stocks will have lower values.  So I want to scale the value in the middle of the day.  I like stocks that trade 1,000,000 shares or more at the end of the day.  But if a stock trades 500,000 shares in the first half of the day, I think that's about the same.  (Or if it traded 250,000 shares in the first quarter of the day.)  When I see 500,000 shares in the first half of the day, I'm going to estimate that the volume at the end of the say will be 1,000,000.  Let's write that as a formula.

[TV]*23400/seconds_after_open

At the close (23,400 seconds after the open) this new filter will have the exact same value as the standard volume filter.  Half way through the day, it will double all of the numbers.  1/3 of the way through the day it will tripple all of the numbers.  Unlike my example with the "if" statements, it will continuously and smoothly update its estimate.

Once you enter this filter, you can use it just like the standard volume today filter.  That's worth repeating.  Once you have added this filter to your account, you can use it just like the standard volume filter.  To continue with this example, you'd look for the new icon in the config window, and you'd type 1,000,000 in the min column.  You don't have to know how to write these custom formulas to use them.  You can copy a custom formula from a friend, from our support forum, etc.  Once you have it, it is very easy to use.

So now we have an estimate of the volume at the end of the day.  And it's probably a decent estimate.  There are other ways we could have done this, and we can never really predict this value with absolute certainty.  But this probably does what you want.

What if I want to do the same thing with price?  What if a stock moved up $1 from the open, and it's only lunch time?  Could I write a formula which would assume that the stock would be up $2 at the close?  Of course we could.  (That formula is left to the reader as an exercise.  :-) )  But is that correct?  If a stock went up $1 in half a day, do we really think it's going up $2 in a whole day?

There are a lot of answers to that question.  Predicting the stock market is not an exact science, to say the least.  :-)  According to the efficient market hypothesis, if the stock is up $1 right now, the best estimate is that the stock will still be up $1 at the close.  That's not a very satisfying answer.  Can we do better?

Of course we can do better.  The secret is to stop trying to predict the market.  Let's go back to basics.  Trade-Ideas is good and finding stocks that are interesting, important, or unusual.  So let's rephrase the question.  If a stock is up $1 half way through the day, how unusual is it?  If that same stock is up $2 at the end of the day, is that just as unusual?  Is it equally important?

That's where Black–Scholes comes in.  The Black–Scholes model tells us exactly how to compare different movements of price and time http://en.wikipedia.org/wiki/Black%E2%80%93Scholes.  And the formula is easy to add into Trade-Ideas using our custom formula editor.  Here's how it looks:

[FOD]*sqrt(23400/seconds_after_open)

Wasn't that simple?

For those of you who aren't familiar with Black–Scholes, we're saying that a move of $1 in the first quarter of the day is just as unusual/interesting/important as a move of $2 over the entire day.  A move of $1 in the first half of the day compares to a move of $1.41 at the end of the day.

Want to check that out on your own?  As you review the literature on Black–Scholes, look for the term "z-score" (or the related term "standard deviation").  We are saying that these two measurements from different times have different "z-scores".  That's how a statistician says that they are equally unusual.

So, if you like to watch our up from the open filter, but you want to use different minimum and maximum values as different times of day, now you have an alternative.  Use this custom filter.  Fill the the same maximum and minimum values that you would have used with the standard up from the open filter at the end of the day.

Barrie Einarson

  • Administrator
  • Hero Member
  • *****
  • Posts: 610
  • Karma: +20/-1
Re: Using Black–Scholes in your custom Trade-Ideas formulas
« Reply #1 on: June 28, 2011, 02:45:47 pm »
Excellent Brad!!  Keep them coming - fascinating what you can do with TI now.

youngamerican68

  • Jr. Member
  • **
  • Posts: 65
  • Karma: +0/-0
Re: Using Black–Scholes in your custom Trade-Ideas formulas
« Reply #2 on: June 30, 2011, 03:46:42 pm »
Brad this is great stuff. Would it be possible to apply the black sholes logic to a stocks range for the day? Would we be able to say put in for minimum range 300% and then have TI show us stocks earlier in the day before they have hit  that 300% threshold?

Thanks
Paul

TradeIdeas_DA

  • Administrator
  • Hero Member
  • *****
  • Posts: 729
  • Karma: +9/-2
    • Trade Ideas LLC
Re: Using Black–Scholes in your custom Trade-Ideas formulas
« Reply #3 on: June 30, 2011, 04:36:54 pm »
The example above refers to the progression of time during the market hours and using Black Scholes attempts to inform if certain movements are unusual based on the time of day. 

You seem to be asking for movements based on the stocks position in the range of the day. Note that you can use the example above layered with the other filters in the Trade Ideas inventory.  Please clarify what you are looking for and we'll respond. Thanks
Follow me on Twitter: http://twitter.com/TradeIdeas

youngamerican68

  • Jr. Member
  • **
  • Posts: 65
  • Karma: +0/-0
Re: Using Black–Scholes in your custom Trade-Ideas formulas
« Reply #4 on: June 30, 2011, 06:07:32 pm »
What I am looking to do is take a stock whose range for the day (todays Range filter) was 300% and then apply the black sholes model to find stocks who may be heading in that direction of attaining a range of the day which is 300% the norm as indicated by price action earlier in the day.

youngamerican68

  • Jr. Member
  • **
  • Posts: 65
  • Karma: +0/-0
Re: Using Black–Scholes in your custom Trade-Ideas formulas
« Reply #5 on: June 30, 2011, 07:04:48 pm »
I think I may have figured it out. Is this correct [TRangeD]*sqrt(23400/seconds_after_open)

braddoubleu

  • Administrator
  • Sr. Member
  • *****
  • Posts: 453
  • Karma: +8/-1
    • Trade-Ideas
Re: Using Black–Scholes in your custom Trade-Ideas formulas
« Reply #6 on: July 08, 2011, 12:37:09 pm »
Your formula looks correct.

ssolomon

  • Newbie
  • *
  • Posts: 7
  • Karma: +0/-0
Re: Using Black–Scholes in your custom Trade-Ideas formulas
« Reply #7 on: July 11, 2011, 02:35:21 pm »
Hi Brad,

I tried to copy the formula you listed on the Black Scholes model but when I duplicated a window then tried to paste it to the bar I had a different result. Looks like only the heart icon shows up? Thanks Sam

TradeIdeas_DA

  • Administrator
  • Hero Member
  • *****
  • Posts: 729
  • Karma: +9/-2
    • Trade Ideas LLC
Re: Using Black–Scholes in your custom Trade-Ideas formulas
« Reply #8 on: July 11, 2011, 02:49:18 pm »
Are you entering the formula correctly in the editor page? All users now have the ability to create custom filters using formulas based off existing data.
http://www.trade-ideas.com/FormulaEditor/List.html

The instructions are located here: http://static.trade-ideas.com/FormulaEditor/Instructions.pdf
Follow me on Twitter: http://twitter.com/TradeIdeas

ssolomon

  • Newbie
  • *
  • Posts: 7
  • Karma: +0/-0
Re: Using Black–Scholes in your custom Trade-Ideas formulas
« Reply #9 on: July 11, 2011, 02:57:26 pm »
I used the collaborate function to paste the the formula. I'm guessing there is more to it? Sam

Barrie Einarson

  • Administrator
  • Hero Member
  • *****
  • Posts: 610
  • Karma: +20/-1
Re: Using Black–Scholes in your custom Trade-Ideas formulas
« Reply #10 on: July 11, 2011, 03:14:27 pm »
You have to create the Custom filter first in the Formual Editor - just copy and paste the Black Scholes script that you want - and then add it to your Top List or Alert window you create.

ssolomon

  • Newbie
  • *
  • Posts: 7
  • Karma: +0/-0
Re: Using Black–Scholes in your custom Trade-Ideas formulas
« Reply #11 on: July 11, 2011, 04:05:12 pm »
Thanks Brad,  I successfully copied the two Black Sholes formulas listed in your forum. After I entered 1,000,000 in the min column I get no data. Please excuse my questions I'm not a programmer.  Sam

ssolomon

  • Newbie
  • *
  • Posts: 7
  • Karma: +0/-0
Re: Using Black–Scholes in your custom Trade-Ideas formulas
« Reply #12 on: July 11, 2011, 06:01:22 pm »
My last reply actually was a question. I'm getting no data. What do you think I may have to do to circumvent my error? Sam

TradeIdeas_DA

  • Administrator
  • Hero Member
  • *****
  • Posts: 729
  • Karma: +9/-2
    • Trade Ideas LLC
Re: Using Black–Scholes in your custom Trade-Ideas formulas
« Reply #13 on: July 11, 2011, 09:53:26 pm »
Sorry. I'm going to suggest a bit more time with the guide we wrote and the other helpful posts in this section. Also try entering different values and see if you get results. Beyond a better explanation of what you want to do, I don't have much else to say
Follow me on Twitter: http://twitter.com/TradeIdeas

ssolomon

  • Newbie
  • *
  • Posts: 7
  • Karma: +0/-0
Re: Using Black–Scholes in your custom Trade-Ideas formulas
« Reply #14 on: July 15, 2011, 01:21:33 pm »
Brad, could I  pay for your time in order to help me? Sam Solomon