Replies

PanagiotisCharalampous
06 Oct 2020, 07:39

Hi jayteasuk,

I am not sure what do you mean. Can you please elaborate?

Best Regards,

Panagiotis 

Join us on Telegram


@PanagiotisCharalampous

PanagiotisCharalampous
06 Oct 2020, 07:37

Hi AlgoMaster,

Can you please provide us with the cBot code and parameters file?

Best Regards,

Panagiotis 

Join us on Telegram


@PanagiotisCharalampous

PanagiotisCharalampous
06 Oct 2020, 07:36

Hi Luca,

You need to check if the stop loss was modified again before or not before modifying it. You can use some flags for this.

Best Regards,

Panagiotis 

Join us on Telegram


@PanagiotisCharalampous

PanagiotisCharalampous
05 Oct 2020, 16:51

Hi Tengu,

No there is no such option.

Best Regards,

Panagiotis 

Join us on Telegram


@PanagiotisCharalampous

PanagiotisCharalampous
05 Oct 2020, 14:43

Hi Luca,

Use ModifyTrailingStop.

Best Regards,

Panagiotis 

Join us on Telegram


@PanagiotisCharalampous

PanagiotisCharalampous
05 Oct 2020, 12:38

Hi tradinginsider,

Please send us the application you have downloaded and trying to execute at community@spotware.com so that we can investigate further.

Best Regards,

Panagiotis 

Join us on Telegram


@PanagiotisCharalampous

PanagiotisCharalampous
05 Oct 2020, 10:06

Hi Jay3ast,

Sorry I did not notice that you were referring to cTrader Web. This is available only on the desktop version.

Best Regards,

 

Panagiotis 

Join us on Telegram


@PanagiotisCharalampous

PanagiotisCharalampous
05 Oct 2020, 09:54

Hi herofus,

Here you go

Indicator Code

using System;
using cAlgo.API;
using cAlgo.API.Internals;


namespace cAlgo.Indicators
{
    [Indicator(IsOverlay = true, AccessRights = AccessRights.None)]
    public class ZigZag : Indicator
    {

        [Parameter(DefaultValue = 12)]
        public int Depth { get; set; }

        [Parameter(DefaultValue = 5)]
        public int Deviation { get; set; }

        [Parameter(DefaultValue = 3)]
        public int BackStep { get; set; }

        [Output("ZigZag", Color = Colors.OrangeRed)]
        public IndicatorDataSeries Result { get; set; }

        #region Private fields

        private double _lastLow;
        private double _lastHigh;
        private double _low;
        private double _high;
        private int _lastHighIndex;
        private int _lastLowIndex;
        private int _type;
        private double _point;
        private double _currentLow;
        private double _currentHigh;

        public IndicatorDataSeries HighZigZags;
        public IndicatorDataSeries LowZigZags;

        #endregion

        protected override void Initialize()
        {
            HighZigZags = CreateDataSeries();
            LowZigZags = CreateDataSeries();
            _point = Symbol.PointSize;
        }

