ASAP (As Simple As Possible) Strategy for ThinkorSwim

dap711

Active member
Hi Traders!

This is a spin off of the Moving Average Master strategy and a place to discuss results of the new strategy.

ASAP (SMI) lower study shared link: https://tos.mx/nuGeZqV
ASAP strategy shared link: https://tos.mx/caRLjIg

ASAP (SMI) lower study:
Ruby:
#Inspired by the IronRod SMI Histogram
#Modified and cleaned up - dap711 -2023

declare lower;

input Length = 20;
def Limit = 20;
def range= 70;

def overbought = Limit;
def oversold = -Limit;

# Stochastic Momentum Index (SMI)
def min_low = Lowest(low, Length+1);
def max_high = Highest(high, Length+1);
def rel_diff = close - (max_high + min_low) / 2;
def diff = max_high - min_low;
def avgrel = ExpAverage(ExpAverage(rel_diff, Length), Length);
def avgdiff = ExpAverage(ExpAverage(diff, Length), Length);
def SMI1 = if avgdiff != 0 then avgrel / (avgdiff / 2) * 100 else 0;

plot SMI = reference EhlersSuperSmootherFilter(price = SMI1, "cutoff length" = Length) ;
SMI.DefineColor("Up", CreateColor(0, 153, 51));
SMI.definecolor("Weak", Color.LIGHT_GRAY);
SMI.DefineColor("Down", Color.RED);
SMI.AssignValueColor(if SMI > SMI[1] then SMI.Color("Up") else if SMI < SMI[1] then SMI.Color("Down") else SMI.Color("Weak"));
SMI.SetLineWeight(1);
SMI.SetPaintingStrategy(PaintingStrategy.HISTOGRAM);
SMI.SetLineWeight(1);

plot rangeband = if IsNaN(close) then Double.NaN else 0;
rangeband.HideBubble();
rangeband.SetLineWeight(2);
rangeband.AssignValueColor(Color.Gray);
def rangelimits = Limit;

plot upper= Limit;
plot lower= -Limit;

# Labels
AddLabel(SMI < -Limit or SMI > Limit, "Market is trending", CreateColor(0,150,200));
AddLabel(SMI > -Limit and SMI < Limit, "Market is Consolidating", Color.ORANGE);



ASAP Strategy Code:
Ruby:
# ASAP (as simple as possible) Author dap711 - 2023

# Q. Why do I share my strategies?
# A. It would be completely and totally silly of me (and you!) to keep them to myself. Who remembers what happen with GameStop? The more people doing the exact same thing at the same time in the market, the more power they have in moving the market in their favor! If we had an army of traders using the same system, oh what power we would have! We (the retail trader) could take the power back from the market makers!

# 1. Adjust the length settings for the best FloatingPL and then let'r rip!

input BackTestTradeSize = 1;
input ShowBackTestPositions = yes;
input Length = 18;
input AlertOnSignal = no;

#Add your indicator code here (if you want to use this as a template) :)  
def min_low = Lowest(low, Length+1);
def max_high = Highest(high, Length+1);
def rel_diff = close - (max_high + min_low) / 2;
def range = max_high - min_low;
def avgrel = ExpAverage(ExpAverage(rel_diff, Length), Length );
def avgdiff = ExpAverage(ExpAverage(range, Length), Length);
def SMI1 = if avgdiff != 0 then avgrel / (avgdiff / 2)*10  else 0;
def SMI = reference EhlersSuperSmootherFilter(price = SMI1, "cutoff length" = Length) ;

#Define the signals
def BuyToOpenSignal  = SMI >= SMI[1];
def SellToOpenSignal = SMI < SMI[1];

#Open the orders on the chart for back testing and optimizing the setting
AddOrder(OrderType.BUY_AUTO, BuyToOpenSignal and ShowBackTestPositions, open[-1], BackTestTradeSize, Color.CYAN, Color.CYAN, "");
AddOrder(OrderType.SELL_AUTO, SellToOpenSignal and ShowBackTestPositions, open[-1], BackTestTradeSize, Color.RED, Color.RED,"");

#Add the signal labels to the chart
AddLabel(yes, "     BUY      ", if BuyToOpenSignal[1] crosses above BuyToOpenSignal[2] then CreateColor(153, 255, 153) else Color.White);
AddLabel(yes, "     SELL     ", if SellToOpenSignal[1]  crosses above SellToOpenSignal[2] then CreateColor(255, 102, 102) else Color.White);


#Sound the bell. (If alerts are turn on)
Alert(BuyToOpenSignal[1] crosses above BuyToOpenSignal[2] and AlertOnSignal, "Buy Open Signal", Alert.Bar, Sound.Ding);
Alert(SellToOpenSignal[1]  crosses above SellToOpenSignal[2] and AlertOnSignal, "Sell Open Signal", Alert.Bar, Sound.Ding);

#“Make everything as simple as possible, but not simpler.” Albert Einstein.
 
Last edited:
Thanks for the new thread dedicated to this strat. A couple questions for you:
1) Where did the third smoothing (EhlersSuperSmootherFilter) for the fast and slow SMI come from? I haven't seen an additional smoothing mentioned in any of the information I've found online about the SMI, and you didn't use it in the previous version (from the Moving Average Master thread).
2) In the Ehlers smoothing for the slow SMI (line 32), you use the FastLength for the "cutoff length" parameter. Was that intentional (since you used the same value for the fast SMI Ehlers smoothing), or a typo?

