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
 

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

@billionmetrics - i use it on a Mac. Once you get passed the admin set up portion (follow the MR website) works perfectly fine. I am actually trying to tune it to do multiple stocks at once now.

@METAL @dap711 - have you gents had any luck setting MR logic to run charts at once ? Assuming both are on the same timeframe ?
 
@eugnis
I have a question about MR that you may know the answer to. Since I primarily trade options, I really need the trigger to come from the chart with the stock on it as the options chain does not work properly with Strategies. When I first tested MR, I could not get it to trigger the hot key for AT and I think that was because I had the labels on my stock chart and not the options chain chart that is connected to AT. when I moved the strategy to the chart connected to AT, the hokeys worked with MR. It doesn't make since though. As I do not see how TOS and determine what is triggering the hotkey. Hopefully, this makes since. Here is an example:

W4bwEq4.jpg


I would like to use the labels on the right to trigger the hotkeys to buy,sell, and close.
 
Last edited by a moderator:
I have a question about MR that you may know the answer to. Since I primarily trade options, I really need the trigger to come from the chart with the stock on it as the options chain does not work properly with Strategies. When I first tested MR, I could not get it to trigger the hot key for AT and I think that was because I had the labels on my stock chart and not the options chain chart that is connected to AT. when I moved the strategy to the chart connected to AT, the hokeys worked with MR. It doesn't make since though. As I do not see how TOS and determine what is triggering the hotkey. Hopefully, this makes since. Here is an example:

W4bwEq4.jpg


I would like to use the labels on the right to trigger the hotkeys to buy,sell, and close.
Check you Y and X axis point on MR. That's what it uses to spot the pixel color. Likely an issue with that. You will need to customize those axis trigger points every time you move the charts around. Also, give the pixel color like 20 to 30% tolerance. (you'll see a setting there for that)
That should help.
 
Check you Y and X axis point on MR. That's what it uses to spot the pixel color. Likely an issue with that. You will need to customize those axis trigger points every time you move the charts around. Also, give the pixel color like 20 to 30% tolerance. (you'll see a setting there for that)
That should help.
That isn't it. My y and x axis is good. It actually triggers in MR but not in TOS. The hotkey does not work unless I am using the label on the same chart that is connected to AT. weird. Doesn't make sense at all. Like I said b4, TOS shouldn't care what triggers the hotkey function. I have tried a few times and cannot get it to work. I believe I saw a video where someone else used it the way i want to with no issues. Maybe someone will know what the issue is.
 
That isn't it. My y and x axis is good. It actually triggers in MR but not in TOS. The hotkey does not work unless I am using the label on the same chart that is connected to AT. weird. Doesn't make sense at all. Like I said b4, TOS shouldn't care what triggers the hotkey function. I have tried a few times and cannot get it to work. I believe I saw a video where someone else used it the way i want to with no issues. Maybe someone will know what the issue is.
The only other thing I can think of is placing a mouse click on that part of the option chain screen before going to your BUY or SELL sequence. So TOS knows which panel its working with before firing the HotKeys.
 
The only other thing I can think of is placing a mouse click on that part of the option chain screen before going to your BUY or SELL sequence. So TOS knows which panel its working with before firing the HotKeys.
I did think of that. I have not tried it yet. I had my mouse click at top of TOS like @dap711 showed in his video. I will give it a try.
 
@billionmetrics - i use it on a Mac. Once you get passed the admin set up portion (follow the MR website) works perfectly fine. I am actually trying to tune it to do multiple stocks at once now.

@METAL @dap711 - have you gents had any luck setting MR logic to run charts at once ? Assuming both are on the same timeframe ?
Thanks @eugnis. Just started playing around. Is it possible for you to share the MRF file? I downloaded one from but thats for windows and learning from it.
 
New here... been lurking for a long time though!

I am trying to get an Auto Trade Setup Refined, Here is what im working with... thanks to BenTen and dap711!

The main issue im having is trying to keep if from trading in the "Chop" or "Consolidation" areas... that eats up allot of profit!!!!
I havent traded with it live yet but looking at the Floating P/L it eats away pretty bad and adds allot of fees/comissions.

Does anyone have an idea of what to add to this to make it not trade during those times????

Thanks in advance for any help!!


# Moving Average Crossover With Arrows, Alerts, Crossing Count and Bubble at Cross
# Mobius
# Chat Room Request 01.25.2017
# Modified a bit by BenTen

input price = close;
input fastLength = 1;
input slowLength = 21;
input averageType = AverageType.EXPONENTIAL;
input BackTestTradeSize = 1;
input ShowBackTestPositions = yes;
input AlertOnSignal = yes;
input Show_Labels = yes;

