LEAN is the open source
algorithmic trading engine powering QuantConnect. Founded in 2013 LEAN has been built by a
global community of 80+ engineers and powers more than a dozen hedge funds today.
Alpha League Competition: $1,000 Weekly Prize Pool
Qualifying Alpha Streams Reentered Weekly Learn
more
//Take Profit (Sell) at 50 pips above
var takeProfit = LimitOrder("USDJPY", -10000, data["USDJPY"].Close +
Securities["USDJPY"].SymbolProperties.MinimumPriceVariation*50*10);
Hi,
I have the above code where I'm trying to set a take profit of 50 pips on a buy market order. What I expect to happen:
Market order gets filled immediately. Limit Order gets "submitted" immediately and then later gets filled when price reaches 50 pips above the current price.
What happens:
Market order and Limit order both get filled immediately.
Shouldnt the limit order be filled after some time when price has moved by 50 pips? Am I doing Limit Orders wrong? A sell limit order gets filled at the limit price or higher right? Then why does it get filled immediately?
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 QuantConnect. In addition, the material offers no opinion with respect to the suitability of any security or specific investment. QuantConnect 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. All investments involve risk, including loss of principal. You should consult with an investment professional before making any investment decisions.
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 QuantConnect. In addition, the material offers no opinion with respect to the suitability of any security or specific investment. QuantConnect 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. All investments involve risk, including loss of principal. You should consult with an investment professional before making any investment decisions.
Michael Manus
10.2k
,
can't see anything on the picture :)
i think they dont have ask and bid prices why you would have to implement something to test the spread....
0
Edited by Michael Manus
Michael Manus
10.2k
,
Did you try to log the time the orders get exectued with the TIME variable?
sorry no info for me provided by the picture..... :)
i only inserted the onorder event so you see whats happening:
2013-10-07 00:00:00 : Launching analysis for bdada492d187a8c85c822d96d6498b3a with LEAN Engine v2.4.0.1.3231
2013-10-07 00:00:00 : Order 1: 10/7/2013 12:00:00 AM: Market: Time: 10/7/2013 4:00:00 AM OrderID: 1 Symbol: USDJPY Status: Submitted
2013-10-07 00:00:00 : Order 1: 10/7/2013 12:00:00 AM: Market: Time: 10/7/2013 4:00:00 AM OrderID: 1 Symbol: USDJPY Status: Filled Quantity: 10000 FillPrice: 97.162 JPY
2013-10-07 00:00:00 : Order 2: 10/7/2013 12:00:00 AM: Limit: Time: 10/7/2013 4:00:00 AM OrderID: 2 Symbol: USDJPY Status: Submitted
2013-10-07 00:00:00 : Current : 97.160
2013-10-07 00:00:00 : Increased price : 97.660
2013-10-09 21:19:00 : Order 2: 10/9/2013 9:19:00 PM: Limit: Time: 10/10/2013 1:19:00 AM OrderID: 2 Symbol: USDJPY Status: Filled Quantity: -10000 FillPrice: 97.66 JPY
2013-10-11 18:00:00 : Algorithm Id:(bdada492d187a8c85c822d96d6498b3a) completed in 1.06 seconds at 6k data points per second. Processing total of 6,841 data points.
so its some time than..... :)
"" Shouldnt the limit order be filled after some time when price has moved by 50 pips? Am I doing Limit Orders wrong? A sell limit order gets filled at the limit price or higher right? Then why does it get filled immediately? ""
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 QuantConnect. In addition, the material offers no opinion with respect to the suitability of any security or specific investment. QuantConnect 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. All investments involve risk, including loss of principal. You should consult with an investment professional before making any investment decisions.
Loading...
To unlock posting to the community forums please complete at least 30% of Boot Camp. You can
continue your Boot Camp training progress from the terminal. We
hope to see you in the community soon!