Would probably be helpful for the lower study to use the same code that the strategy uses to determine buy/sell signals.

Finally, any tips on how to optimize this one? Two parameters really increases the option space to try to find a good combination, especially since there's not a good smooth transition of returns from one value to the next (at least not in the original version with only a single parameter).
 
Thanks again for sharing your work!
It would be beneficial if you could provide a screenshot and some user instructions.

It's all the same as the Moving Average Master, except we are using Stochastic Momentum instead of Moving Average.
 
Last edited:
Thanks for the new thread dedicated to this strat. A couple questions for you:
1) Where did the third smoothing (EhlersSuperSmootherFilter) for the fast and slow SMI come from? I haven't seen an additional smoothing mentioned in any of the information I've found online about the SMI, and you didn't use it in the previous version (from the Moving Average Master thread).
2) In the Ehlers smoothing for the slow SMI (line 32), you use the FastLength for the "cutoff length" parameter. Was that intentional (since you used the same value for the fast SMI Ehlers smoothing), or a typo?

Would probably be helpful for the lower study to use the same code that the strategy uses to determine buy/sell signals.

Finally, any tips on how to optimize this one? Two parameters really increases the option space to try to find a good combination, especially since there's not a good smooth transition of returns from one value to the next (at least not in the original version with only a single parameter).

1. I'm using EhlersSuperSmootherFilter to get a smoother signal and it helps get rid of some false signals. You are correct, it's not part of the standard SMI study, but I am everything but standard in my approaches. :) Comment out the EhlersSuperSmootherFilter line and rename SMI1F to SMIF and the same for the slow and you will see the difference it makes.

2. The fast SMI is used to open and close the trades. The slow SMI sets the trend direction. Fast SMI isn't allowed to trade against the trend. I found this approch REALLY helps us stay out of losing trades. Cutoff length needs to be the same for both SMI's and I decided that fast SMI was better used than a much higher number of the slow SMI. It was not a typo.

3. I'm working on Marco Recorder script to do the optimizing for us .. stay tuned! Like you, this is new to me, but I think we should set the fast to something like 3-5 and then adjust the slow for max profit. Then adjust the fast for the same, and then fine tune around the final numbers. I'm thinking the slow number should be more than twice of the fast.
 
Last edited:
Would probably be helpful for the lower study to use the same code that the strategy uses to determine buy/sell signals.

Sorry, forgot to answer this one .. All you need on the lower study is the fast SMI length, as the slow SMI is only used to find the trend. If needed, I could add a label showing the trend direction ..
 
Okay, adding a fast and slow moving SMI was a BAD idea, but adding the second level of smoothing was a great idea! I've updated post one to the latest.
 
On the 1D-5M .. 22, 50 would have paid $2,587.50 trading one option. :) Or, I could have traded the same but with 19, 50 and made $2,400 with NO DRAWDOWN! :) and I'm sure these are NOT the best settings ..

Edit: Using 1D - 5M with the updated code (one length to adjust) using a length of 18, I would have made $4,212.50 with no drawdown for the day. :)
 
Last edited:
In my ASAP (SMI) lower study I like to put a plot line set at 0.
plot line_0 = 0; I use it as a confirmation for trend. Crossing above it Buy, crossing below Sell.

http://tos.mx/OGziurm
Hey Mailbag! I like your setup and I'm just starting to play with the settings. Today (Mon Jan 23) I'm using a 1D 5min chart, upper ASAP length at 18, lower SMI at 4. So far looks pretty good but has not offered a lot of trades (could be because mkt just trending up). Checking in to see what your settings are and how your trading going.


Right! I do like that 0 line. Under "inputs and options", the Inputs: "length" I have a 4. That seems to run consistent with market direction but that's where I'm curious as to what you are using.
 
Last edited by a moderator:
Hey Mailbag! I like your setup and I'm just starting to play with the settings. Today (Mon Jan 23) I'm using a 1D 5min chart, upper ASAP length at 18, lower SMI at 4. So far looks pretty good but has not offered a lot of trades (could be because mkt just trending up). Checking in to see what your settings are and how your trading going.


Right! I do like that 0 line. Under "inputs and options", the Inputs: "length" I have a 4. That seems to run consistent with market direction but that's where I'm curious as to what you are using.
Yes I agree that there is not many trades. as of right now 1:51PM and for the past hour /ES and /MES have been mostly trending. I have length set at 35 which would ahve given me about $1000 profit. When I switched to 18 it gave me loosing numbers
 
Stats for the entire day today. I did NOT take any of these trades as I'm new to this and watching for now. Pretty (REALLY) good results.
/MES chart at 1D - 1M
Backtest at 1, Length 7
SMI Lower, length 4
Floating P/L = $475
25 Trades
TD Amer Futures Commissions @$5.75
Net Profit: $331.25
0930 - 1600 EST

@Dap, did you figure out how to auto-trade this through TOS?
 

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

Not the exact question you're looking for?

Start a new thread and receive assistance from our community.

87k+ Posts
249 Online
Create Post

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