Forex ema crossover algo (py)

hi everyone


i just joined, zero coding exp, and i'm trying to do up a standard EMA crossover strategy for forex (buys when fast ema crossover slow, shorts when slow ema cross fast) along w your standard TP, SL, TSL.

i just want to ask if anyone would be willing to share a sample code tt does what i descibed above. i'm going thru the different sample algos i see and is trying to see if i can piece things together myself (in python), but what i am trying to do seems pretty normal (i think?) and it would be helpful if i can refer to some codes of what already works instead of trying to reinvent the wheel on my own.

thanks for reading and thanks lots in adv!



#forex #ema

#how do i add tags?

Update Backtest

Welcome to the community! At QuantConnect there is a lot of documentation and code to help get you started. Here is a sample EMA crossover strategy that QuantConnect has. While this is a long-only strategy, the syntax is clear and the logic will just need to be extended to cover the short case of your strategy. With regards to setting orders, see the documentation here. The SetHoldings() method provides users with an easy way of setting positions but market orders and limit orders can easily be implemented as well. 

To become more familiar with QuantConnects API, I suggest starting Bootcamp and doing the tutorials on algorithmic trading with equities and forex. The practice will make it easier to implement all QuantConnect has to offer.


Update Backtest


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.


This discussion is closed