Back

Dumb EMA Kind of Works?

I was experimenting with a very simple system to try to learn how to place trades and take them off and run through a universe of currencies, etc. Basically I didn't want the algorithm to get in the way of learning the process necessary for any system. The system is you buy above the 30 day EMA and sell below it. On AUDUSD, it actually is profitable!? Wow. I tried a bunch of others and they blow up or die slowly.

Sidenote: is there an easy way to get the user-defined universe? I currently do:

# Grab our universe, is there an easier way?
for universe in self.UniverseManager.Values:

# User defined universe has symbols from AddSecurity/AddEquity calls
if universe is UserDefinedUniverse:
break

symbols = universe.Members.Keys

for symbol in symbols:
... code per symbol...
Update Backtest








That is great to hear! Regarding the question about accessing the user-defined universe, in this case the UniverseManager is not needed. A user-defined universe is a list of assets that the user requests. After creating a user-defined universe by AddForex(), the data needed in this case can just be accessed via self.Securities('ticker'). 

The backtest below shows another way of accessing a user-defined universe via UniverseManager, which is keyed by the universe name. However, this is more tedious, especially if the user-defined universe isn't named during its initialization. 

0


Thanks! I'm definitely learning a lot. I'm a pretty strong Python programmer, but I've really struggled with MQL4 and Quantopian. This is the first time I've even been able to implement a simple alogorithm like this.

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