↑↓ to select, press enter to go, use esc to exit
  • Pricing
  • Data
  • Community
  • Algorithm Lab Lab Lab
  • Documentation Docs Docs
  • Sign In
Forum

    Platform

  • Alpha Market
  • Pricing
  • Datasets
  • Community
  • Algorithm Lab
  • Documentation

    SIGN IN

  • Sign in
  • Don't have an account? Join QuantConnect Today

  • Sign up for Free

QuantConnect Community

trophy

trophy

Start New Discussion Sign up
Interesting | Newest | Lean | Data Issues | Integration Partners

New Sign up
No Results
  • «
  • 1
  • »
HI Interesting !
HI Newest !
HI Data Issues !

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.

trophy

Alpha League Competition: $1,000 Weekly Prize Pool

Qualifying Alpha Streams Reentered Weekly Learn more

| Awards
Loading...
  • «
  • »
 Start New Discussion Sign up

Filter Discussion by Tags


Community Ambassadors

1st

Nico Xenox

Gold Ambassador

Earn free QuantConnect cloud credits by helping others, each week we airdrop credits to the most active community members.


231,842 Quants.

Become a Quant

Online Now

Our Code of Conduct

Stay Connected

Stay connected with all the latest updates with email alerts or joining our Discord server.

  Open Discord

profile

Answers

Answers

  Backtests

Backtests

  Comments

Comments

  Live Traded

Live Traded

 

 

 

Documentation discussion algorithm-reference/trading-and-orders

Back

Started By:


Follow Discussion
Reward Discussion Awards
Permalink

QuantConnect Robot INVESTOR


 |   Reward Discussion
0
0
Update Backtest





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.

  0  
18
Twitter Facebook LinkedIn Copy Link

QuantConnect Robot

Permalink

 | 
accepted answer

Accepted Answer

0
Update Backtest





  • Notebook

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.

0
Twitter Facebook LinkedIn Copy Link

Roland Le Franc


19 Pro ,

Is there any Trailing Stop Loss order type? If not, why?

11

Alexandre Catarino


Pro ,

Hi Roland Le Franc, we have an open GitHub issue about it:
Add support for Trailing Stop Orders #2580
There is no particular reason other than it is more complex than the other types and there was no demand.

2

Andrey Solovyev


19 Pro ,

I have a question - is there any way of forcing the price to be taken by an order while backtesting? Ie I would like to enter long position with ask price and close long position with bid price. Or, to open a position with Open and close that with the next after a trigger Bar Open. How can I implement that in code? 

Thanks a lot for answering. 

0
Edited by Andrey Solovyev

Jack Simonson


Pro ,

Hi Andrey,

LEAN supports custom fill models which can be used to force order fulfillment based on customized criteria. The documentation section can help illustrate how these might be implemented.

0
Edited by Jack Simonson

Andrew Angeles


10 Pro ,

Building an algo using OandaBrokerageModel, not sure how best handle:

"Backtest Handled Error: OrderID: 1 Warning - Code: NotSupported - The OandaBrokerageModel does not support MarketOnOpen order type" 

From what I've read, a signal a trade signal is generated, I call SetHoldings(_fx.Symbol,1); or Liquidate(_fx.Symbol); and a market order is attempted.  However, because the order cannot be filled in the current session it is converted into a MarketOnOpen, which is not supported by FXCM or Oanda.   My question is, how do I get arround this?

 

The last piece of information I gathered from Alexandre Catarino's post here: 

https://www.quantconnect.com/forum/discussion/1761/just-downloaded-lean-have-a-few-questions/p1
0
Edited by Jack Simonson

Jack Simonson


Pro ,

Hi Andrew,

The best way to get around this would be to use the Order Status and Order Ticket features, whose documentation can be found here, to cancel any open orders at market close and then re-submit them upon market open. This is likely the best way to accomplish this, assuming you want to place the order on market open no matter what happens overnight.

0

Laszlo Pasztor Questive Ltd


4.5k Pro ,

Is there a way to use OCA Group orders with IB?

0

Link Liang


6.1k Pro ,

Hi Laszlo,

There are certainly ways to implement OCA orders. In fact, there are many discussions about One-Cancel-Others orders in the community, so I recommend to search in our forum. You might want to read this and this.

