I've thrown together an example algorithm that shows how to define indicators on any time frame using a consolidator. I also show how you can combine multiple indicators into more complex things like ratios and even indicators of indicators.
Let me know what you guys think!
Nik milev INVESTOR
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.
Sri Vanama
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.
Nicholas Caffrey
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 Handschuh
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.
Nicholas Caffrey
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 Handschuh
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.
Nicholas Caffrey
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 Handschuh
var emaHigh = EMA("SPY", 20, Resolution.Minute, Field.High);
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 Handschuh
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.
Nicholas Caffrey
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 Handschuh
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 Handschuh
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.
Nicholas Caffrey
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.
Nicholas Caffrey
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 Handschuh
// in initialize RegisterIndicator(Symbol, myIndicator, myConsolidator, AveragePriceSelector); public static decimal AveragePriceSelector(BaseData data) { var bar = (TradeBar)bar; return (bar.High + bar.Low)/2; }
Also, check out the Field.SevenBar which performs an averaging scheme on OHLC data.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.
Nicholas Caffrey
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 Handschuh
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.
Jonathan Andre
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 Handschuh
var ema15 = EMA("SPY", 15, Resolution.Minute);
The other method involves manually instantiating the class using the constructor. This is not directly tied to any security when you construct it, but instead we can register it to receive data from other indicators or from a consolidator. In the attached project here I'm manually instantiating the indicators because I want to use them on the 15 bars produced by my consolidator object, so I use method 2:var Symbol = "SPY"; var ema = new ExponentialMovingAverage("this is an indicator name", 15); RegisterIndicator(Symbol, ema, TimeSpan.FromMinutes(15));
So to answer your question, the "SPY_EMA15" is just the name of the indicator object and can be an arbitrary string. The indicator name is used by the helper Plot functions for the series name, so be sure to make it unique! I like to use names that indicator where the data came from ("SPY") and what I did with it ("EMA15"). Here's a link to the constructor in question. You can also navigate up a level to see all the code for all the indicators.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.
Jonathan Andre
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.
Jack Simonson
Hi Christian,
I've attached a backtest in which I've taken your code and made the necessary modifications to make some basic orders. Generally speaking, the Python equivalent of a C# private variable is one that is defined using the self. prefix, which initializes it globally, such as
class Algorithm(QCAlgorithm): def Initialize(self): # .... Cash, start date, add securities, etc self.globalVariable = 'This is a global variable whose value is this string' def OnData(self, data): localVariable = 'This is a local variable confined to the OnData() method' self.anotherGlobalVariable = 'This is another global variable, initialized using self.' self.Log(self.globalVariable) self.Log(localVariable) self.Log(self.anotherGlobalVariable) self.TestFunction() def TestFunction(self): self.Log(self.globalVariable) self.Log(localVariable) #### This will fail self.Log(self.anotherGlobalVariable)
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.
Christian sandven
Thanks a lot!
That cleard up quite a bit, however when I am running a backtest, it seams to fill all orders at once, and it does not seam to reackt at SL ot TP? resaulting in a buy and hold.
import pandas import numpy as np ### <summary> ### Simple RSI Strategy intended to provide a minimal algorithm example using ### one indicator ### </summary> class RSIAlgorithm(QCAlgorithm): def Initialize(self): '''Initialise the data and resolution required, as well as the cash and start-end dates for your algorithm. All algorithms must initialized.''' # Set our main strategy parameters self.SetStartDate(2013,1, 1) # Set Start Date self.SetEndDate(2014,1,1) # Set End Date self.SetCash(10000) # Set Strategy Cash RSI_Period = 14 # RSI Look back period self.RSI_OB = 60 # RSI Overbought level self.RSI_OS = 40 # RSI Oversold level self.Allocate = 2 # Percentage of captital to allocate self.tolerance = 0.00015 self.spread = 20/10000 self.first_stg_up = 0 self.first_stg_down = 0 self.trend = 0 self.trend_n = 0 self.symbol = "EURUSD" ## Rename variables for percentages to make more readable and less confusing self.tpPercent = 20/10000 self.slPercent = 10/10000 ## Reassign these to be variables for Order Tickets self.tp = None self.sl = None self.holdings = 0 self.quant = 10000 # Find more symbols here: http://quantconnect.com/data self.AddForex("EURUSD", Resolution.Minute) self.RSI_Ind = self.RSI("EURUSD", RSI_Period) self.bb_ind = self.BB("EURUSD", 20, 1, MovingAverageType.Simple); self.slow = self.SMA("EURUSD", 20, Resolution.Hour) self.fast = self.SMA("EURUSD", 7, Resolution.Hour) # Ensure that the Indicator has enough data before trading,. self.SetWarmUp(20) def OnData(self, data): trend_sma = np.where(self.fast.Current.Value > self.slow.Current.Value,1,0) spread = self.bb_ind.UpperBand.Current.Value - self.bb_ind.LowerBand.Current.Value spread_bin = np.where(spread > self.spread,1,0) # Check if we are in the market fxOpen = data[self.symbol].Open fxClose = data[self.symbol].Close price = data[self.symbol].Price if trend_sma == 1 and fxClose > fxOpen and fxClose >= self.bb_ind.UpperBand.Current.Value: self.trend = 1 if trend_sma == 0 and fxClose < fxOpen and fxClose <= self.bb_ind.LowerBand.Current.Value : self.trend = -1 if spread_bin == 0: self.first_stg_up = 0 self.first_stg_down = 0 self.trend = 0 self.trend_n = 0 if not self.Portfolio.Invested and not self.IsWarmingUp: # If not, we check the RSI Indicator if self.trend == 1 : # ## you need to assign to self.order or else variable will remain local self.order = self.MarketOrder(self.symbol, self.quant) ## you need to define fxClose or else the orders won't be properly placed fxClose = data[self.symbol].Close ## you need to replace sl with self.sl, as you want these to be global variables ## otherwise, they will not be accessible outside of OnData self.sl = self.StopMarketOrder(self.symbol, -self.quant, fxClose - self.slPercent) self.tp = self.LimitOrder(self.symbol, -self.quant, fxClose + self.tpPercent) if self.trend == -1 : self.order = self.MarketOrder(self.symbol, -self.quant) ## you need to define fxClose or else the orders won't be properly placed fxClose = data[self.symbol].Close ## you need to replace sl with self.sl, as you want these to be global variables ## otherwise, they will not be accessible outside of OnData self.sl = self.StopMarketOrder(self.symbol, self.quant, fxClose - self.tpPercent) self.tp = self.LimitOrder(self.symbol, self.quant, fxClose + self.slPercent) def OnOrderEvent(self, orderEvent): ## This will check for the boolean value of whether or not the order has been filled if not (orderEvent.Status == 'Filled'): return ## python doesn't support null. Instead, check for None if (self.tp is None) or (self.sl is None): return filledOrderid = orderEvent.OrderId if self.tp == filledOrderId: self.sl.Cancel() if self.sl == filledOrderId: self.tp.Cancel()
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.
Link Liang
Hi Christian,
Here are a few places that could go wrong:
1. in line 112-113, you might want to reconsider the use of stop order and limit order. Here is some information as reference.
2. since you defined some percentage (self.tpPercent and self.slPercent), does it make more sense to multiply by (1 +/- percentage) instead of directly add/substract them?
3. in line 129, filledOrderid => filledOrderId
4. in line 131 & 134, I believe you want to compare order ids. This would work as you expected:
if self.tp.OrderId == filledOrderId: ...
And you could use self.Liquidate() to cancel any unfilled order.
Here is my attempt. Hope it helps!
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.
Blake
Hi Jack,
Regarding your post above with the Python backtest, how does the script deal with SL and TP executed in the same bar? I think I read in one of Jared's posts somewhere that anything triggered in the OnOrderEvent method will only affect the backtest in the next OnData cycle. Therefore - in the scenario a SL and TP trigger on the same bar, both will be triggered (before one is cancelled) causing you (in your case above) to go negative on the trade in the opposite direction instead of neutral (0).
Any help greatly appreciated - i'm just starting out with QC. Thanks, Blake
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.
Shile Wen
Hi Blake,
If both the SL and TP are triggered in the same bar, then our position will go negative, and I've shown an example in the attached backtest. To address this, we can set our SL and TP farther out, increase granularity (i.e. use Minute Resolution over Daily), or constantly check our positions to make sure any negative positions are liquidated.
Best,
Shile Wen
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.
Blake
Hi Shile, thank you. This has more or less confirmed my thinking.
One question - when you say constantly check positons - do you mean there is a way to cancel an order in the same bar on the basis of another order filled in the same bar? My understanding is we cannot do this but I want to be 100% clear.
Thanks
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.
Shile Wen
Hi Blake,
No, Hi Blake,No, I meant constantly check positions as in check if self.Portfolio[symbol].Quantity < 0 to make sure we don't have a negative position.
Best,
Shile Wen
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.
Francesco Baldisserri
Hi,
I understand this is an old thread but is the triple order method to have the stop loss and take profit compatible with Crypto?
I am asking this because when I insert the orders below I get the following error:
Order Error: id: 1096, Insufficient buying power to complete order (Value:-XXX), Reason: Your portfolio holds [holdings] [symbols], [holdings] [symbols] of which are reserved for open orders, but your Sell order is for [holdings] [symbols]. Cash Modeling trading does not permit short holdings so ensure you only sell what you have, including any additional open orders.
SetHoldings(symbol, targetSize) # Enter the position
holdings = Portfolio[symbol].Quantity
LimitOrder(symbol, -holdings, takeProfitPrice) # Set the take profit
StopMarketOrder(symbol, -holdings, stopLossPrice) # Set the stop loss
I assume the last order, for the stop loss, gives error because then there would be 2 open orders for -holdings quantity which could be interpreted as a short even though the 2 orders should not trigger together.
Any idea how to solve this?
Thanks!
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.
Varad Kabade
Hi Francesco Baldisserri,
The above problem is occurring because the cash model will not allow us to have a negative quantity. We have 3 ways to implement this.
Set the Stop Market, handle the take profit manually
or, set the Limit, handle the stop loss manually
or place only half of quantity for the Stop and Limit
in this case, call Liquidate whether one or the other is filled, because Liquidate closes the remaining half and cancels the other order. We have created a demo algorithm implementing the above. Refer to the attached backtest.
Best,
Varad Kabade
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.
Francesco Baldisserri
Hi Varad,
I suspected we could not escape from the need to check at least one of these conditions manually. I suspect this would be tricky for the performance if working with a large universe but the mechanism is clear.
Thanks,
Francesco
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.
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!