Back

How to set candlesticks to heiken ashi as default

I would like to set my candlesticks to Heiken Ashi by default, as when I calculate something like RSI its value will differ when using regular candlesticks vs. Heiken Ashi. Thank you!

Update Backtest








Any sort of basic code using heiken ashi as default and calculating something like RSI would be really appreciated! I learn best from example, and the university videos have been very helpful so far. Thanks all.

1

Please checkout the documentation under the Indicators section.
Indicators can be chained together to create unique combinations much like lego blocks:

public class IndicatorTests : QCAlgorithm
{
//Save off reference to indicator objects
HeikinAshi _ha;
RelativeStrengthIndex _haRsi;

public override void Initialize()
{
//In addition to other initialize logic:

// Creating Heikin Ashi
_ha = heikinAshi = HeikinAshi(_spy)
// Creating the RSI of Heikin Ashi
_haRsi = new RelativeStrengthIndex("HA_RSI", 14).Of(_ha);
}

public override void OnData(Slice data)
{
Plot("RSI", _ha, _haRsi);
}
}

If we want to use TradeBar indicator (an indicator that needs bar properties: open, high, low) with Heikin Ashi, it is not as straight forward. We need to use Heikin Ashi properties to create a TradeBar object to pass it into the TradeBar indicator.

In the shared project below, we have implemented the RSI (data point indicator) and the ADX (trade bar indicator).

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