Meanwhile, you may subscribe to this Github Issue for updates of IB API support. Hope it helps.

0
Edited by Link Liang

Laszlo Pasztor Questive Ltd


4.5k Pro ,

Thanks for your comment. IB API order Class has OcaGroup property. One can set it when submitting the order. So there is no way I can Set that in quantconnect? I would prefer IB monitor and managa the OCA Froups rather me in my code.

0

Link Liang


6.1k Pro ,

Hi Laszlo,

Thanks for the information you provided. We will work on implementing this IB API. Stay tuned!

0

Meghdoot dhameliya


149 Pro ,

I'm working on custom brokerage, i have following queries
1) how can I check the trade placed for intraday order? by using security holding i am only getting overnight orders

2) brokers api return overnight order in holding after t + 1 day, how can i cancel that order on same day

1

Jared Broad


Pro ,

Hi meghdoot dhameliya I think this would be best discussed on GitHub with an open pull request. Here it's hard to really understand your needs as the problems you're describing are abstract. 

1

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.


Ryland Mathews


231 Pro ,

 def OnData(self, slice):

        if slice.Bars.Count == 0: return
        if self.changes is None: return

        # start fresh
        self.Liquidate()

        percentage = 1 / slice.Bars.Count
        for tradeBar in slice.Bars.Values:
            self.Log("trade bar {0}".format(tradeBar))
            self.SetHoldings(tradeBar.Symbol, percentage)
            self.Log("percentage {0}".format(percentage))

        # reset changes
        self.changes = None

 

when using setholdings() and liquidate() like above what type of order is being used? and when is it being executed. I get a backtest but I cant tell if its liquidating on open? on close? (assuming daily data) thanks! 

0

Alethea Lin


7.5k Pro ,

Hi Ryland,

Both SetHoldings() and Liquidate() places market orders. Since they are called within the OnData() block, they will execute on open of the next day assuming daily data. Please refer to "Understanding Time" for more information! Below is a quote from the documentation page:

"Once a datapoint's EndTime has passed it will be transmitted to your algorithm OnData() method. For bar data, this is the beginning of the next bar. "

0

Laurent Crouzet


4.9k Pro ,

Jared Broad : thanks a lot for the update of this page, which is really helpful!

1

Alexandre Catarino


Pro ,

Hi Carlos Rendon ,

QuantConnect/lean does have such feature: TradeBuilder. Please check out the following thread:
Are there any examples of using TradeBuilder/StatisticsBuilder classes in Python? #3251
for details.

We will add information about the IAlgorithm.TradeBuilder as soon as possible.

0

Carlos Rendon


167 Pro ,

Thanks for the quick response Alexandre!!

0

Shailesh Raval


1k Pro ,
# Use order response object to read status
if response.IsSuccessful:
self.Debug("Order successfully canceled") It is not IsSuccessfulONLY     IsSuccess
0

QuantConnect Robot INVESTOR

Permalink

 | 
0
Update Backtest







  • Notebook

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.

 0 
Twitter Facebook LinkedIn Copy Link
Loading...
  • 1
  • «
  • »

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!

award-icon

What is an Award?

Back
 
 

Join QuantConnect for Free Sign Up

QuantConnect Logo

QuantConnect™ 2023. All Rights Reserved

Technology

  • Algorithm Lab
  • Documentation
  • Community
  • Tutorials
  • Data Library
  • Learning Articles
  • System Status
  • Account
  • Discussions List

Company

  • About
  • Affiliates
  • Our Blog
  • Contact
  • Pricing
  • Integration Partners
  • Terms & Conditions
  • Privacy Policy

LEAN

  • Fork 2,779
  • Star 7,233
QuantConnect Logo

QuantConnect™ 2023. All Rights Reserved

Technology

  • Algorithm Lab
  • Documentation
  • Community
  • Tutorials
  • Data Library
  • Learning Articles
  • System Status
  • Account
  • Discussions List

Company

  • About
  • Affiliates
  • Our Blog
  • Contact
  • Pricing
  • Integration Partners
  • Terms & Conditions
  • Privacy Policy

LEAN

  • Fork 2,779
  • Star 7,233