Bollinger bands error

Created at 11 Jun 2020, 12:36
How’s your experience with the cTrader Platform?
Your feedback is crucial to cTrader's development. Please take a few seconds to share your opinion and help us improve your trading experience. Thanks!
LU

luca.tocchi

Joined 25.03.2020

Bollinger bands error
11 Jun 2020, 12:36


it gives me errors on the bollinger band indicator

How can I solve the problem?

 

 

 

using System;
using System.Linq;
using cAlgo.API;
using cAlgo.API.Indicators;
using cAlgo.API.Internals;
using cAlgo.Indicators;
using System.Threading;

namespace cAlgo.Robots
{
    [Robot(TimeZone = TimeZones.UTC, AccessRights = AccessRights.None)]
    public class ichimokubot : Robot
    {

        [Parameter("Volume (Lots)", Group = "Volume", DefaultValue = 0.2, MinValue = 0.01, Step = 0.01)]
        public double Volume { get; set; }

        [Parameter("Stop Loss", DefaultValue = 200)]
        public double StopLoss { get; set; }

        [Parameter("Trigger When Gaining", DefaultValue = 2)]
        public double TriggerWhenGaining { get; set; }

        [Parameter("Trailing Stop Loss Distance", DefaultValue = 190)]
        public double TrailingStopLossDistance { get; set; }

        private double _highestGain;
        private bool _isTrailing;

        private Random random = new Random();
        private RelativeStrengthIndex Rsi;
        private BollingerBands BB;
        Symbol _symbol;

        protected override void OnStart()
        {
            Inizio:
            RefreshData();

            string EURUSD = Symbols[random.Next(Symbols.Count)];
            Symbols.GetSymbol("EURUSD");
            Print(EURUSD);

            var symbol = MarketData.GetSymbol(EURUSD);

            _symbol = Symbols.GetSymbol(EURUSD);

            var EURUSDSeries = MarketData.GetBars(TimeFrame.Hour, EURUSD);
            var volumeInUnits = symbol.QuantityToVolumeInUnits(Volume);

            Rsi = Indicators.RelativeStrengthIndex(MarketData.GetBars(TimeFrame.Hour, EURUSD), 20);
            BB = Indicators.BollingerBands(MarketData.GetBars(TimeFrame.Hour, EURUSD), 50, 3, MovingAverageType.Simple);

 

thanks


@luca.tocchi
Replies

PanagiotisCharalampous
11 Jun 2020, 12:58

Hi Luca,

The cBot code is not complete. Please post the complete cBot code.

Best Regards,

Panagiotis 

Join us on Telegram

 


@PanagiotisCharalampous

luca.tocchi
11 Jun 2020, 13:12

RE:

ok solved






 


@luca.tocchi