Hi,
I've had a strategy with EMA crosses for a while now, and I'm trying to automate my trades.
I don't have much experience in C#, though from the basic tutorials and university, I've made a little bit of progress.
I keep running into issues, though, when I try to do say...for example....a 5/10 min EMA cross. I try changing the resolution but that doesn't seem to change anything, looking for help :)!
Josh Morris
I'm trying to tweak the one used in the university tutorial, but it doesn't pass my "sanity check" persay.....doesn't seem to go off min data...
Warren Harding
I've got an EMA cross that I built with my strategy template. I can get it to barely beat the market with daily data, but I have to tweak the settings to the point where I don't trust it to actually beat the market. It seems to mostly lose money with minute data no matter what configuration I put it in. Don't forget to set the dates to a shorter time period if you are going to test it with minute data. It's draft so try and be forgiving if you find any bugs.
Josh Morris
Haha yeah you don't want to be curve fitting...although judging by your profile you know that and more...
Thanks a lot, this seems a bit complex fo rme so I'm going to have to dig in :P
Perhaps these last few months have just been luck for me, I guess i'll see when I can get the backtest to fully work :)
Josh Morris
I hope I'm not asking too much, but could you isolate which parts specifically deal with the custom indicator and the crossing of it? Alternatively, annotate what each part does? I'm trying to learn through the university and such, but it's all a bit overwhelming for me so far..I'd greatly appreciate it!
Warren Harding
The lines you are most likely to want to modify are:
int maPeriodFast=20; //you probably want to set this to 5
int maPeriodSlow=180; //you probably want to set this to 10
Resolution resolution = Resolution.Daily; //you will likely want to change Daily to Minute
SetStartDate(2012, 1, 1); //this should be a reasonable date for minutes, sometime in 2016 most likely if you don't want to wait too long for your backtest
string tickersString =..... //I've got the whole s&p 500 in here. You probably didn't get lucky. You might want to just trade the stocks you've been trading, they might behave appropriately where EMA crosses are concerned.
where stockData.EMAFast>stockData.EMASlow //this one is further down in the Buy routine and indicates that one should buy when the EMAFast is greater than the EMASlow, you can reverse that.
if (stockData.EMAFast < stockData.EMASlow) //this one is further down in the Sell routine. It indicates that one should sell when the EMAFast is less than the EMASlow. You can reverse that.
Josh Morris
Thanks!
I've actually been trading FX, I (and I think many others) find that it responds better to minute trading than the S&P, what lines should I delete/add (and where) to change it as such?
Warren Harding
I'm adding tickers from the tickersString in a loop. It makes it easy to deal with ticker lists. You can comment off the big long line of s&p 500 tickers and replace that line with your list of FX tickers. Then change the SecurityType to Forex in the AddSecurity line. I haven't worked with FX much so I'm not sure if you have to do anything else.
Josh Morris
Warren Harding
I'm not sure. I swapped in a forex symbol myself and changed the security type but got a flat line for a backtest. My template has been built with equities in mind so it simply might not be suitable for forex. If limit orders aren't supported with forex as an example then my template will be largely useless.
Josh Morris
Josh Morris
Alexandre Catarino
I have attached a simple FX (EURUSD) EMA cross based on the QuantConnect University example "Moving Average Cross". Did you follow it?
Could you please attach your backest for community help?
Mark E. Twiz
Mark E. Twiz
Josh Morris
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!