Back

Edited Bollinger Band and MACD for Trading Signals

Hi, I am new to QuantConnect, and I have just tried creating a strategy of my own, amalgating bollinger band and MACD. For bollinger band, I have edited the limitation of the upper and lower limit, based on my research.

However, I am not too sure why it doesn't run. Do let me know if you have a walkaround to resolve my issue.

Update Backtest








This is the error I am currently facing: 

Failed to initialize algorithm: Initialize(): System.ArgumentException: Type mismatch found between consolidator and indicator for symbol: AUDUSD.Consolidator outputs type QuoteBar but indicator expects input type IndicatorDataPoint

at QuantConnect.Algorithm.QCAlgorithm.RegisterIndicator[T] (QuantConnect.Symbol symbol, QuantConnect.Indicators.IndicatorBase`1[T] indicator, QuantConnect.Data.Consolidators.IDataConsolidator consolidator, System.Func`2[T,TResult] selector) [0x0008e] in <9d015e8128544942ac3d7f0163083f8a>:0
at QuantConnect.Algorithm.QCAlgorithm.RegisterIndicator[T] (QuantConnect.Symbol symbol, QuantConnect.Indicators.IndicatorBase`1[T] indicator, System.Nullable`1[T] resolution) [0x0000c] in <9d015e8128544942ac3d7f0163083f8a>:0
at QuantConnect.IndicatorSuiteAlgorithm.Initialize () [0x0009b] in <8456327b663245a88a1e5f9a761313ba>:0
at QuantConnect.Lean.Engine.Setup.BacktestingSetupHandler+<>c__DisplayClass19_0.<Setup>b__0 () [0x00053] in <29b0624db8054f0598885b2b53779267>:0

0

Could you please share a simple version of the algorithm?
I tried to reproduce it with these three lines of code, but I couldn't:

// In Initialize
SetStartDate(2017, 1, 1);
AddForex("EURUSD", Resolution.Minute);
_bb = BB("EURUSD", 20, 1, MovingAverageType.Simple);

Please use the "Attach Backtest" button below.
 

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.


Hi Alexandre Catarino. Thank you for your help! Please take a look at my code. What I am trying to do is to run the data on a resolution on a per minute basis. Also, I have modified the Bollinger Band to incorporate a more flexible upper and lower band system. Essentially my signals are based on the crossover of the MACD, as well as the use of Bollinger Band to long / short my trades. 

0


In order to register the custom indicator, please use the following:

var consolidator = new QuoteBarConsolidator(TimeSpan.FromMinutes(1));
RegisterIndicator(pair1, customBB, consolidator);

as you need to define the type of consolidator (QuoteBarConsolidator).
Also, please note that Forex security has quote bar data (bid and ask), so you need to change every part of the code that use TradeBar (the rolling window and the OnData overload). 

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.


Thank you for your help Alexandre Catarino

0

Hi Alexandre,



Thank you for your help thus far.



Could I understand how I could go abou to this, "Also, please note that

Forex security has quote bar data (bid and ask), so you need to change

every part of the code that use TradeBar (the rolling window and the OnData

overload). "?



I am relatively new to both quant trading and coding in C#. Would

definitely be helpful if you could help me edit, so I can use this for

future template.



Cheers,

Jefferson
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