Back

Rolling Window Long EMA Slope?

Hi,

I'm new to Quant Connect and I must say I'm very impressed with the platform. My coding knowledge is pretty limited and I've only ever done some basic coding previsously so I'm hoping someone can help? I've been a manual trader for a few years now and I want to convert some of my short term scalping-style strategies I deploy when markets are choppy.

I want to add some features to my algo -

If the EMA100 line is sloping up, then trade long and if it's pointing down, sell. I've read that the rolling window function is the way to do this, but I'm not sure what values it returns and where to insert them into my code? 

I also want to add another If statement that if the cross of two EMA lines happened more than 5 minutes ago not to make the trade. Basically I want the cross to be my major parameter, then I want all my other moons to line up within 5 minutes.

One other thing whilst I'm here. How would I implement a fixed (or dymamic) stoploss and a take profit? At the moment the code sells off when the EMAs recross.

I have attached the code and any help would be fantastic.

Regards,

Iain

Update Backtest








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