Comments (5)
Can you give me a concrete example? For example, how bout this scenario:
_EXAMPLE
You want to buy MEOW, but you think it will fall in value and want to wait to purchase it. You also think that if MEOW goes up by a defined amount (let’s say 5%) it may go even higher. In an attempt to help minimize potential costs, you set your trail to 5%. Your stop price will always remain 5% above MEOW’s lowest price.
MEOW is currently trading at $110 per share. Your stop price will start at $115.50, which is 5% higher than the current price of MEOW.
If MEOW stays between $110 and $115.50, the stop price will stay at $115.50.
If MEOW falls to $100, the stop price will update to $105, 5% above than the new lowest price.
If MEOW rises to the stop price ($105) or higher, it triggers a buy market order. MEOW will be purchased at the best price currently available.
These examples are shown for illustrative purposes only. In general, understanding order types can help you manage risk and execution speed. However, you can never eliminate market and investment risks entirely. It’s usually best to choose an order type based on your investment goals and objectives.__
from td-ameritrade-client.
Thank you for the detailed answer.
My questions was more about how to write code instruction for this.
Do you have an example?
from td-ameritrade-client.
Take a look at the last example for Sell Trailing Stop on the TDA Dev site.
I think you'd just change the OrderLegInstruction.instruction from SELL to BUY, everything else would be the same. If this doesn't work or you're still confused, I can help you later this week if I've got time and you still want to make a similar trade.
from td-ameritrade-client.
@vdzoba, I think this Java would be similar, which I figured out from the link in the last comment. If you're doing a percent instead of dollar amount for the trailing, then a few parameters are different, of course:
Order order = new Order();
order.setOrderType(OrderType.TRAILING_STOP);
order.setSession(Session.NORMAL);
order.setStopPriceLinkBasis(StopPriceLinkBasis.BID);
order.setStopPriceLinkType(StopPriceLinkType.VALUE);
order.setStopPriceOffset(new BigDecimal("1"));
order.setDuration(Duration.DAY);
order.setOrderStrategyType(OrderStrategyType.SINGLE);
order.setComplexOrderStrategyType(ComplexOrderStrategyType.NONE);
OrderLegCollection olc = new OrderLegCollection();
olc.setInstruction(Instruction.BUY);
olc.setQuantity(new BigDecimal("100"));
olc.setQuantityType(QuantityType.SHARES);
order.getOrderLegCollection().add(olc);
Instrument instrument = new EquityInstrument();
instrument.setSymbol("F");
instrument.setAssetType(AssetType.EQUITY);
olc.setInstrument(instrument);
LOGGER.debug(order.toString());
return order;
from td-ameritrade-client.
Thank you! It helped me!
from td-ameritrade-client.
Related Issues (20)
- Option Prices: repeated error on NAN instead of valid double HOT 4
- FYI See this repo with clean TD Ameritrade API schemas. HOT 1
- Option Chain Parse failure from getOptionChain() HOT 7
- Duplicate class / NoSuchMethodError HOT 1
- PlaceOrder question HOT 2
- placeOrder HOT 1
- New issue with retrieving transaction history HOT 5
- Orders failed to parse. HOT 2
- Getting Error while creating Option order HOT 1
- Fetching Child Order Price HOT 1
- fix javadoc HOT 2
- Create Option Order - OptionInstrument sending null/blank values
- Generating a new access token with every API call HOT 2
- when do you implements Streaming API function? HOT 1
- RuntimeException: Empty json body: [200 - ] - https://api.tdameritrade.com/v1/marketdata/quotes?symbol=blahblah1 HOT 1
- Vulnerabilities from dependencies HOT 1
- Java code giving error HOT 3
- Receiving unauthorized errors when calling API and 400 status when trying to get access token HOT 2
- Using Spring and getting javax.validation.NoProviderFoundException with PriceHistReq Validation
- Schwab API HOT 14
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from td-ameritrade-client.