plot FastMA = MovingAverage(averageType, price, fastLength);
plot SlowMA = MovingAverage(averageType, price, slowLength);
FastMA.SetDefaultColor(GetColor(1));
SlowMA.SetDefaultColor(GetColor(2));

plot ArrowUp = if FastMA crosses above SlowMA
then low
else double.nan;
ArrowUP.SetPaintingStrategy(PaintingStrategy.Arrow_UP);
ArrowUP.SetLineWeight(3);
ArrowUP.SetDefaultColor(Color.Green);
plot ArrowDN = if FastMA crosses below SlowMA
then high
else double.nan;
ArrowDN.SetPaintingStrategy(PaintingStrategy.Arrow_DOWN);
ArrowDN.SetLineWeight(3);
ArrowDN.SetDefaultColor(Color.Red);
Alert(ArrowUp, " ", Alert.Bar, Sound.Chimes);
Alert(ArrowDN, " ", Alert.Bar, Sound.Bell);

AddCloud(FastMA, SlowMA, Color.GREEN, Color.RED);

#Define the signals
def BuyToOpenSignal = ArrowUp ;
def SellToOpenSignal = ArrowDN ;

#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, " ", 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);
# End Code
 
Hi everyone,

I need help with the script below. I use an indicator on ninja trader which allows me when I press f7 to click a stop price and then an entry price. From this it calculates the shares I need to trade (fixed risk I'm willing to lose) and put the trade on. I'm looking something the same for Thinkorswim. Could anyone help??
Code so far with errors I have came up with is as follows:


declare lower;
input enableScript =no;
input pricePerShare =1.0;
inputriskAmountPerTrade = 100.0;

def stopPrice = ifIsNaN(close) then stopPrice[1] else if MouseButton.LEFT then closeelse stopPrice[1];
def entryPrice = ifIsNaN(close) then entryPrice[1] else if MouseButton.RIGHT then closeelse entryPrice[1];
def riskAmount =riskAmountPerTrade;

def shares =RoundDown(riskAmountPerTrade / (AbsValue(entryPrice - stopPrice)),0);
AddLabel(yes, "Sharesto Buy/Sell: " + shares, Color.WHITE);
plot entryLine = ifMouseButton.RIGHT then close else Double.NaN;
entryLine.SetDefaultColor(Color.GREEN);
entryLine.SetStyle(Curve.SHORT_DASH);
entryLine.SetLineWeight(2);

plot sellLine = ifMouseButton.LEFT == 2 then close else Double.NaN;
sellLine.SetDefaultColor(Color.RED);
sellLine.SetStyle(Curve.SHORT_DASH);
sellLine.SetLineWeight(2);


plot stopLine = ifMouseButton.LEFT then close else Double.NaN;
stopLine.SetDefaultColor(Color.YELLOW);
stopLine.SetStyle(Curve.SHORT_DASH);
stopLine.SetLineWeight(2);


def profitTarget1 =entryPrice + 2 * (entryPrice - stopPrice);
plot profitTarget1Line= if MouseButton.RIGHT then profitTarget1 else Double.NaN;
profitTarget1Line.SetDefaultColor(Color.CYAN);
profitTarget1Line.SetStyle(Curve.SHORT_DASH);
profitTarget1Line.SetLineWeight(2);

def profitTarget2 =entryPrice + 4 * (entryPrice - stopPrice);
plot profitTarget2Line= if MouseButton.RIGHT then profitTarget2 else Double.NaN;
profitTarget2Line.SetDefaultColor(Color.MAGENTA);
profitTarget2Line.SetStyle(Curve.SHORT_DASH);
profitTarget2Line.SetLineWeight(2);

def enableKey = 112;
def isEnabled = ifGetLastKeyPress() == enableKey then !enableScript else enableScript;
AssignPriceColor(ifisEnabled then Color.WHITE else Color.GRAY);
 
Hi,

how to select using mouse any bar to get location i.e. {bar time / bar reference number} and price e.g {open/high/low or close} for say two or three bars to then use this data in calculation to then plot a line between these bars or project beyond the last bar to the right side of the chart for "n" bars.

example: say we pick two bars 10 and 5 bars before the current bar and the bar 10 bars before the open is say 20, and the bar 5 bars before the close is say 27 then the price range from bar(-10) to bar(-5) is 7 (27-20) and then we want to plot a line from one bar before current bar i.e. bar(-1) to project a line 10 bars ahead from the bar(-1) open price with a slope =7/5 ie price range(27-20)/#bars(bar(-10)-bar(-5))

PS the indicator should be able to plot multiple such lines at different places on the chart.

thanks
S
 

Similar threads

Not the exact question you're looking for?

Start a new thread and receive assistance from our community.

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