Back

Can you have a data array with consolidated mfi data?

I'm using both daily and 15 minute money flow index data in my strategy. But I'd like to check more than one stock at a time. Making an array of stock tickers is easy, but I'm not too sure how to define the array for both daily and consolidated mfi data? 

Update Backtest








When we are handling more than one security and each one of them has multiple indicators, one option is to create a class that holds the indicators of each symbol:

public class SymbolData
{
public Symbol Symbol;
public MoneyFlowIndex Daily;
public MoneyFlowIndex Fifteen;
public bool IsReady {
get {
return Daily.IsReady && Fifteen.IsReady;
}
}

public SymbolData(Symbol symbol,
MoneyFlowIndex daily, MoneyFlowIndex fifteen)
{
Symbol = symbol;
Daily = daily;
Fifteen = fifteen;
}
}

We can save this object in a dictionary where the key is a Symbol and easily access the information:

public Dictionary<Symbol, SymbolData> _symbolData;

// MFI 15 minutes of a given bar
var mfi15m = _symbolData[bar.Symbol].Fifteen;

 Please checkout the attached project.

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