TDAmeritrade StrategyDesk Formula Reference
It’s here! After hours of intensive HTML and CSS work, and many more hours of troubleshooting (I think I’m getting rusty, especially with tables), I’ve completed the first version of my StrategyDesk Formula Reference. I’m so tired of looking in forty different places for this stuff, and I figured everyone else probably is, too. So here y’go. Enjoy.

BNJ said,
March 13, 2007 @ 5:44 pm
Wow, you are, like, my hero.
Listen, I think what you’re doing is important. I discovered your site because I, like you, had been beating my head against the poorly documented StrategyDesk. Figuring out how it works has been a bit of a forensic exercise, to say the least.
But, here’s the deal. I’ve been very busy lately with my day job, but as time allows, I’m hereby volunteering myself to assist with future documentation/formula projects.
Oh and also, one more thing. Don’t assume that TDA won’t compensate you for your documentation efforts, should you be willing to continue work on it. Granted, this was several mergers ago, when my broker was still “Datek,” I wrote a Palm app to get quotes and do trades. I got it mostly working, but got stuck on some minor detail. I finally got the guts to call them on the phone, expecting to be berated as a dirty hacker. Instead, they offered to pay me money. At the end of the day, it didn’t work out, but that was a function of my own lameness moreso than Datek’s. Anyway, just thought it worth mentioning.
Will said,
March 14, 2007 @ 6:31 am
BNJ- thanks very much! We’re gonna make this thing work! Hey, if TDA wants to fly my up to (wherever) and give me ($$) to be their Devil’s Advocate, I’d love it. But in the meantime, we’ll continue to try to make their tool functional despite its shortcomings, so we can spank Mr. Dow and Mr. Jones… the most fun of all.
Wyn said,
March 17, 2007 @ 7:31 pm
Thanks for putting the information together! I see I’m not the only one scratching his head at StratDesk’s functionality and lack of documentation.
Not to be rude, but TDA does have all that information in your reference page available as a downloadable PDF. Perhaps they took the info from this site for the PDF?
At any rate, I still havent found any documentation online for their strategy functions. For example, how many arguments can the MovingAverage function take? And what do they do? Sure, a decent programmer can guess at the function and play around with them until they figure it out… but who has that kind of time?!
If anybody has a list of the function defintions or API documentation, please let me know.
Will said,
March 18, 2007 @ 8:42 pm
Wyn- You are absolutely correct that versions of many of the formulas in my chart are in either AMTD’s Formula and Syntax Guide or their User Manual, which I linked in the first article I wrote about the software. However, if you go through them line by line, you’ll note some errors that I’ve corrected in my version, and you’ll notice some that I’ve added that aren’t in their reference, and vicey-versey. My main intent is to construct one centralized, concise and clear formula reference which isn’t all scattered and random like theirs.
As I point out in the introduction to the table, it’s a “work in progress” which indeed started with already-available ideas like moving averages, etc (although mine are in a more usable format, in my completely unbiased opinion). I’ll be adding more and more to it as I get time and as other people donate theirs. If you’ve got any good formulas you’d like to share, I’ll be glad to add ‘em. And if you can decode NumTriggered % 2=0 for us I’ll have a amorous nymph drop by and kiss your toes! It sounds like you have some programming experience, asking about the API documentation and all. So far, the most infuriating thing I’ve found about this software (including how damned slow it is) is the fact that those three stupid PDFs are all the documentation AMTD has ANYWHERE so far. Darn them to heck. I still think our best bet is to track down where they got this software (they hardly ever do anything on their own), and ask that person/company for some back-door help.
As for how many arguments the functions can take, I’m still playing “hit and miss” as you are… and sometimes the ANDs and ORs don’t work quite right with multiple arguments, no matter how clearly you “parenthesize” them. I’m planning on adding some tips and precautions on creating formulas to that chart as well, if I can only find that day with 26 hours and week with 8 days. Thanks for dropping by and I appreciate your input!
jay bird said,
March 19, 2007 @ 3:54 am
Can you make me a formula that will find me stocks that break the high it made in the first hour of trading. I’m not good with formulas and can’t figure it out.
thank you
Will said,
March 19, 2007 @ 9:39 am
jay bird- I’m working on exactly such a formula this morning, but I’ve gotta call it off to go to work. With no documentation to fall back on, I’m forced to try this and that while the market is open and “deduce” what the formula is doing by the results it returns. Will try and update you tonight on what I’ve gleaned so far; we’re not too far from having a working formula which will give us the Opening Range at any time during the day. That formula has to be unnecessarily complex, because it looks like we’ll have to say something like “if the hour in which this 5-minute bar begins is 1300, show me the high for the 30-minute bar seven bars before the last complete 30-minute period“, then repeat that a million times to account for any time of day. More later- oh, and thanks for visiting!
Wyn said,
March 19, 2007 @ 11:18 pm
Will -
If they are adhering to typical (as in the norm for the past 30 years) programming language convention, the ” % ” sign here is the modulo operator. What this does, is returnthe remainder of a division operation.
So if we do 5 / 2 , the remainder is 1. Hence 5 % 2 = 1.
Make sense?
So in this case, NumTriggered % 2=0 , it is testing if NumTriggered is evenly divisible by 2, aka an even or odd number.
Cheers.
Will said,
March 19, 2007 @ 11:28 pm
Wyn- in their limited example, it pops up in one line as equal to zero and in another as equal to one, so that must be exactly what’s going on. Thanks so much for the lesson! (Nymph has been dispatched)
Will said,
March 20, 2007 @ 6:24 pm
Ok jaybird, here’s the formula that should return the high of the first 60-minute bar of the day, aka the 0930-1030 high:
(Bar[Hour,60] = 9) * Bar[High,60] +
(Bar[Hour,60] = 10) * Bar[High,60,1] +
(Bar[Hour,60] = 11) * Bar[High,60,2] +
(Bar[Hour,60] = 12) * Bar[High,60,3] +
(Bar[Hour,60] = 13) * Bar[High,60,4] +
(Bar[Hour,60] = 14) * Bar[High,60,5] +
(Bar[Hour,60] = 15) * Bar[High,60,6]
To find stocks which are above that high, you’d simply put a statment in the screener which said Last > (insert above formula here). Be sure your symbol list includes all the stocks you’re watching, and I’d also suggest that you not make that list more than a few hundred stocks long so you don’t bog SD down too much.
If you only want stocks that are currently crossing that first-hour high, you’ll need a more complicated formula which says the “Low” of the current bar is below the first-hour high AND that the “Last” price is above the first-hour high. If you used a 60-minute bar as the “break bar,” the formula would look like this:
Bar[Low,60] < ((Bar[Hour,60] = 9) * Bar[High,60] +
(Bar[Hour,60] = 10) * Bar[High,60,1] +
(Bar[Hour,60] = 11) * Bar[High,60,2] +
(Bar[Hour,60] = 12) * Bar[High,60,3] +
(Bar[Hour,60] = 13) * Bar[High,60,4] +
(Bar[Hour,60] = 14) * Bar[High,60,5] +
(Bar[Hour,60] = 15) * Bar[High,60,6]) AND Last > ((Bar[Hour,60] = 9) * Bar[High,60] +
(Bar[Hour,60] = 10) * Bar[High,60,1] +
(Bar[Hour,60] = 11) * Bar[High,60,2] +
(Bar[Hour,60] = 12) * Bar[High,60,3] +
(Bar[Hour,60] = 13) * Bar[High,60,4] +
(Bar[Hour,60] = 14) * Bar[High,60,5] +
(Bar[Hour,60] = 15) * Bar[High,60,6])
Caution: I haven’t tested this yet, just came up with it as I was typing; be sure and try it out during market hours and make sure it works before you depend on it for real trading.
Hope this helps!! Cheers!