Macro Recorder Questions For ThinkOrSwim

eugnis

New member
@slowmohockey @mailbagman2000 - thanks for putting these layouts together. One thing Ive noticed that is that the below strategy v1 (we'll call) only deploys the use of one label area and seems to have an endless going loop of short and long positions. With either a short or a long happening at all times throughout the day. Have any of you had luck setting up the Macro Reader script to close and open positions at the same time.

v1 - https://prnt.sc/79F8B-GFNkgD

The new version which combines ASAP and Moving Avg Master seems to use 3 different label areas and has gaps between open and close positions and gives out a 0 when it is flat on either side. Also curious if anyone has had luck building out a Macro Recorder script for this newer version.

v2 - https://prnt.sc/X-KGzWGiO0aO


@dap711 - thank you for putting this all together. If you get a min, let us know if you are using 2 different Macro Recorder scripts for the 2 noted cases above. Thanks a ton in advance.

Pretty amazing results today on SPY with ASAP strategy.

https://prnt.sc/UHOZJsj6BnDf
Length was 7
 
@slowmohockey @mailbagman2000 - thanks for putting these layouts together. One thing Ive noticed that is that the below strategy v1 (we'll call) only deploys the use of one label area and seems to have an endless going loop of short and long positions. With either a short or a long happening at all times throughout the day. Have any of you had luck setting up the Macro Reader script to close and open positions at the same time.

v1 - https://prnt.sc/79F8B-GFNkgD

The new version which combines ASAP and Moving Avg Master seems to use 3 different label areas and has gaps between open and close positions and gives out a 0 when it is flat on either side. Also curious if anyone has had luck building out a Macro Recorder script for this newer version.

v2 - https://prnt.sc/X-KGzWGiO0aO


@dap711 - thank you for putting this all together. If you get a min, let us know if you are using 2 different Macro Recorder scripts for the 2 noted cases above. Thanks a ton in advance.

Pretty amazing results today on SPY with ASAP strategy.

https://prnt.sc/UHOZJsj6BnDf
Length was 7
Eugnis, yea, it's a constant open one trade close another. Would be nice to create a setting whereby it automatically takes profits at a certain point (IE /MES at $50 because sometimes it will reach that profit level but then close the trade at like $35 or $40) but that might be asking a lot to code? @Dap would be the man for that!

Dap did do a video on setting up Macro Recorder here: https://drive.google.com/file/d/1uq1IMBaUw96mFSAgL02d1LQcJT_3V8W_/view
 
@slowmohockey - doing the same now, trying to figure out this MicroRecorder thing. I am fairly new hot keys, and this is likely needed to cover short and open long simultaneously and visa versa (ideally all in one key stroke). Need to dig into this further, but getting SPY or QQQ dialed in with no transactions fees would be killer.
 
@slowmohockey - Ctrl F will flatten position first then you will reopen (long or short) based on color. Hence why there is only 2 label color in that ASAP study that you shared. Reviewed the MicroRecorder script in a bit more detail.
 
@dap711 Thanks for all the information. I have a question about the Macro Recorder. I believe I have everything set correctly, however, my MR only runs one time and doesn't continue to loop. Do you know what may cause this?
Here is my Macro Settings:

g7hY2hg.jpg


EDIT: All of my labels were set to "END". I set them to "Next" and it appears to be working fine.
 
Last edited:
@dap711 , I do have an issue. I cannot seem to figure it out. I get the recorder to work and it is scanning the labels. The issue is, MR isn't activating the hotkeys. I have them set the same as yours and i have it turned on in TOS. I can manually press ALT B and it will buy and ALT S and it will sell. MR will stop and go through the countdown once a label lights up but it does not activate the hotkey. Do you know what may be causing this?
 
That is a good question. I am using the latest ASAP/MA combo. But now that you mention it, I may not even need a close option. Maybe just buy and Sell. What are you thoughts?
I am having the same issue with the hot keys. I think it's some sort of access thing with the Automation Setting. Can't seem to be able to add ToS to MR in the automation setting. (trying to work it on the Mac) I tried to automate tasks via MR on Chrome and it asked for extra permission for that specific app. Once granted hot keys worked. Can't see to make that happen for ToS.

Here is my MR loop - https://prnt.sc/-kmBrgljsfGa
 
I am having the same issue with the hot keys. I think it's some sort of access thing with the Automation Setting. Can't seem to be able to add ToS to MR in the automation setting. (trying to work it on the Mac) I tried to automate tasks via MR on Chrome and it asked for extra permission for that specific app. Once granted hot keys worked. Can't see to make that happen for ToS.

Here is my MR loop - https://prnt.sc/-kmBrgljsfGa
Hopefully Dap has experience with this. I have been searching for a while now and cannot find any information on how to enable remote hotkey funtions.
 
Hopefully Dap has experience with this. I have been searching for a while now and cannot find any information on how to enable remote hotkey funtions.
I solved the problem: first activated Hotkeys at the platform; them modified MacroRecorder's properties allowing full control, modify, read&execute, read, write, spesial permissions, and finally started the program as Administrator.
 
@slowmohockey @mailbagman2000 - thanks for putting these layouts together. One thing Ive noticed that is that the below strategy v1 (we'll call) only deploys the use of one label area and seems to have an endless going loop of short and long positions. With either a short or a long happening at all times throughout the day. Have any of you had luck setting up the Macro Reader script to close and open positions at the same time.

v1 - https://prnt.sc/79F8B-GFNkgD

The new version which combines ASAP and Moving Avg Master seems to use 3 different label areas and has gaps between open and close positions and gives out a 0 when it is flat on either side. Also curious if anyone has had luck building out a Macro Recorder script for this newer version.

v2 - https://prnt.sc/X-KGzWGiO0aO


@dap711 - thank you for putting this all together. If you get a min, let us know if you are using 2 different Macro Recorder scripts for the 2 noted cases above. Thanks a ton in advance.

Pretty amazing results today on SPY with ASAP strategy.

https://prnt.sc/UHOZJsj6BnDf
Length was 7

@eugnis .. So here is the important auto trade parts of the strategy code:
Ruby:
AddOrder(OrderType.[B]BUY_TO_OPEN[/B], BuyToOpenSignal and ShowStategyPositions,   open[-1], tradesize, Color.CYAN, Color.CYAN, "");
AddOrder(OrderType.[B]SELL_TO_CLOSE[/B], SellToCloseSignal and ShowStategyPositions, open[-1], tradesize, Color.CYAN, Color.CYAN, "");
AddOrder(OrderType.[B]SELL_TO_OPEN[/B], SellToOpenSignal and ShowStategyPositions,  open[-1], tradesize, Color.RED, Color.RED,"");
AddOrder(OrderType.[B]BUY_TO_CLOSE[/B], BuyToCloseSignal and ShowStategyPositions,  open[-1], tradesize, Color.RED, Color.RED,"");

def OpenOrders = GetQuantity();
AddLabel(yes, "     BUY      ", if BuyToOpenSignal[1]  and OpenOrders < 1  then CreateColor(153, 255, 153) else Color.White);
AddLabel(yes, "     SELL     ", if SellToOpenSignal[1]  and OpenOrders > -1  then CreateColor(255, 102, 102) else Color.White);
AddLabel(yes, "     CLOSE     ", if  (SellToCloseSignal[1] and OpenOrders > 0) or (BuyToCloseSignal[1] and OpenOrders < 0) then  Color.Yellow else Color.White);

You can use two types of OrderType in the AddOrder function. OrderType .. TO_OPEN and TO_CLOSE or BUY_AUTO and SELL_AUTO. The _AUTO type will only have 2 labels (Buy and Sell) and the TO_OPEN and TO_CLOSE types will have 3 labels (Buy, Sell, and Close). I decided that the labels should always be visible on the chart to cover up any chart color that could cause a mis-fire and make it easier to setup MR. They are now "Static" where they use to be "Dynamic". Hope this explains the change I made.

You will need to create a script for the two different types of OrderType (Open/Close or Auto).

What to do when you are trading paper and you are getting multiple orders on the same candle:

1. In the code that adds the label .. AddLabel(yes, " BUY ", if BuyToOpenSignal[1] and OpenOrders < 1 ... change to
AddLabel(yes, " BUY ", if BuyToOpenSignal[1] crosses above BuyToOpenSignal[2] and OpenOrders < 1 ...​

2. Do the same change for the "Sell" and "Close" label:
AddLabel(yes, " SELL ", if SellToOpenSignal[1] crosses above SellToOpenSignal[2] and OpenOrders > -1 ...​
AddLabel(yes, " CLOSE ", if (SellToCloseSignal[1] crosses above SellToCloseSignal[2] and OpenOrders > 0) or (BuyToCloseSignal[1] crosses above BuyToCloseSignal[2] and OpenOrders < 0) ...

3. Make sure MR waits the same amount of time as your chart settings .. One Minute chart? Wait 60000ms in the MR script after making the keystrokes for each label type (Buy, Sell, and Close).​
My code will always be written for real trading, but this is how you can modify it to work with paper trading.​
 
Got it to work last night with some further digging online. Using a Mac, so my set up is a bit different. I am now running into the issue of the MR system stopping the minute I try to do something else on my computer. If I don't touch the mouse or keyboard its working well. Let if me if you go to work, and if th
@eugnis .. So here is the important auto trade parts of the strategy code:
Ruby:
AddOrder(OrderType.[B]BUY_TO_OPEN[/B], BuyToOpenSignal and ShowStategyPositions,   open[-1], tradesize, Color.CYAN, Color.CYAN, "");
AddOrder(OrderType.[B]SELL_TO_CLOSE[/B], SellToCloseSignal and ShowStategyPositions, open[-1], tradesize, Color.CYAN, Color.CYAN, "");
AddOrder(OrderType.[B]SELL_TO_OPEN[/B], SellToOpenSignal and ShowStategyPositions,  open[-1], tradesize, Color.RED, Color.RED,"");
AddOrder(OrderType.[B]BUY_TO_CLOSE[/B], BuyToCloseSignal and ShowStategyPositions,  open[-1], tradesize, Color.RED, Color.RED,"");

def OpenOrders = GetQuantity();
AddLabel(yes, "     BUY      ", if BuyToOpenSignal[1]  and OpenOrders < 1  then CreateColor(153, 255, 153) else Color.White);
AddLabel(yes, "     SELL     ", if SellToOpenSignal[1]  and OpenOrders > -1  then CreateColor(255, 102, 102) else Color.White);
AddLabel(yes, "     CLOSE     ", if  (SellToCloseSignal[1] and OpenOrders > 0) or (BuyToCloseSignal[1] and OpenOrders < 0) then  Color.Yellow else Color.White);

You can use two types of OrderType in the AddOrder function. OrderType .. TO_OPEN and TO_CLOSE or BUY_AUTO and SELL_AUTO. The _AUTO type will only have 2 labels (Buy and Sell) and the TO_OPEN and TO_CLOSE types will have 3 labels (Buy, Sell, and Close). I decided that the labels should always be visible on the chart to cover up any chart color that could cause a mis-fire and make it easier to setup MR. They are now "Static" where they use to be "Dynamic". Hope this explains the change I made.

You will need to create a script for the two different types of OrderType (Open/Close or Auto).

What to do when you are trading paper and you are getting multiple orders on the same candle:

1. In the code that adds the label .. AddLabel(yes, " BUY ", if BuyToOpenSignal[1] and OpenOrders < 1 ... change to​
AddLabel(yes, " BUY ", if BuyToOpenSignal[1] crosses above BuyToOpenSignal[2] and OpenOrders < 1 ...​

2. Do the same change for the "Sell" and "Close" label:​
AddLabel(yes, " SELL ", if SellToOpenSignal[1] crosses above SellToOpenSignal[2] and OpenOrders > -1 ...​
AddLabel(yes, " CLOSE ", if (SellToCloseSignal[1] crosses above SellToCloseSignal[2] and OpenOrders > 0) or (BuyToCloseSignal[1] crosses above BuyToCloseSignal[2] and OpenOrders < 0) ...​
3. Make sure MR waits the same amount of time as your chart settings .. One Minute chart? Wait 60000ms in the MR script after making the keystrokes for each label type (Buy, Sell, and Close).​
My code will always be written for real trading, but this is how you can modify it to work with paper trading.​
Thank you @dap711 for the clarity. With some brut force last night I figured out the chart matching / wait time point you mention. Also, my MR script only seems to work when I separate the the Flatten Now order as a separate key stroke. (no idea why) I am using the ASAP (original version) as the stand alone strategy with full automation. This is the one that has an ongoing long or short at all time. (looks good on SPY today overall on the 2min chart / length 6) I noticed some of your other work ASAP / MO Master combined has 3 call to action and positions that don't fully continue throughout the day. (aiming to test all and share results)

I've noticed that my MR script stops running the minute I touch/click the mouse or do something else on my computer. (aka play with excel) I think in you video you mentioned you don't have an issue with this. Let me know if there is some sort of PlayBack setting that I need to check or uncheck to get the same result.

Thank you kindly for the work here and putting us on to the MR auto trade solution. (killer stuff)
 
@dap711 Have you used the ASAP strategy in real time? If so, How has it done for you? I also have a question about the FloatingP/L. I have noticed on many occasions that it will show a negative, but the entries and exits are quite good. and when I change to get to the highest Profit value, The entries and exits do not look anywhere near as good as when it showed a loss. Do you have any insight on this? Am I missing something?
I am also getting Black Labels instead of white. I an testing with OnDemand. Not sure if that has anything to do with it.
 
Last edited:
@dap711 @METAL and @eugnis Regarding the P/L, yea I have noticed that on range days (ES goes back and forth from low to high) the ASAP strategy has not been profitable for me. But on Trend days, it works well. @Dap why/what do you think? I haven't changed any of the settings and I'm still running this setup https://tos.mx/vIJzoTu for the /ES and /MES Love to hear what you guys think.
/MES chart at 1D - 1M
Backtest at 1, Length 7
SMI Lower, length 4
 

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

Thread starter Similar threads Forum Replies Date
S Questions About "Crosses Above" Questions 7
M VolatilitySwitch Questions Questions 9
T Files and backup questions Questions 1
C Coding questions Questions 1
P MACD formatting questions Questions 1

Similar threads

Not the exact question you're looking for?

Start a new thread and receive assistance from our community.

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