Back

How to get portfolio of futures listed so that data can be rendered after a change?

Hi,

I have difficulities understanding the moments on which my algorithm trades. For some reason I generate too much data so I thought to render the data only when a trade/ change has happend. But I do not get my portfolio out for futures. The quantity does not appear to be 0,1 or -1. I am using the online editor so hard to set a breakpoint or to have intellisense for the methods to be used.

Help appreciated.

J.

if(_previousPortfolio != null)
{
//Dictionary<Symbol, SecurityHolding>
foreach (var holding in Portfolio.Values)
{
if(holding != null)
{
foreach (var previousHolding in _previousPortfolio.Values)
{
if(previousHolding != null)
{
if(holding.Quantity != previousHolding.Quantity)// ||
// futureHolding.IsLong != previousFutureHolding.IsLong ||
//futureHolding.IsShort != previousFutureHolding.IsShort)
{
Log("Holdings Changed");
Plot("Indicator Signal", "Trend", IsDownTrend ? -1 : IsUpTrend ? 1 : 0);
Plot("Holdings", "Qty", holding.Quantity);
Plot("Data", "Price", _price);
Plot("Data", _fast, _slow);
}
}
}
}
}
}
_previousPortfolio = Portfolio;
Update Backtest








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