Best bitcoin pool mining
48 commentsCombinacao de signos gemeos e libra
Looping through multiple stocks, I'm having trouble understanding how context variables are set for each stock in order to use variables to set a stop loss AND sell limit.
Does anyone have a better suggestion then the code below for accomplishing my intent when purchasing a stock? Here's some broad philosophies regarding stops profit and loss. Using stops for non-auto-algorithmic swing trading is a best practice. You come back every day or two and check to see what has transpired, reassess, readjust and repeat.
Using stops for auto-algorithmic trading is less clear as a best practice. Maintaining stops mind you, you don't just plop in a stop and walk away. You need to adjust over time per the market's activity.
But if your auto-trading system retains a high quality connection rate, stops become less useful and more problematic. If your strategy is actively watching the market, watching your position, and watching your risk, then it itself can determine when it's time to exit. Minute granularity seems rather gross with regards to most people's ideas of "real time" trading. But for equities, minutely volatility is well with most strategies' risk parameters. Meaning that your algorithm can just watch the market and "stop out" with market orders when it deems fit to do so.
That said, normally you would wait for acknowledgement of a position before you submit protective stops and profit limits. There must be some discussion on this topi in the forum somewhere. Are you performing a volatility arb by precalculating your stop loss and stop profit?
Narrow loss and profit levels? Otherwise your stop loss would probably be wide enough to wait or calculate dynamically once a minute. Profit limits show up in the market's orderbook and can be hunted If you intend to periodically shift your profit limits up then you may want to also dynamically calculate these and issue market orders on profit events.
Would anyone know would I approach setting the price based on the purchased price to sell a bought security? You might be interested by my post here https: What you are asking for is a bracket order basically, as most have aptly pointed out. I've been working for the past few weeks to build a bracket order system.
There are a lot of intricacies and quirks associated with this, and ideally it should be allowable as a order-type for live trading. But as of now, we have to implement ourselves. Problem with this is that sometimes you only get a partial fill and have to wait another bar or even more to get a full fill. This is less of an issue if you trade very liquid issues with lower volume fills. Nevertheless, you have to monitor this issue proactively to make sure your initial order fills before your bracket orders become active.
If one of them executes, you want to automatically cancel the other. This is also something you have to proactively monitor. I keep a dict of bracket orders keyed by stock in context. If my initial order is filled, I put in the orders for the stop and limit orders. If either the stop or limit order is filled, I cancel the other one.
It's tough to do but possible. I have not overcome the problem of getting only partially filled. I'm just ignoring it for now and using small size and liquid issues. Sorry, something went wrong. Try again or contact us by sending feedback. The material on this website is provided for informational purposes only and does not constitute an offer to sell, a solicitation to buy, or a recommendation or endorsement for any security or strategy, nor does it constitute an offer to provide investment advisory services by Quantopian.
In addition, the material offers no opinion with respect to the suitability of any security or specific investment. No information contained herein should be regarded as a suggestion to engage in or refrain from any investment-related course of action as none of Quantopian nor any of its affiliates is undertaking to provide investment advice, act as an adviser to any plan or entity subject to the Employee Retirement Income Security Act of , as amended, individual retirement account or individual retirement annuity, or give advice in a fiduciary capacity with respect to the materials presented herein.
If you are an individual retirement or other investor, contact your financial advisor or other fiduciary unrelated to Quantopian about whether any given investment idea, strategy, product or service described herein may be appropriate for your circumstances. All investments involve risk, including loss of principal. Quantopian makes no guarantees as to the accuracy or completeness of the views expressed in the website.
The views are subject to change, and may have become unreliable for various reasons, including changes in market conditions or economic circumstances. Hi all, Looping through multiple stocks, I'm having trouble understanding how context variables are set for each stock in order to use variables to set a stop loss AND sell limit.
I see thanks for the information. Hi, You might be interested by my post here https: Hello, What you are asking for is a bracket order basically, as most have aptly pointed out. Please sign in or join Quantopian to post a reply. Already a Quantopian member? Algorithm Backtest Live Algorithm Notebook. Sorry, research is currently undergoing maintenance. Please check back shortly. If the maintenance period lasts longer than expected, you can find updates on status. Sorry, something went wrong on our end.
Please try again or contact Quantopian support. You've successfully submitted a support ticket. Our support team will be in touch soon. Send Error submitting support request. Join Quantopian to get access to our financial data, platform, and hands-on educational curriculum.