You are on page 1of 21

Automated Triggers

Semi-automated trading in ThinkOrSwim


Trader-Friendly Bundle Offer:

Futures & Stock Volatility Box Subscription

E-mail at contact@tosindicators.com for the offer


What Will We Cover?
• Why Automated Trading?
• What is the Automated Trading Triggers Window?
• 8 Trigger Scenarios That We Will Build
• Scenario 1: Nightly Trending List
• Scenario 2: Iron Condor When in Consolidation
• Scenario 3: Automatic Covered Call for Income at Fib Extensions
• Scenario 4: Buy Put When RSI Shows Bearish Breakout Signals
• Scenario 5: Buy Stock on Pullbackto 34 EMA
• Scenario 6: Sell Position When Squeeze Loses Momentum
• Scenario 7: Layering on Multiple Indicators
• Scenario 8a: Buy on Implied Volatility Pullbacks (Entry)
• Scenario 8b: Sell When Trend Breaks
Download this PDF, with the code snippets:
https://www.tosindicators.com/indicators/automated-trading
Why Automated Trading?
Pros Cons
• Allows you to create a plan, and set that plan • Limited in functionality and the studies it can
into action (eliminate emotions at the time of support for execution of trades
execution)
• Requires extensive testing per each custom
• Manage multiple positions in a slightly easier “method” (always try in paper money first)
manner, at the same time
• Lose the advantage of revised decision making,
• Outsource as much of the “machine work” to with more data (or remove the disadvantage,
the platform based on how you look at it)

So, what can we control?


Triggers Window

Link to last, ask, bid, mid, etc.

Customizing the “Method” to


“Study” allows you to write custom
studies*, reference previously built
ones*, set custom trigger conditions,
and more.

*Limitations to what extent


So, let’s brainstorm some trigger scenarios…
Trigger Scenarios (1-4)
• Scenario 1: Buy MSFT if it crosses above $179.18 in the first 15 minutes

• Scenario 2: Sell HD Iron Condor when price is between $195 and $200

• Scenario 3: Sell a covered call on pre-existing shares when price hits the
2.000 extension to collect “rent” on a profitable position

• Scenario 4: Buy a pre-selected put when RSI is showing breakout signals


Trigger Scenarios (5-8)
• Scenario 5: Buy stock if we get a pullback to the 34 EMA, with the moving
averages all being stacked, triggered with an OCO order

• Scenario 6: Close my position when squeeze momentum starts to decline

• Scenario 7: Buy pre-selected call if we have a squeeze, with greater than avg.
volume, and EMAs agreeing with the direction

• Scenario 8: Buy on Implied Volatility pullbacks in a strong uptrend for the


stock. Simultaneously, place a GTC exit order whenever moving averages are
no longer stacked, on a lower time frame.
TEST EVERYTHING IN PAPER MONEY FIRST.
Scenario 1
• Buy MSFT if it crosses above $179.18 in the first 15 minutes

No code required
Scenario 2
• Sell HD Iron Condor when price is between $195 and $200

plot signal = if close >= 195 and close < 200 then 1 else 0;
Scenario 3
• Sell a covered call on pre-existing shares when price hits the 2.000
extension to collect “rent” on a profitable position

No code needed (options chain instead)


Scenario 4
• Buy a pre-selected put when RSI on the underlying is showing breakout
signals

plot signal = RSI().DownSignal[1];


Scenario 5
• Buy stock if we get a pullback to the 34 EMA, with the moving averages
all being stacked, with an OCO order

def EMA8 = ExpAverage(close, 8);


def EMA21 = ExpAverage(close, 21);
def EMA34 = ExpAverage(close, 34);
def stacked = if EMA8>EMA21 and EMA21>EMA34 then 1 else 0;

plot signal = if stacked and close <= EMA34 then 1 else 0;


Scenario 6
• Close my position when squeeze momentum is declining

plot signal = if TTM_Squeeze().Histogram[1] < TTM_Squeeze().Histogram[2] then 1 else 0;


Scenario 7
• Buy pre-selected call if we have a squeeze, with greater than avg.
volume, and EMAs agreeing with the direction

def EMA8 = ExpAverage(close, 8);


def EMA21 = ExpAverage(close, 21);
def EMA34 = ExpAverage(close, 34);
def bullish = if EMA8 > EMA21 and EMA21 > EMA34 then 1 else 0;
def squeeze = if TTM_Squeeze().SqueezeAlert == 0 then 1 else 0;
def greaterVol = VolumeAvg().Vol > VolumeAvg().VolAvg and close > close[1];

def conditions = bullish and squeeze and greaterVol;


plot signal = conditions[1];
Scenario 8 (Entry)
• Buy on Implied Volatility pullbacks in a strong uptrend for the stock.
def EMA8 = ExpAverage(close, 8);
def EMA21 = ExpAverage(close, 21);
def EMA34 = ExpAverage(close, 34);
def stacked = if EMA8 > EMA21 and EMA21 > EMA34 then 1 else 0;

def ImpVol = IMP_VOLATILITY();


def IV8 = ExpAverage(impVol, 8);
def IV21 = ExpAverage(impVol, 21);
def IV34 = ExpAverage(impVol, 34);
def IVstacked = if IV8 > IV21 and IV21 > IV34 then 1 else 0;
Conditions in present tense
def conditions = if stacked and IVstacked and ImpVol<= EMA34 then 1 else 0; Signal is in charge of
plot signal = conditions[1]; referencing the previous bar
Scenario 8 (Exit)
• Simultaneously, place a GTC exit order whenever moving averages are no
longer stacked, on a lower time frame.

def EMA8 = ExpAverage(close, 8);

def EMA21 = ExpAverage(close, 21);


def EMA34 = ExpAverage(close, 34);
def stacked = if EMA8 > EMA21 and EMA21 > EMA34 then 1 else 0;

Conditions references
def conditions = if stacked[2] and !stacked[1] then 1 else 0; previous bars

plot signal = conditions; Signal is in present tense


What Else Can I Do?
• Test your own setups
• If you face “complex” errors, break apart the indicator components to see if you
can find another way to calculate the same trigger

• Use PaperMoney as a sandbox environment


• Use GTC orders to run experimental trade setup ideas you may be looking at to
test their expectancy and probabilities (“free semi-automated backtesting”)

• Push the capabilities of the platform and test different order types,
multiple TRG brackets with custom studies, etc.
Download this PDF, with the code snippets:
https://www.tosindicators.com/indicators/automated-trading

You might also like