Trade Entry, Limit, and Stop Helper - ATM Indicator For ThinkOrSwim

armybender

Active member
I use this indicator as a way to help me manage my trade entries, stop loss orders, and initial limits. Other platforms like NinjaTrader offer ATM (automated trade management) strategies that automatically place stops and limits, including trailing stops and other techniques, to help you enter and exit trades based on specific conditions.

To replicate that in ThinkOrSwim, I created a "helper" indicator that plots various price levels based on 1x and 2x risk/reward. I trade on range charts (since I believe only price movement matters, not how long it takes to get there), and I have found it to be tremendously helpful to speed up my trade entry and stop / limit setting.

Here is an image of how I setup my chart and Active Trader ladder, along with the code of the indicator itself.

Indicator Image (Range Bars)
iOS0OVg.jpg


Indicator Image (Tick Bars or Time Bars)

lIaLSCv.jpg



Indicator Code
Code:
#Plots various information to help manage trades

#DECLARATIONS
declare hide_on_daily;
declare upper;


#INPUTS
input DisplayNumBars = 15;
input Show2X = Yes;
input ShowRiskLabels = No;
input ShowRiskValues = Yes;
input ShowActualRiskLine = No;
input TicksForEntry = 1;
input ShowRangeEntryDot = Yes;    #Plots a value specific to range charts


#DEFINITIONS
def EntryTicks = TicksForEntry * TickSize();
def IsLastBar = !IsNaN(close) and IsNaN(close[-1]);
def IsOtherPlotBar = !IsNaN(close) and IsNaN(close[-DisplayNumBars]);
def AddTicks =
    if IsLastBar then
        high[1] - low[1] + (2 * TickSize())
    else if IsOtherPlotBar then
        high - low + (2 * TickSize())
    else
        Double.NaN;


#PLOTS
plot RangeEntLong = if IsLastBar and ShowRangeEntryDot then low + GetAggregationPeriod() + EntryTicks else Double.NaN;
plot RangeEntShort = if IsLastBar and ShowRangeEntryDot then high - GetAggregationPeriod() - EntryTicks else Double.NaN;
plot LongEnt = if IsLastBar then high[1] + EntryTicks else if IsOtherPlotBar then high + EntryTicks else Double.NaN;
plot ShortEnt = if IsLastBar then low[1] - EntryTicks else if IsOtherPlotBar then low - EntryTicks else Double.NaN;
plot LongTgT = if IsLastBar then LongEnt[1] + AddTicks else if IsOtherPlotBar then LongEnt + AddTicks else Double.NaN;
plot ShortTgT = if IsLastBar then ShortEnt[1] - AddTicks else if IsOtherPlotBar then ShortEnt - AddTicks else Double.NaN;
plot LongTgT2 = if Show2X then if IsLastBar then LongEnt[1] + (2 * AddTicks) else if IsOtherPlotBar then LongEnt + (2 * AddTicks) else Double.NaN else Double.NaN;
plot ShortTgT2 = if Show2X then if IsLastBar then ShortEnt[1] - (2 * AddTicks) else if IsOtherPlotBar then ShortEnt - (2 * AddTicks) else Double.NaN else Double.NaN;
plot BarRisk = if ShowRiskValues and IsOtherPlotBar then (LongEnt - ShortEnt) / TickSize() else if ShowRiskValues and IsLastBar then ((high - low) + (2 * TicksForEntry)) / TickSize() else Double.NaN;
plot ActualRiskLong = if ShowActualRiskLine then LongTgT - AbsValue(low[-1] - low) else Double.NaN;
plot ActualRiskShort = if ShowActualRiskLine then ShortTgT + AbsValue(high[-1] - high) else Double.NaN;


#FORMATTING
RangeEntLong.SetDefaultColor(Color.CYAN);
RangeEntLong.SetPaintingStrategy(PaintingStrategy.DASHES);
RangeEntLong.HideTitle();
RangeEntLong.HideBubble();

RangeEntShort.SetDefaultColor(Color.CYAN);
RangeEntShort.SetPaintingStrategy(PaintingStrategy.DASHES);
RangeEntShort.HideTitle();
RangeEntShort.HideBubble();

LongEnt.SetDefaultColor(Color.DARK_GREEN);
LongEnt.SetPaintingStrategy(PaintingStrategy.DASHES);
LongEnt.HideTitle();

ShortEnt.SetDefaultColor(Color.RED);
ShortEnt.SetPaintingStrategy(PaintingStrategy.DASHES);
ShortEnt.HideTitle();

LongTgT.SetDefaultColor(Color.YELLOW);
LongTgT.SetPaintingStrategy(PaintingStrategy.DASHES);
LongTgT.HideTitle();

ShortTgT.SetDefaultColor(Color.YELLOW);
ShortTgT.SetPaintingStrategy(PaintingStrategy.DASHES);
ShortTgT.HideTitle();

LongTgT2.SetDefaultColor(Color.MAGENTA);
LongTgT2.SetPaintingStrategy(PaintingStrategy.DASHES);
LongTgT2.HideTitle();

