Hello All,

I am new to quantconnect and trying to learn my way around. I have browsed through some of the documentation and QCU algorithms and have decided to dive in. The attached algorithm is an attempt to simultate the basic moving average crossover model from Andreas Clenow's Following the Trend. The system is always in the market, going long and short when the 10 day SMA crosses the 100 day SMA. The algorithm should also set position size based on the ATR measured volatility. I was hoping I could get some assitance with that functionality. 

So far the system trades a portfolio of six currency pairs, all using equal position sizes. I have found six to be the max number of pairs that can be used without causing memory errors during backtests. I also found that using the SetHoldings method to enter positions resulted in unpredictable order sizes. MarketOrders are used instead.

One other quirk I found was that the MarketOrder method causes errors when testing with daily resolution data. It appears that they are automatically converted to market on open orders which are not supported in forex testing. This was remedied by using minute data.

The last piece I need to code is the position sizing. However, I am finding the documentation somewhat cumbersome and was hoping I could get some help. The basic formula I need to reproduce is "Risk% x Equity / ATR * Pointvalue". I am having trouble finding some basic functions like how to query the account equity and how to determine the point value of a currency pair. Is anyone interested in collaborating, or pointing me in the right direction?

 

Author