Back

Using Consolidate Futures bars OHLC to trigger orders

I am working on a simple bar reversal algo that uses custom bar lengths and counts the number of consecutive candles with lower highs. It then stops itsself in long after a defined number of down bars when the previous high is crossed. 

I've coded this successfully in crypto markets, but getting the data is much more involved for futures. Since I've used some default code provided in the futures consolidator samples to understand how to pull in that data, I'm getting slightly confused with my variables and syntax between methods once it's all copied in.

The issue is, I can successfully create new consolidated bars, but trying to use that bar data and trying to define the current price within different methods is getting errors in build..

I've commented out line where price is not working, (OnData block) to successgully build. I'm also not 100% sure I'm getting the single most recent contract's High and Low data correctly for my consolidated bars. (My backtest says it's too much data so I can no longer view logs)

Any help would be appreciated!

Update Backtest








Did you happen to ever figure this out?

0

hmm he is creating  consolidators every time ondata is called.

this code belongs in the init sections above

please checkout some examples provided by the quantconnect team.

you can find the links on the right side of the community forum.

0

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