Hotkeys In ThinkOrSwim

sserendipity

New member
Hi,
I am a Stock Options trader. Is there a way to Automatically open/close my options orders in the mid-point between bid and ask, using a hotkey/button? This is intended for Options with big spreads. The idea is Not to have to manually define the midpoint but let the system to do it automatically to save time and be more precise. Thanks !
 
Last edited:
Hello, I am wondering if there is a way to create a hotkey or script to place a buy order 1 cent above the close of the current candle and set the stop loss 1 cent below the low of the candle. For short positions, the script should place a sell order 1 cent below the close of the current candle and set the stop loss 1 cent above the high of the candle. To take profit, the script should use a 2:1 risk-reward ratio based on the size of the candle.

Additionally, I would like to inquire if it is possible to integrate a calculator or label that displays the number of shares to buy based on a fixed dollar risk calculated using the size of the candle. This would be very helpful in managing my position sizing. Thank you.

Thank you in advance for your assistance.
 
@Cliff I believe that EntryPrice() is created AFTER an order is opened, and it appears (from the limited code you've posted) that there is no defined price at which you would like to Open an Order. Without the rest of your code, it's not possible to determine where the issue is.

See the example below which I use as a baseline script when creating backtest strategies. See the use of entryPrice to set a buy price and the use of EntryPrice() to determine when the Order will Close.

'entryPrice' is my variable that defines the specific amount to trigger an Order Open, which is this case is the 'close' price.

'EntryPrice()' is the TOS function that recalls the price at which my Order was opened.

PS: I do not advise using the strategy below to place live orders...it's just an example.

Code:
# Start Script
# Inputs
input amountToRisk = 5000;
input entryPrice = close;
input lengthMA = 21;
input avgTypeMA = AverageType.Exponential;

# Calculate Shares to Buy
def sharesToBuy = amountToRisk / entryPrice;

# Create a Buy Trigger
def buyTrigger = If entryPrice crosses above MovingAverage(avgTypeMA, entryPrice, lengthMA) then 1 else 0;

#Create a Sell trigger
def sellTrigger = EntryPrice() * 1.5;

# Open an Order
AddOrder(OrderType.BUY_TO_OPEN, buyTrigger, entryPrice, sharesToBuy, name = "Buy");

# Close an Order
AddOrder(OrderType.SELL_TO_CLOSE, sellTrigger, Open[-1], sharesToBuy, name = "Sell");

# End Script
Hi, I am not a programmer so it will take my probably a week to sort this out.... :) WHELP!

any way this Code can be modified so you enter with defined RISK amount and a stop is automatically placed to a price point that you've mouse clicked?

The way would work is:
1. click with the mouse where you want your stop loss to be
2. click hotkey to execute the $ amount you are willing to risk

This has been done on DAS Trader and it worked pretty awesome, example on the youtube video bellow and also they have their code for DAS Trader



Thanks in ADVANCE!
 

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
404 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