ShortTgT2.SetDefaultColor(Color.MAGENTA);
ShortTgT2.SetPaintingStrategy(PaintingStrategy.DASHES);
ShortTgT2.HideTitle();

BarRisk.SetDefaultColor(Color.MAGENTA);
BarRisk.SetPaintingStrategy(PaintingStrategy.VALUES_BELOW);
BarRisk.HideTitle();

ActualRiskLong.SetDefaultColor(Color.WHITE);
ActualRiskLong.SetPaintingStrategy(PaintingStrategy.DASHES);
ActualRiskLong.HideTitle();

ActualRiskShort.SetDefaultColor(Color.WHITE);
ActualRiskShort.SetPaintingStrategy(PaintingStrategy.DASHES);
ActualRiskShort.HideTitle();
 
Last edited:

Join useThinkScript to post your question to a community of 21,000+ developers and traders.

Can't see your range bar image, does it put dots on active trader also ?

Yes, it puts dots on the Active Trader ladder if you select that option in the Active Trader configuration.

The Show Range Entry Dot parameter will add an extra blue line / dot that indicates X ticks above the current range bar since only range bars close at a pre-determined price. Since you don't know where a Tick / Time bar will close, you can't do that, so the standard lines / dots mark the price of the prior bar.
 
Last edited by a moderator:
I use this indicator as a way to help me manage my trade entries, stop loss orders, and initial limits. Other platforms like NinjaTrader offer ATM (automated trade management) strategies that automatically place stops and limits, including trailing stops and other techniques, to help you enter and exit trades based on specific conditions.

To replicate that in ThinkOrSwim, I created a "helper" indicator that plots various price levels based on 1x and 2x risk/reward. I trade on range charts (since I believe only price movement matters, not how long it takes to get there), and I have found it to be tremendously helpful to speed up my trade entry and stop / limit setting.

Here is an image of how I setup my chart and Active Trader ladder, along with the code of the indicator itself.

Indicator Image (Range Bars)
iOS0OVg.jpg


Indicator Image (Tick Bars or Time Bars)

lIaLSCv.jpg



Indicator Code
Code:
#Plots various information to help manage trades

#DECLARATIONS
declare hide_on_daily;
declare upper;


#INPUTS
input DisplayNumBars = 15;
input Show2X = Yes;
input ShowRiskLabels = No;
input ShowRiskValues = Yes;
input ShowActualRiskLine = No;
input TicksForEntry = 1;
input ShowRangeEntryDot = Yes;    #Plots a value specific to range charts


#DEFINITIONS
def EntryTicks = TicksForEntry * TickSize();
def IsLastBar = !IsNaN(close) and IsNaN(close[-1]);
def IsOtherPlotBar = !IsNaN(close) and IsNaN(close[-DisplayNumBars]);
def AddTicks =
    if IsLastBar then
        high[1] - low[1] + (2 * TickSize())
    else if IsOtherPlotBar then
        high - low + (2 * TickSize())
    else
        Double.NaN;


#PLOTS
plot RangeEntLong = if IsLastBar and ShowRangeEntryDot then low + GetAggregationPeriod() + EntryTicks else Double.NaN;
plot RangeEntShort = if IsLastBar and ShowRangeEntryDot then high - GetAggregationPeriod() - EntryTicks else Double.NaN;
plot LongEnt = if IsLastBar then high[1] + EntryTicks else if IsOtherPlotBar then high + EntryTicks else Double.NaN;
plot ShortEnt = if IsLastBar then low[1] - EntryTicks else if IsOtherPlotBar then low - EntryTicks else Double.NaN;
plot LongTgT = if IsLastBar then LongEnt[1] + AddTicks else if IsOtherPlotBar then LongEnt + AddTicks else Double.NaN;
plot ShortTgT = if IsLastBar then ShortEnt[1] - AddTicks else if IsOtherPlotBar then ShortEnt - AddTicks else Double.NaN;
plot LongTgT2 = if Show2X then if IsLastBar then LongEnt[1] + (2 * AddTicks) else if IsOtherPlotBar then LongEnt + (2 * AddTicks) else Double.NaN else Double.NaN;
plot ShortTgT2 = if Show2X then if IsLastBar then ShortEnt[1] - (2 * AddTicks) else if IsOtherPlotBar then ShortEnt - (2 * AddTicks) else Double.NaN else Double.NaN;
plot BarRisk = if ShowRiskValues and IsOtherPlotBar then (LongEnt - ShortEnt) / TickSize() else if ShowRiskValues and IsLastBar then ((high - low) + (2 * TicksForEntry)) / TickSize() else Double.NaN;
plot ActualRiskLong = if ShowActualRiskLine then LongTgT - AbsValue(low[-1] - low) else Double.NaN;
plot ActualRiskShort = if ShowActualRiskLine then ShortTgT + AbsValue(high[-1] - high) else Double.NaN;