        public override void Calculate(int index)
        {

            if (index < Depth)
            {
                Result[index] = 0;
                HighZigZags[index] = 0;
                LowZigZags[index] = 0;
                return;
            }

            _currentLow = Functions.Minimum(MarketSeries.Low, Depth);
            if (Math.Abs(_currentLow - _lastLow) < double.Epsilon)
                _currentLow = 0.0;
            else
            {
                _lastLow = _currentLow;

                if ((MarketSeries.Low[index] - _currentLow) > (Deviation * _point))
                    _currentLow = 0.0;
                else
                {
                    for (int i = 1; i <= BackStep; i++)
                    {
                        if (Math.Abs(LowZigZags[index - i]) > double.Epsilon && LowZigZags[index - i] > _currentLow)
                            LowZigZags[index - i] = 0.0;
                    }
                }
            }
            if (Math.Abs(MarketSeries.Low[index] - _currentLow) < double.Epsilon)
                LowZigZags[index] = _currentLow;
            else
                LowZigZags[index] = 0.0;

            _currentHigh = MarketSeries.High.Maximum(Depth);

            if (Math.Abs(_currentHigh - _lastHigh) < double.Epsilon)
                _currentHigh = 0.0;
            else
            {
                _lastHigh = _currentHigh;

                if ((_currentHigh - MarketSeries.High[index]) > (Deviation * _point))
                    _currentHigh = 0.0;
                else
                {
                    for (int i = 1; i <= BackStep; i++)
                    {
                        if (Math.Abs(HighZigZags[index - i]) > double.Epsilon && HighZigZags[index - i] < _currentHigh)
                            HighZigZags[index - i] = 0.0;
                    }
                }
            }

            if (Math.Abs(MarketSeries.High[index] - _currentHigh) < double.Epsilon)
                HighZigZags[index] = _currentHigh;
            else
                HighZigZags[index] = 0.0;


            switch (_type)
            {
                case 0:
                    if (Math.Abs(_low - 0) < double.Epsilon && Math.Abs(_high - 0) < double.Epsilon)
                    {
                        if (Math.Abs(HighZigZags[index]) > double.Epsilon)
                        {
                            _high = MarketSeries.High[index];
                            _lastHighIndex = index;
                            _type = -1;
                            Result[index] = _high;
                        }
                        if (Math.Abs(LowZigZags[index]) > double.Epsilon)
                        {
                            _low = MarketSeries.Low[index];
                            _lastLowIndex = index;
                            _type = 1;
                            Result[index] = _low;
                        }
                    }
                    break;
                case 1:
                    if (Math.Abs(LowZigZags[index]) > double.Epsilon && LowZigZags[index] < _low && Math.Abs(HighZigZags[index] - 0.0) < double.Epsilon)
                    {
                        Result[_lastLowIndex] = double.NaN;
                        _lastLowIndex = index;
                        _low = LowZigZags[index];
                        Result[index] = _low;
                    }
                    if (Math.Abs(HighZigZags[index] - 0.0) > double.Epsilon && Math.Abs(LowZigZags[index] - 0.0) < double.Epsilon)
                    {
                        _high = HighZigZags[index];
                        _lastHighIndex = index;
                        Result[index] = _high;
                        _type = -1;
                    }
                    break;
                case -1:
                    if (Math.Abs(HighZigZags[index]) > double.Epsilon && HighZigZags[index] > _high && Math.Abs(LowZigZags[index] - 0.0) < double.Epsilon)
                    {
                        Result[_lastHighIndex] = double.NaN;
                        _lastHighIndex = index;
                        _high = HighZigZags[index];
                        Result[index] = _high;
                    }
                    if (Math.Abs(LowZigZags[index]) > double.Epsilon && Math.Abs(HighZigZags[index]) <= double.Epsilon)
                    {
                        _low = LowZigZags[index];
                        _lastLowIndex = index;
                        Result[index] = _low;
                        _type = 1;
                    }
                    break;
                default:
                    return;
            }

        }
    }
}

cBot code

using cAlgo.API;
using cAlgo.Indicators;

namespace cAlgo.Robots
{
    [Robot(TimeZone = TimeZones.UTC, AccessRights = AccessRights.None)]
    public class NewcBot : Robot
    {
        [Parameter(DefaultValue = 12)]
        public int Depth { get; set; }

        [Parameter(DefaultValue = 5)]
        public int Deviation { get; set; }

        [Parameter(DefaultValue = 3)]
        public int BackStep { get; set; }

        private ZigZag _zigzag;

        protected override void OnStart()
        {
            _zigzag = Indicators.GetIndicator<ZigZag>(Depth, Deviation, BackStep);
        }

        protected override void OnBar()
        {
            var result = _zigzag.Result.Last(1);
            Print("High: " + _zigzag.HighZigZags.Last(1));
            Print("Low: " + _zigzag.LowZigZags.LastValue);
        }

        protected override void OnStop()
        {
            // Put your deinitialization logic here
        }
    }
}

Best Regards,

Panagiotis 

Join us on Telegram


@PanagiotisCharalampous

PanagiotisCharalampous
05 Oct 2020, 09:00

Hi tradinginsider,

Please try a clean installation of cTrader and let us know if it resolves the problem.

Best Regards,

Panagiotis 

Join us on Telegram


@PanagiotisCharalampous

PanagiotisCharalampous
05 Oct 2020, 08:45

Hi arthur.albert990,

You need to use a DiscontinuousLine plot type.

Best Regards,

Panagiotis 

Join us on Telegram


@PanagiotisCharalampous

PanagiotisCharalampous
05 Oct 2020, 08:42

Hi caglar_G,

There is no fixed time span between ticks.

Best Regards,

Panagiotis 

Join us on Telegram


@PanagiotisCharalampous

PanagiotisCharalampous
05 Oct 2020, 08:39

Hi keno.clayton15,

From what I read is probably not an error but a normal and expected behavior in a live trading environment. Your workaround is probably not just a workaround but the correct way to implement the functionality. I will not bother the devs if I don't confirm it is a bug. If you still want me to have a look, send the code and steps to reproduce the behavior at community@spotware.com.

Best Regards,

Panagiotis 

Join us on Telegram


@PanagiotisCharalampous

PanagiotisCharalampous
05 Oct 2020, 08:32

Hi Luca,

Here is the correct way to do this

                if (longPosition.Pips >= 50)
                    ModifyPosition(longPosition, longPosition.EntryPrice + Symbol.PipSize * 30, longPosition.TakeProfit);

Best Regards,

Panagiotis 

Join us on Telegram


@PanagiotisCharalampous

PanagiotisCharalampous
05 Oct 2020, 08:24

Hi Jay3ast,

You can drag SL/TP levels in the Create Order form as well. See below

Best Regards,

Panagiotis 

Join us on Telegram


@PanagiotisCharalampous

PanagiotisCharalampous
05 Oct 2020, 08:21

Hi keno.clayton15,

Please provide the complete cBot code and steps to reproduce the problem.

Best Regards,

Panagiotis 

Join us on Telegram


@PanagiotisCharalampous

PanagiotisCharalampous
05 Oct 2020, 08:18

Hi edilsonpaca7,

Thanks for your suggestions. More filtering features will be added in future versions of the application.

Best Regards,

Panagiotis 

Join us on Telegram


@PanagiotisCharalampous

PanagiotisCharalampous
05 Oct 2020, 08:15

Hi ctid2520246,

Are you running any custom indicators/cBots? Do you have any objects drawn on the chart? If yes, please remove them and try again. If no, please send us some troubleshooting information. To do so, please press Ctrl+Alt+Shift+T fro the troubleshooting form, paste a link to this discussion in the text box and press submit.

Best Regards,

Panagiotis 

Join us on Telegram


@PanagiotisCharalampous

PanagiotisCharalampous
05 Oct 2020, 08:07

Hi Luca,

The information you need to access in not accessible from this indicator. You need to make the information accessibe e.g. through a public property, and then access it from the cBot.

Best Regards,

Panagiotis 

Join us on Telegram


@PanagiotisCharalampous

PanagiotisCharalampous
05 Oct 2020, 08:05

Hi Massimo,

There are no restrictions on how you can use these objects. You can pass these objects to other classes as parameters.

Best Regards,

Panagiotis 

Join us on Telegram


@PanagiotisCharalampous

PanagiotisCharalampous
05 Oct 2020, 07:58

Hi jayteasuk,

The sandbox environment is not supported anymore. Please use the production environment i.e. https://api.spotware.com/

Best Regards,

Panagiotis 

Join us on Telegram


@PanagiotisCharalampous