So I have a consolidator that is setup in initialize:
fast_consolidator = new TradeBarConsolidator(TimeSpan.FromSeconds(300));
fast_consolidator.DataConsolidated += FastBarHandler;
AdxFast = new AverageDirectionalIndex(ContinuousContract.Symbol, 14);
RegisterIndicator(ContinuousContract.Symbol, AdxFast, fast_consolidator);
SubscriptionManager.AddConsolidator(ContinuousContract.Symbol, fast_consolidator);
It works well in that every 300 seconds (5 min), I get an update on my ADX values.
I have tried a lot of things but have come back to consolidators… Mainly because I need the ADX to apply it's moving averages over different length bars and this was the only way to get that data…
I know there is fast_consolidator.workingdata and .workingbar but I can't seem to figure out if they can help me?
So here's my question: Is there a way to get intermediate ADX values? As in, when T ≠ 300 seconds?
Thanks in advance
Echoes McCarthur
I believe I now realize that the issue may be that I need to be creative with some sort of rolling window setups but for the life of me I can't figure it out…
Echoes McCarthur
I've shifted my strategy quite a bit but to know real luck…
Here is where my head is at now:
I realize that the consolidator limits the visibility of the ADX. But I thought that I could create some RollingWindows and:
After those are done, I try to:
After all this (for a non-coder)… this still doesn't work. The debug on the slowbar does show it adding samples appropriately and all the others are non-null.. but essentially it only still updates every 1800 seconds…
The reason I want this is because I want to see if something happens in between the firing of the consolidators. It's essential to how I've built strategies on Tradingview, which rely on tradebars (though if someone has a compelling reason to move to quotebars, I'm all ears). And I'm trying to bring it over to QC.
Hopefully someone can spot an error in my ways… I'm not quite sure what is wrong but ultimately the Adx is just not updating (I had also tried to reset it at the end of the OnData but had no luck with that either.
Thanks in Advance
Yuri Lopukhov
I would do it like this: in consolidator handler collect the data in a list, e.g. last 14 values. Then in OnData handler create indicator manually, feed last values you stored and add current price, kind of like this:
you need to change variable names to match your code of course.
Echoes McCarthur
Thanks for the response Yuri. It was really helpful.
C# does it a bit differently due to the declarations.
We don't need anything in FastBarHandler actually
Probably some redundancy here but… it works!
Echoes McCarthur
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.
To unlock posting to the community forums please complete at least 30% of Boot Camp.
You can continue your Boot Camp training progress from the terminal. We hope to see you in the community soon!