Type mismatch found between consolidator and indicator (python)

Back

Trying to use MFI (RSI, MACD... work fine sor far)

self.MFI(symbol, 14, self.resolution)

I receive a "type mismatch found between consolidator and indicator for symbol: DE30EUR. Consolidator outputs type QuoteBar but indicator expects input type TradeBar."

Adding a lambda function as selector doesn't solve it.

self.MFI(symbol, 14, self.resolution, lambda x: x.BidClose)

I am obviously misunderstanding what is actually needed as a 'selector'. Thank you in advance.

Kind regards

Artur

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.


Added selector function, but receive still the same error:

def Initial....

    self.MFI(symbol, 14, self.resolution, Func[IBaseData, TradeBar](self.selector_mfi))

 

def selector_mfi(self, bar):
        trade_bar = TradeBar()
        trade_bar.Close = bar.AskClose
        trade_bar.High = bar.AskHigh
        trade_bar.Low = bar.AskLow
        trade_bar.Open = bar.AskOpen
        trade_bar.Symbol = bar.Symbol
        trade_bar.Time = bar.Time
        trade_bar.Value = bar.AskClose
        trade_bar.Period = bar.Period
        return trade_bar

Consolidator outputs type QuoteBar but indicator expects input type TradeBar...
0

Hey Artur! 

Money Flow Index is an indicator based on volume, but unfortunately, CFD data does not include TradeBars. Without the volume required to perform the MFI math it is not possible to calculate it on that asset.

You might be able to hack it with a selector above; but what will you set as the TradeBar volume? That is the key component of the MFI formula. trade_bar.Volume?

1

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