Back

Intraday Futures MA Cross Long & Short

Is there a Sample code intraday futures (say Crude Oil) MA cross Long & Short5 min?
Update Backtest








The biggest issue with writing an intraday futures algo is the data. If you have an intraday data source I then it's a mix between custom data and the canonical moving average cross, both of which are available in the university tab. QuantConnect currently offers US equity data from 1998 and 13 Forex pairs from 2007.
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.


Thanks Michael! I'm not a professional s/w coder got rusty:) I saw the video on MA cross, which has a long /short intraday strategy on stock which is good enough for me to make changes to. However the code on video and the one in the university on MA are different. The latter is a long only daily strategy. I played with the university code using MA cross template and changed to intra day and i think i observed it having worked however it only does long.

To do Long/Short , I think I need to do the 100 long, -200 short, +200 long thing in a alternating way so the position will be in the market all the time. I can make do for now on USO as a proxy to crude. Can you advise or any pointers?
0

Checkout the SetHoldings function. This will let you set a percentage of your portfolio to the specified security.if (smaFast > smaSlow)
{
// place trade for 50% of portfolio value into SPY long
SetHoldings("SPY", 0.5);
}
else
{
// place trade for 50% of portfolio value into SPY short
SetHoldings("SPY", -0.5);
}
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.


Thanks Michael, I'll give it a shot!
0

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