Fixed Stop Loss and Profit Target Strategies for Think or Swim

As promised, here are four strategies showing how to implement fixed stop losses and fixed profit targets for TOS. You need to add these to a chart with some entry strategy. I have included two example entries for you to test out if you want. These are called “Justbuy” and “Justsell”. If there are two green bars in a row, it goes long. If two red bars in a row, it goes short. Otherwise, the targets and stops manage the trade.

You can run a backtest on it to see the results, and play with the stops and targets to see if it improves (or worsens!). To me, this is a good quick way to test if you have any edge in an idea. If there is one, it will show up right away in a simple test. If it takes fancy tools and algorithms to squeeze out a drop of an edge, but you don’t have direct market connections and 8+ figures of capital to employ it, then you are fooling yourself and asking for pain.

These strategies are free. Download “Fixed Stops and” from “Released Thinkscript Strategies” on my Google site. As always, leave a comment if you have any questions or need help setting them up!

Tags: , , , ,

7 Responses to “Fixed Stop Loss and Profit Target Strategies for Think or Swim”

  1. Fifth_Street Says:

    Great job Pro! I got one question so far. Is there some way to set up by order with your simple entry strategy :

    declare LONG_ENTRY;
    def buy=if close>open and close[1]>open[1] then 1 else 0;

    BUT,whent it trigers, i want to buy at a price at a little bit lower price then the opening 3 bar. The 2-nd bar may close at 25.00 and the 3-rd may open at 25.00, but it also may open lower. But i need only the lower price, then the closure of the 2-nd bar.

    Tnx in advance!

  2. Fifth_Street Says:

    And another question is. Pro, how if i want only to buy to avoid buying in the downtrend.Maybe to ad some trendline or smth.?


  3. Prospectus Says:

    Then change the last line to


    The second argument is the price you want the order filled at. Close returns the close of the bar that triggered the entry, and open[-1] returns the open price of the next bar after that.

  4. Prospectus Says:

    These entry strategies aren’t intended to be a trading system. But if you wanted to detect a trend, you could use any number of things. The easiest to program would be to only buy above a rising moving average, for example.

  5. Jon Says:


    You, Eric aka “Thinkscripter” and are THE top sources for thinkscript.

    Well done!

  6. Prospectus Says:

    Thanks. Thinkscripter is a great guy. I’d never heard of that other site before.

  7. Robert Says:

    Is there any way to have 2 targets when using Strategies? To sell 50% at a close target and the remaining (50%) at another more distant target?

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: