PanagiotisCharalampous's avatar
PanagiotisCharalampous
26 follower(s) 0 following 1006 subscription(s)
Replies

PanagiotisCharalampous
26 Sep 2019, 08:22

Hi NyanHtet,

Thanks for posting in our forum. See the modified code below

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

namespace cAlgo
{
    [Robot(TimeZone = TimeZones.UTC, AccessRights = AccessRights.None)]
    public class SampleBreakoutcBot : Robot
    {
        [Parameter("Source")]
        public DataSeries Source { get; set; }

        [Parameter("Band Height (pips)", DefaultValue = 40.0, MinValue = 0)]
        public double BandHeightPips { get; set; }

        [Parameter("Stop Loss (pips)", DefaultValue = 20, MinValue = 1)]
        public int StopLossInPips { get; set; }

        [Parameter("Take Profit (pips)", DefaultValue = 40, MinValue = 1)]
        public int TakeProfitInPips { get; set; }

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

        [Parameter("Bollinger Bands Deviations", DefaultValue = 2)]
        public double Deviations { get; set; }

        [Parameter("Bollinger Bands Periods", DefaultValue = 20)]
        public int Periods { get; set; }

        [Parameter("Bollinger Bands MA Type")]
        public MovingAverageType MAType { get; set; }

        [Parameter("Consolidation Periods", DefaultValue = 2)]
        public int ConsolidationPeriods { get; set; }

        BollingerBands bollingerBands;
        string label = "Sample Breakout cBot";
        int consolidation;
        private Position position;
        protected override void OnStart()
        {
            bollingerBands = Indicators.BollingerBands(Source, Periods, Deviations, MAType);
            Positions.Opened += OnPositionsOpened;
            Positions.Closed += OnPositionsClosed;
        }

        void OnPositionsClosed(PositionClosedEventArgs obj)
        {
            position = null;
        }

        void OnPositionsOpened(PositionOpenedEventArgs obj)
        {
            position = obj.Position;
        }

        protected override void OnBar()
        {
            if (position != null)
                return;
            var top = bollingerBands.Top.Last(1);
            var bottom = bollingerBands.Bottom.Last(1);

            if (top - bottom <= BandHeightPips * Symbol.PipSize)
            {
                consolidation = consolidation + 1;
            }
            else
            {
                consolidation = 0;
            }

            if (consolidation >= ConsolidationPeriods)
            {
                var volumeInUnits = Symbol.QuantityToVolume(Quantity);
                if (Symbol.Ask > top)
                {
                    ExecuteMarketOrder(TradeType.Buy, Symbol, volumeInUnits, label, StopLossInPips, TakeProfitInPips);

                    consolidation = 0;
                }
                else if (Symbol.Bid < bottom)
                {
                    ExecuteMarketOrder(TradeType.Sell, Symbol, volumeInUnits, label, StopLossInPips, TakeProfitInPips);

                    consolidation = 0;
                }
            }
        }
    }
}

Best Regards,

Panagiotis


@PanagiotisCharalampous

PanagiotisCharalampous
26 Sep 2019, 08:15

Hi terminalclub,

Thanks for posting in our forum. You can use chart templates to save different settings for your indicator.

Best Regards,

Panagiotis


@PanagiotisCharalampous

PanagiotisCharalampous
25 Sep 2019, 16:37

Hi Peter,

Thanks for posting in our forum. You can find many reasons for differences between your account and your strategy provider's account in our EULA. Check section 11.1 II. If you need more info about what happened with your account, please talk to your broker.

Best Regards,

Panagiotis


@PanagiotisCharalampous

PanagiotisCharalampous
24 Sep 2019, 12:02

Hi ctid1502205,

The development has actually started so I have updated the status.

Best Regards,

Panagiotis


@PanagiotisCharalampous

PanagiotisCharalampous
24 Sep 2019, 11:17

Hi ctid1502205,

Thanks for posting in our forum. There is no planned date for this feature. It will be released to production whenever it is ready.

Best Regards,

Panagiotis


@PanagiotisCharalampous

PanagiotisCharalampous
24 Sep 2019, 08:25

Hi calgodemo,

Can you share the indicator code? All indicators are calculated for all data available on the chart so "back calculate" mechanism you are looking for is there by design.

Best Regards,

Panagiotis


@PanagiotisCharalampous

PanagiotisCharalampous
24 Sep 2019, 08:22

Hi Wiktor,

Do you send heartbeats to keep the connection alive?

Best Regards,

Panagiotis


@PanagiotisCharalampous

PanagiotisCharalampous
24 Sep 2019, 08:20

Hi dbmakepeace,

Thanks for posting in our forum. I am not aware if any community member has already done this but it should not be difficult to be coded into an indicator/cbot.

Best Regards,

Panagiotis


@PanagiotisCharalampous

PanagiotisCharalampous
24 Sep 2019, 08:18

Hi to both,

We have plans to introduce a more comprehensive way of managing chart objects in future versions. At the moment, we are considering appropriate solutions.

Best Regards,

Panagiotis


@PanagiotisCharalampous

PanagiotisCharalampous
23 Sep 2019, 16:32

Hi Ben,

Can you provide the exact steps you are following so that we can reproduce the problem? Also what is the bug you get when creating a custom watchlist?

Best Regards,

Panagiotis


@PanagiotisCharalampous

PanagiotisCharalampous
23 Sep 2019, 15:51

Hi Ben,

By design objects that are drawn on a chart, they are kept if you change a symbol. Therefore if you need to have a clean chart for a new symbol, you need to open a new chart.

Best Regards,

Panagiotis


@PanagiotisCharalampous

PanagiotisCharalampous
23 Sep 2019, 15:43

Hi Ben,

Are there any specific steps for us to reproduce this behavior or does this happen randomly?

Best Regards,

Panagiotis


@PanagiotisCharalampous

PanagiotisCharalampous
23 Sep 2019, 10:41

Hi Patrick,

Can you help us reproduce this behavior? We will need the cBot, the broker and the dates you are backtesting. To make a guess, this is probably an issue with backtesting data.

Best Regards,

Panagiotis


@PanagiotisCharalampous

PanagiotisCharalampous
23 Sep 2019, 09:04

Hi ryanoia@gmail.com,

To do so you will first need to calculate the required margin of a new position. This thead might give you some guidance.

Best Regards,

Panagiotis


@PanagiotisCharalampous

PanagiotisCharalampous
23 Sep 2019, 09:00

Hi FireMyst,

There is no such functionality planned for the upcoming releases. However we can consider adding this in a future release.

Best Regards,

Panagiotis


@PanagiotisCharalampous

PanagiotisCharalampous
23 Sep 2019, 08:57

Hi Jimmy,

There is no built in way to do so, you will need to develop your own manual strategy tester cBot or use a commercial one as the one Ahmad proposed above.

Best Regards,

Panagiotis


@PanagiotisCharalampous

PanagiotisCharalampous
23 Sep 2019, 08:55

Hi ciripa,

3.6 is currently in Beta. Brokers will be updated soon.

Best Regards,

Panagiotis


@PanagiotisCharalampous

PanagiotisCharalampous
23 Sep 2019, 08:54

Hi ctid1551761,

Thanks for posting in our forum. This behavior is by design. If you need a clean chart for a new symbol, just open a new chart.

Best Regards,

Panagiotis


@PanagiotisCharalampous

PanagiotisCharalampous
23 Sep 2019, 08:50

Hi Pedro,

No you cannot but I do not see the need. You can have a global variable for this.

Best Regards,

Panagiotis


@PanagiotisCharalampous

PanagiotisCharalampous
23 Sep 2019, 08:48

Hi BullittTraders,

Development is in progress but we do not have at ETA unfortunately.

Best Regards,

Panagiotis


@PanagiotisCharalampous