Strategy Based on EMAs, TSI, MACD, and Premarket Highs/Lows For ThinkOrSwim

Correct. The 5EMA is your entry
I fixed the code to put the entry point at the highest price and lowest price of the candle divided by 2 (so the middle of the candle) and am now tweaking settings. So far I have gotten an 88% win rate with a 3.1k profit on 30 day 10 minute chart but with entry at the actual candle instead of EMA.

With your default settings and price entry at the actual candle stick as it should be for backtesting purposes its a 51% winrate and 1.1k profit.

Once I am done we can DM each other? I'll send you the setting so you can test as well. If you have Discord add me amped#0001
 
Last edited:
The only issue with that is if you are way extended from the EMA you wouldn’t buy there or in the midbody. Maybe I need to code in something that say if BuyCall = 1 within x number of bars and price touches 5EMA then place an order. The only issue is it could be the current bar, the previous bar, 3 bars ago or even a sell signal before it touches the 5EMA.

Definitely tricky.

Edit. I have messed with this thing so much I don’t even know what to do lol. I could say if buycall or holdcall and price at 5EMA but I would have to define the holdcall to only trigger after a buycall which I don’t think I did, can’t remember.

I’m just going to have to sit down and dive into it one day this weekend.

Either way the signals are good. Don’t want to mess them up trying to get the backtest to work 🤷🏻‍♂️
Definitely understandable.
Just as you have code for EMA separation, I wonder if you could have code for price separation from ema. So if it's over-extended that clearly isn't a good time to be in, since it'll pull back. But once the price gets within a certain range of the ema due to a pullback, it gives a prep/buy signal depending on the other indicators as well.
 
The only reason for the numbers is for ease of sorting and keeping the signals I want up top. Changing the names will not affect anything except sorting.

Not exactly sure what you mean by "charting". The backtest is based on 100 shares so doesn't exactly compute to options success but it shouldn't be very far off as far as percentage of successful trades.

Options work well if you get in on a chart like Post #69 (TWTR). If you got in on the 5EMA at 11:10ish and got out at the sell candle at 13:50ish, that is a 2% gain in the stock price. Going back and looking at the TWTR 47 Calls that correspond to that particular chart, the calls went from $1.20 at 11:10 to $1.82 at 13:50. That is a profit of $62 per contract or a 50ish percent gain.

I ALWAYS look at volume, spread, and Delta. I want a minimum of 500 volume for each contract but like to see 1,000-2,000+. I want the spread to be a few cents or less. I prefer 50 Delta calls as my experience shows that those move well when the stock is trending and don't die suddenly like a 5 or 10 Delta can on expiration day options.

Hope that makes sense. If it doesn't I would definitely go do some more research on options before you lose $50k like me!
Just to share some of my experience trading option. If using shorter expiration dates, strong suggest to trade way ITM option as this will allow your breakeven price very close to stock mark price upon expiration. In addition for better volume, you can set one of the scan condition to be in "weekly". Therefore, the result of the stock will be able to trade weekly option expiration. Hope this helps......Trade safe....
 
Used new values by @Amped216
#EMAS
input Ema1Length = 8;
input Ema2Length = 20;
input Ema3Length = 38;
input Ema4Length = 55;
and previous version of
#NEW BUY ORDERS
AddOrder(OrderType.BUY_TO_OPEN, ShowOrders and CallBuy and !CallHold, FastEMA1, 100, Color.GREEN, Color.LIGHT_GREEN); #and EMAPctBullFast and open <= FastEMA1
AddOrder(OrderType.SELL_TO_OPEN, ShowOrders and PutBuy and !PutHold, FastEMA1, 100, Color.GREEN, Color.LIGHT_GREEN); #and EMAPctBearFast and open >= FastEMA1

Got the following results; in line with @Amped216
Max trade P/L: $1,258.42
Total P/L: $22,673.48
Total order(s): 148

