Back

Question about using indicators for Oanda Securities

During my backtests, things were working fine when the security I was backtesting with was SPY, wherein I called it into the algo using:

self.AddEquity("SPY", Resolution.Daily)

I also called some indicators like self.RSI, and the algo was making trades in the backtesting using those indicators. When I use this instead though, because Oanda only offers CFDs, the algo no longer opens any trades in the backtesting, there aren't any errors coming up either. My guess is Oanda's CFDs don't work so well with their actual underlying asset equivalent? Or they don't recognize it?

self.AddCfd("SPX500USD", Resolution.Daily)

I also changed the way I called the RSI:

self.rsi = self.RSI("SPY", 14)   to -->  self.rsi = self.RSI("SPX500USD", 14)

I'm pretty new at all this so I feel like I might be missing something very obvious. Am I calling it wrong? I'm sure I'm making more than 1 or 2 mistakes here.

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.


Hey Vincent,

No orders are being placed because the condition

if self.rsi_spy.Current.Value < self.RSI_OS and price > self.ema_spy.Current.Value:

is never satisfied. We can verify this by removing that condition and observing that orders are now being placed.

We need to also note that MarketOnOpen orders are not supported by the OandaBrokerageModel. When using daily resolution data, all orders are submitted at midnight, which means market orders are submitted as MarketOnOpen orders. This means we must either convert our self.SetHoldings and self.Liquidate orders to limit orders, or we must use higher resolution data. I updated the algorithm to use higher resolution data and use a scheduled event to rebalance.

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.


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