trophy

Long Only, ETF Alpha Streams Competition with $27,500 Prize Pool

Back

OnEndOfDay not working

New to the platform. Attempting to do a basic EMA-crossover strategy that liquidates the portfolio at the end of each trading day. Have tried both OnEndOfDay and scheduler (both attached). For some reason it is instead liquidating first thing the next day. Any pointers?

//Scheduler
Schedule.On(DateRules.Every(DayOfWeek.Monday, DayOfWeek.Friday), TimeRules.At(15, 59, 30), () =>
{
Log("Daily Liquidation at : " + Time.ToString("o"));
Liquidate();
});

//OnEndOfData
public override void OnEndOfDay()
{
// close up shop each day and reset our 'last' value so we start tomorrow fresh
Log("End of day liquidating");
Liquidate();
}

 

Update Backtest







0

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.


Hi,

What assets do you trade and what are their market hours? What is the timezone you've specified in your Initialize? Is the order being submitted on time but the fill is happening the next day, or are the submissions and the fills both happening the next day?

One way to check is to log output from the OnOrderEvent() method - it will be run both when an order is submitted and when it is filled.

0

Hi,

There is a bug reported about this that seems to have slipped away, I'll look into it now. Thanks for the report Saurabh Maheshwari !

https://github.com/QuantConnect/Lean/issues/2865

 

0

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.


Update Backtest





0

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...

This discussion is closed