Then new Order Code used by @a1cturner
# BUY to OPEN ORDERS 4-13-2022
#AddOrder(OrderType.BUY_TO_OPEN, ShowOrders and (CallBuy or CallBuy[1] or CallBuy[2] or CallBuy[3]) and low <= FastEMA1 and low >= FastEMA2, FastEMA1, 100, Color.GREEN, Color.LIGHT_GREEN);
#AddOrder(OrderType.SELL_TO_OPEN, ShowOrders and (PutBuy or PutBuy[1] or PutBuy[2] or PutBuy[3]) and high >= FastEMA1 and high <=FastEMA2, FastEMA1, 100, Color.GREEN, Color.LIGHT_GREEN);
Max trade P/L: $1,133.33
Total P/L: $9,456.01
Total order(s): 158

which one is correct?
 
Just to share some of my experience trading option. If using shorter expiration dates, strong suggest to trade way ITM option as this will allow your breakeven price very close to stock mark price upon expiration. In addition for better volume, you can set one of the scan condition to be in "weekly". Therefore, the result of the stock will be able to trade weekly option expiration. Hope this helps......Trade safe....

I thought about this too. If I increased my account to $100k + I was going to switch from options to stock. Buying an option with closer to 1.0 Delta would basically be the same thing as trading stock but they are way more expensive for a small account and if the stock starts running you won’t see as high of a percentage increase. I personally like .5 Delta or higher as it gives me good movement but less risk of a further OTM option. If you want less risk go higher Delta. If you want more movement, up or down, go lower Delta.

This response is for anyone new to Options @Intrinsic Knowledge not towards you
 
Used new values by @Amped216
#EMAS
input Ema1Length = 8;
input Ema2Length = 20;
input Ema3Length = 38;
input Ema4Length = 55;
and previous version of
#NEW BUY ORDERS
AddOrder(OrderType.BUY_TO_OPEN, ShowOrders and CallBuy and !CallHold, FastEMA1, 100, Color.GREEN, Color.LIGHT_GREEN); #and EMAPctBullFast and open <= FastEMA1
AddOrder(OrderType.SELL_TO_OPEN, ShowOrders and PutBuy and !PutHold, FastEMA1, 100, Color.GREEN, Color.LIGHT_GREEN); #and EMAPctBearFast and open >= FastEMA1

Got the following results; in line with @Amped216
Max trade P/L: $1,258.42
Total P/L: $22,673.48
Total order(s): 148

Then new Order Code used by @a1cturner
# BUY to OPEN ORDERS 4-13-2022
#AddOrder(OrderType.BUY_TO_OPEN, ShowOrders and (CallBuy or CallBuy[1] or CallBuy[2] or CallBuy[3]) and low <= FastEMA1 and low >= FastEMA2, FastEMA1, 100, Color.GREEN, Color.LIGHT_GREEN);
#AddOrder(OrderType.SELL_TO_OPEN, ShowOrders and (PutBuy or PutBuy[1] or PutBuy[2] or PutBuy[3]) and high >= FastEMA1 and high <=FastEMA2, FastEMA1, 100, Color.GREEN, Color.LIGHT_GREEN);
Max trade P/L: $1,133.33
Total P/L: $9,456.01
Total order(s): 158

which one is correct?

Well you changed the EMAs and the order so not real accurate. My order changed the entry to when the price is actually at the EMA vs @Amped216 code which enters on the EMA regardless of if the price was even there. I think he is the one that originally pointed this out.

My EMA values come from @Ripster and I have traded them for a while now so I believe in them. This doesn’t mean that there aren’t better settings but this is what has worked for me.

The order template I posted yesterday will have more accurate back test results. The EMA change will affect actual trading signals.
 
I’ll try to have the code updated with the edited EMA percent separation threshold (0.25), new order template (once finished and tested), possibly EMA length changes if someone convinces me that other settings are better, and anything else anyone points out between now and tomorrow afternoon/evening.

I may also create some labels to what the colors mean with an option to turn them on/off

If someone smart has suggestions on the exit criteria that would be great too. I have been seeing a lot of break even trades this week…

Post any suggestions or findings so I know what y’all want me to look at tomorrow.
 
Possibly fixed it with this. Don't have time to dive into it too deep tonight but I did notice TSLA, on April 6th at 9:40 CST, went short on a sell signal but if I add a !SellPut then it screws up the sell signal. (Technically that is what the strategy shows but I would have gone short on the candle before. The order just shows it on the next candle.)

This is definitely a step in the right direction though.