#FORMATTING
RangeEntLong.SetDefaultColor(Color.CYAN);
RangeEntLong.SetPaintingStrategy(PaintingStrategy.DASHES);
RangeEntLong.HideTitle();
RangeEntLong.HideBubble();

RangeEntShort.SetDefaultColor(Color.CYAN);
RangeEntShort.SetPaintingStrategy(PaintingStrategy.DASHES);
RangeEntShort.HideTitle();
RangeEntShort.HideBubble();

LongEnt.SetDefaultColor(Color.DARK_GREEN);
LongEnt.SetPaintingStrategy(PaintingStrategy.DASHES);
LongEnt.HideTitle();

ShortEnt.SetDefaultColor(Color.RED);
ShortEnt.SetPaintingStrategy(PaintingStrategy.DASHES);
ShortEnt.HideTitle();

LongTgT.SetDefaultColor(Color.YELLOW);
LongTgT.SetPaintingStrategy(PaintingStrategy.DASHES);
LongTgT.HideTitle();

ShortTgT.SetDefaultColor(Color.YELLOW);
ShortTgT.SetPaintingStrategy(PaintingStrategy.DASHES);
ShortTgT.HideTitle();

LongTgT2.SetDefaultColor(Color.MAGENTA);
LongTgT2.SetPaintingStrategy(PaintingStrategy.DASHES);
LongTgT2.HideTitle();

ShortTgT2.SetDefaultColor(Color.MAGENTA);
ShortTgT2.SetPaintingStrategy(PaintingStrategy.DASHES);
ShortTgT2.HideTitle();

BarRisk.SetDefaultColor(Color.MAGENTA);
BarRisk.SetPaintingStrategy(PaintingStrategy.VALUES_BELOW);
BarRisk.HideTitle();

ActualRiskLong.SetDefaultColor(Color.WHITE);
ActualRiskLong.SetPaintingStrategy(PaintingStrategy.DASHES);
ActualRiskLong.HideTitle();

ActualRiskShort.SetDefaultColor(Color.WHITE);
ActualRiskShort.SetPaintingStrategy(PaintingStrategy.DASHES);
ActualRiskShort.HideTitle();
Hey @armybender , thanks for your work, thats exactly what i needed i was using fibonacci tools to do this but now its easier...
Do you have any idea of how we can add on that script to only show the dashes when the candle closes bellow or above EMA 5?

Thanks again!
 
Last edited by a moderator:
Hey @armybender , thanks for your work, thats exactly what i needed i was using fibonacci tools to do this but now its easier...
Do you have any idea of how we can add on that script to only show the dashes when the candle closes bellow or above EMA 5?

Thanks again!


Sure. You would need to add something like this to every plot though.

Ruby:
plot RangeEntLong =
    if IsLastBar
    and ShowRangeEntryDot
    and close > ExpAverage(close, 5)        <<< ADD something like this
        
    then low + GetAggregationPeriod() + EntryTicks else Double.NaN;
 
@armybender, would you please explain further how to get the dots to appear in the price column in the Active Trader? I can't get them to show up.


@jhorton56, sure. But first... I find your signature / bio absolutely hilarious! I feel the same. I literally have a degree in portfolio management, as well as two others, and they're absolutely worthless. Nobody manages money like I learned in school. Throw that degree away and trade - that's how to make money.

Ok... it's very simple. Click the gear icon on the very far right of your Active Trader ladder. Not the big gear above near the buttons, but the little one to customize the columns. Then just check the "Show studies from chart" checkbox. The dots should appear.


1687523311089.png
 

Similar threads

Not the exact question you're looking for?

Start a new thread and receive assistance from our community.

87k+ Posts
349 Online
Create Post

Similar threads

Similar threads

The Market Trading Game Changer

Join 2,500+ subscribers inside the useThinkScript VIP Membership Club
  • Exclusive indicators
  • Proven strategies & setups
  • Private Discord community
  • ‘Buy The Dip’ signal alerts
  • Exclusive members-only content
  • Add-ons and resources
  • 1 full year of unlimited support

Frequently Asked Questions

What is useThinkScript?

useThinkScript is the #1 community of stock market investors using indicators and other tools to power their trading strategies. Traders of all skill levels use our forums to learn about scripting and indicators, help each other, and discover new ways to gain an edge in the markets.

How do I get started?

We get it. Our forum can be intimidating, if not overwhelming. With thousands of topics, tens of thousands of posts, our community has created an incredibly deep knowledge base for stock traders. No one can ever exhaust every resource provided on our site.

If you are new, or just looking for guidance, here are some helpful links to get you started.

What are the benefits of VIP Membership?
VIP members get exclusive access to these proven and tested premium indicators: Buy the Dip, Advanced Market Moves 2.0, Take Profit, and Volatility Trading Range. In addition, VIP members get access to over 50 VIP-only custom indicators, add-ons, and strategies, private VIP-only forums, private Discord channel to discuss trades and strategies in real-time, customer support, trade alerts, and much more. Learn all about VIP membership here.
How can I access the premium indicators?
To access the premium indicators, which are plug and play ready, sign up for VIP membership here.
Back
Top