Basic Overview of Using Strategies in Thinkorswim
So you have this trading strategy but you have no idea how it performs. Wouldn’t you love to be able to have Thinkorswim automatically test your strategy for you? And wouldn’t it be great if it let you export the trade details so you could analyze them in a spreadsheet? Yeah, it can do that. This video, “Thinkorswim Strategy Guide”, shows you how. The video even includes a link to download a custom strategy that can both long and short entries. The link is embedded within the video so be sure to watch for it. This amazing feature in Thinkorswim is explained step-by-step. If you want to see more videos on this topic just be sure to like the video and leave some comments below.
The following link will take you to the page where you can download the strategy featured in this video:
Strat_PivotRev_SlowDRevSTRATEGY.ts
For Advanced Users Only:
Take this knowledge to the next level and learn how to automate your trades on Thinkorswim
Thinkorswim Automated Round-Trip Trades
DISCLAIMER: I AM NOT A CERTIFIED FINANCIAL ADVISOR AND NOTHING IN THIS VIDEO OR TEXT IS AN ADVERTISEMENT OR RECOMMENDATION TO BUY OR SELL ANY FINANCIAL INSTRUMENT. NOR IS THIS VIDEO OR TEXT INTENDED TO INSTRUCT YOU ON HOW TO MAKE BUY OR SELL DECISIONS USING ANY OF THESE INDICATORS.
*Thinkorswim is a chart analysis platform offered by TD Ameritrade: www.tdameritrade.com
TD Ameritrade provides financial services including the trading of Stocks, Futures, Options and Forex.
Please be sure to share this page with your friends and colleagues. Leaving comments below is the best way to help make the content of this site even better.
Watch the video, Thinkorswim Strategy Guide below:
A viewer requested the lower study version of a strategy demonstrated in this video. The time stamp where this appears is around 11:22 and the study is called “Strat_PivotRev_TrailSqz”. I decided to make this available to everyone right here at the end of this post. The code is displayed below. Just select the text of the code and copy it to your clipboard. Then in the TOS platform go to the edit studies window and click the ‘New” button in the lower left. You can name the study however you like, then paste this code into that window, being sure to first clear away any text that shows up by default. Hope it helps. If you any further questions just leave a comment in the box below.
declare lower;
input direction = {default "Long", "Short"};
input tradeSize = 100;
input KPeriod = 10;
input DPeriod = 10;
input priceH = high;
input priceL = low;
input priceC = close;
input averageType = AverageType.SIMPLE;
def SlowD = reference StochasticFull(80,20,KPeriod,DPeriod,priceH,priceL,priceC,3,averageType).FullD;
def pivotLow = low > low[1] and low[1] < low[2] and low[2] < low[3];
def pivotHigh = high < high[1] and high[1] > high[2];
plot pivotLowReversal = ( pivotLow and close > high[1] ) or ( pivotLow[1] and close > high[2] and low > low[2] and high[1] < high[2] );
plot exitLong = SlowD < SlowD[1] and SlowD[1] < SlowD[2] and highest(pivotLowReversal[0],2) == 0;
def entry;
def exit;
switch (direction) {
case "Long":
entry = pivotLowReversal;
exit = exitLong;
case "Short":
entry = no;
exit = no;
};
Hi Pete,
If we buy stock at multiple entry points , like I bought Ulta at 240 , and 190 and if I want to sell orders which I bought at 190 . Please let me know how the script for it should be.
Thanks Rao.
What you are asking is nothing more than a matter of book keeping. (do you use First-In-First-Out or do you take the average price. You cannot structure any sell order in any way that can impact this. You need to contact TD Ameritrade and have them explain this to you. It has absolutely nothing to do anything presented in this video.
Hi Pete, maybe I didn’t be clear. I want to print the signals, not at (open[-1]), not a the open of next bar, just at the price where condition triggers (same price of the market when ‘alert’ condition sound is printed at message center). Is that possible? Thank you!
This all depends on the code you are using. The comment section of a video is not the place to be trying to work out things of this complexity. There is no blanket answer this question. There is not one size fits all solution to your question. Post a question in the Q&A forum and include your code, a screenshot and and explanation of what your code is not doing correctly.
Hi Pete, it seems all the TOS strategies print entries and exits at the ‘open’ of bars. Is there a way to print at the ‘real price’ when strategy condition triggers? Do you’ve an example? Thank you!
Sounds like you want a chart strategy that simulates an entry based on a stop or limit order rather than a market order on open or market order at close. I have built several of these for clients but I am not sure if anything has been published to the public. You can browse our Q&A forum to see if there are any examples there: https://www.hahn-tech.com/ans/cat/strategies/
No stop or limit, I meant if the entry can be printed (Chart / Report) at the exact price in which the condition is met, and not at the ‘open’ of bar as usual by default. Otherwise you get a false performance.
For built-in strategies, if they set the entry at the open of the bar following the signal then this is absolutely correct. If you are building your own strategies then yes, it is very important to write the code so that is uses the correct entry price. But a built-in strategy included with Thinkorswim that buys at the open is absolutely providing accurate performance.
Hi Pete, is there a way to export Options strategies to Excel? Thank you!
If it’s on a chart, and you have a chart strategy loaded on the chart, they yes. The process is no different. However because you asked this question I suspect you are not talking about plotting an OPRA code on a chart with a strategy and exporting that to Excel.
Peter, thank you so much for your time and effort in providing such useful videos, it is truly appreciated! Question: If I want to turn the above Study (script above on this page) into a strategy what do I need to adjust because copying the complete script of the Study into a new strategy doesn’t work.
The code posted below the video was added after another viewer requested a lower study version of the chart strategy. The download link for the chart strategy version is included within the video. Look for the info button in the upper right corner and click on it while the video is playing.
Good Morning Hahn, i love your videos. i’m trying to modify the MTF macd so that it can accept tick and range bar charts unstead of just minutes. do you t hink this would be possible? (i’m not a coder) thanks for all that you do. YOU ROCK.
Glad you like the videos. At this time there is no way to apply secondary aggregation periods on any Range bar chart. And Tick based aggregation periods are not available to reference as a higher time frame. Here is a full list of available aggregation periods for referencing higher time frames: https://toslc.thinkorswim.com/center/reference/thinkScript/Constants/AggregationPeriod
Hi Hahn, may i know where do I get your amazing studies and strategies library that I can download and import to my TOS platform? Thanks for your video, very useful indeed!
There is no such library. Each piece of code is published in connection with a free video tutorial. In order to download each custom tool you need to watch each video.
hey Pete this file would not load into tostados. invalid characters
TOS*
I just tested the file and it is working just fine. I’ve never heard of the error message: “invalid characters” on Thinkorswim.