Code:
AddOrder(OrderType.BUY_TO_OPEN, ShowOrders and (CallBuy or CallBuy[1] or CallBuy[2] or CallBuy[3]) and low <= FastEMA1 and low >= FastEMA2, FastEMA1, 100, Color.GREEN, Color.LIGHT_GREEN);
AddOrder(OrderType.SELL_TO_OPEN, ShowOrders and (PutBuy or PutBuy[1] or PutBuy[2] or PutBuy[3]) and high >= FastEMA1 and high <=FastEMA2, FastEMA1, 100, Color.GREEN, Color.LIGHT_GREEN);
hi where to apply this code to the watchlist or the strategy , thanks for your hard work.
 
TLDR: Backtested 7 stocks with the new order criteria which should be more accurate after the code changes in Version 5 or 6 (can't remember). I tested TSLA, GME, AAPL, NVDA, FB, SNAP, and OXY. Only went back 90 days because for some reason the candle colors disappeared on GME with orders on and timeframe set to 10 Min / 180 days (no idea why). Tested with the new ema sep thr hld at 0.25. Tested 5/12/34/50 EMA lengths, 5/13/34/50 EMA lengths, and 8/20/38/55 EMA lengths as suggested by another user. I also kept the price as Last so I could go back 90 days vs Mark.

Results showed a small difference between 5/12/34/50 vs 5/13/34/50. Some won on one setting others on the other. Out of all 7, the winner was 5/12/34/50 so I will keep settings on EMA lengths the same.

3ntuPXd.png
This is a good idea to use these well tested defaults. As folks can easily change if they prefer.
 
@a1cturner I know there are certain aspects of several indicators that will not show up on mobile. It seems the PM h&l show up incorrect. Is there any way to fix that?
 
Version 7 is updated and posted in Post #1.

Change "ema sep thr hld" from 0.3 to 0.25
Kept EMA Lengths at 5 / 12 / 34 / 50
Added Color Coded Labels to identify candle colors
Updated backtesting orders for better accuracy
Added bubbles for actual entries, exits and take profit areas
Added two additional backtesting orders to be able to consider the take profit (over extended) zone when backtesting
Added alerts for Buy, Sell, and Take Profit. Removed the alert for BuyCall Candle and BuyPut Candle
Added the ability to turn off alerts
Edited the P/L labels to consider the take profit (over extended) zone
Your passion and motivation to improve what you created is bar none! Thank you for all your efforts!

Just a mild suggestion, but when you update to your latest version, how about dating it as well? Just a thought.
Thank you for all you do!!!!
 
( PUT ) : SQ / NFLX / SANP
( CALL ) : OXY
it was a great trading using this strategy .
thank u so much ..
 
Last edited:
What ticker. I’m sure it didn’t meet criteria today. That’s why they were grey. The take profit bubble is there so people who got in early before the signal starts for the day or otherwise know when to get out. It’s either all bubble or no bubbles.
Awesome work again on this! I was flipping between a few stocks, including NVDA and NFLX. Although I did not trade either, I saw the opportunities and potential! Nice work again!!!

I usually trade futures, but this is definitely a great setup!!

Quick observation and was wondering if you considered renaming "BUY" signals as either LE (Long Entry or just Long) and SE (Short Entry or just Short)?

Your efforts have been amazing and thank you again!!
 
Awesome work again on this! I was flipping between a few stocks, including NVDA and NFLX. Although I did not trade either, I saw the opportunities and potential! Nice work again!!!

I usually trade futures, but this is definitely a great setup!!

Quick observation and was wondering if you considered renaming "BUY" signals as either LE (Long Entry or just Long) and SE (Short Entry or just Short)?

Your efforts have been amazing and thank you again!!

Yeah I can probably make that change on the next update. Let’s see if there are any more problems before I push out the next one though.
 
  • Like
Reactions: rfb
What ticker. I’m sure it didn’t meet criteria today. That’s why they were grey. The take profit bubble is there so people who got in early before the signal starts for the day or otherwise know when to get out. It’s either all bubble or no bubbles.
it was SPY I was watching , the take profit bubble were on every candle, although I like the bubble but so many signals stacked on each other I couldn't see the colored candle, if I can take remove take profit would be much more clear to watch, thanks again for your amazing work
 

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

Similar threads

Not the exact question you're looking for?

Start a new thread and receive assistance from our community.

87k+ Posts
300 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