Today I've reran multitudes of code that yesterday were running as expected, however today I am not seeing any orders placed. Is there an issue with my account? I have used two different computers with the same results so it is making me think I may be getting restricted by QC? Thinking this I went ahead and deleted all of my history in backtests/projects thinking it may be a matter of using up space however this was not the case. all of the code I am running is in futures contracts if that matters. Below is an example of code no longer placing orders on my account,
class CrawlingFluorescentYellowCaribou(QCAlgorithm):
stoplossTicket = None
takeprofitTicket = None
exitfilltime = datetime.min
def Initialize(self):
self.SetStartDate(2019, 1, 1)
self.SetEndDate(2022,1,1)
self.SetCash(100000)
self.crudeoilwti = self.AddFuture(Futures.Indices.NASDAQ100EMini, Resolution.Minute)
self.rsi = RelativeStrengthIndex(3)
oneMinuteConsolidator = TradeBarConsolidator(timedelta(minutes=1))
self.SubscriptionManager.AddConsolidator(self.crudeoilwti.Symbol, oneMinuteConsolidator)
# register the 30-minute consolidated bar data to automatically update the indicator
self.RegisterIndicator(self.crudeoilwti.Symbol, self.rsi, oneMinuteConsolidator)
self.adx = AverageDirectionalIndex(5)
oneHourConsolidator = TradeBarConsolidator(timedelta(hours=1))
self.SubscriptionManager.AddConsolidator(self.crudeoilwti.Symbol, oneHourConsolidator)
# register the 30-minute consolidated bar data to automatically update the indicator
self.RegisterIndicator(self.crudeoilwti.Symbol, self.adx, oneHourConsolidator)
self.atr = AverageTrueRange(20)
oneHourConsolidator = TradeBarConsolidator(timedelta(hours=1))
self.SubscriptionManager.AddConsolidator(self.crudeoilwti.Symbol, oneHourConsolidator)
# register the 30-minute consolidated bar data to automatically update the indicator
self.RegisterIndicator(self.crudeoilwti.Symbol, self.atr, oneHourConsolidator)
self.Schedule.On(self.DateRules.EveryDay(self.crudeoilwti.Symbol), self.TimeRules.At(15, 00), self.ClosePositions)
def OnData(self, data: Slice):
if not self.adx.IsReady:
return
price = self.Securities[self.crudeoilwti.Symbol].Price
confirmationtrend = self.adx.Current.Value >= 75
confirmationrange = self.adx.Current.Value <= 25
atr = self.atr.Current.Value
rsi = self.rsi.Current.Value
if self.Time.hour >= 9 and self.Time.hour <= 14:
if not self.Portfolio.Invested:
if confirmationrange is True:
if rsi <= 25:
self.MarketOrder(self.crudeoilwti.Symbol, 3)
self.stoplossTicket = self.StopMarketOrder(self.crudeoilwti.Symbol, -3, price-atr*2)
self.takeprofitTicket = self.LimitOrder(self.crudeoilwti.Symbol, -3, price+atr*5)
if rsi >= 75:
self.MarketOrder(self.crudeoilwti.Symbol, -3)
self.stoplossTicket = self.StopMarketOrder(self.crudeoilwti.Symbol, 3, price+atr*2)
self.takeprofitTicket = self.LimitOrder(self.crudeoilwti.Symbol, 3, price-atr*5)
if confirmationtrend is True:
if rsi <= 25:
self.MarketOrder(self.crudeoilwti.Symbol, -3)
self.stoplossTicket = self.StopMarketOrder(self.crudeoilwti.Symbol, 3, price+atr*2)
self.takeprofitTicket = self.LimitOrder(self.crudeoilwti.Symbol, 3, price-atr*5)
if rsi >= 75:
self.MarketOrder(self.crudeoilwti.Symbol, 3)
self.stoplossTicket = self.StopMarketOrder(self.crudeoilwti.Symbol, -3, price-atr*2)
self.takeprofitTicket = self.LimitOrder(self.crudeoilwti.Symbol, -3, price+atr*5)
def OnOrderEvent(self, orderEvent):
if orderEvent.Status != OrderStatus.Filled:
return
if self.stoplossTicket is not None and self.stoplossTicket.OrderId == orderEvent.OrderId:
self.Transactions.CancelOpenOrders()
self.stoplossTicket = None
self.exitfilltime = self.Time
if self.takeprofitTicket is not None and self.takeprofitTicket.OrderId == orderEvent.OrderId:
self.Transactions.CancelOpenOrders()
self.takeprofitTicket = None
self.exitfilltime = self.Time
def ClosePositions(self):
self.Liquidate(self.crudeoilwti.Symbol)
self.Transactions.CancelOpenOrders()
AegeanFutures
This was resolved and answered through qc support email, please disregard
AegeanFutures
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!