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

PanagiotisCharalampous
10 Dec 2018, 10:43

Hi Mountain,

Thank you for posting in our forum. Can you please share the code for a cBot that reproduces the error so that we can have a look?

Best Regards,

Panagiotis


@PanagiotisCharalampous

PanagiotisCharalampous
10 Dec 2018, 10:31

Hi cantalupo,

We do not have such plans at the moment.

Best Regards,

Panagiotis


@PanagiotisCharalampous

PanagiotisCharalampous
10 Dec 2018, 10:29

Hi cantalupo,

There is no such option currently in cTrader. Objects are saved in workspaces for the charts they have been drawn onto but they cannot be transferred to other charts.

Best Regards,

Panagiotis


@PanagiotisCharalampous

PanagiotisCharalampous
07 Dec 2018, 16:17

Hi jam584St1,

FIX API should stream the exact same prices as cTrader applications. If you end up with different spot prices then probably you are doing something wrong. Can you please provide some more information why do you think you get different prices? If you could log a series of messages that you receive and result to different spot prices than cTrader it would be helpful to determine what is the problem. Also let us know the broker you use so that we can compare prices with cTrader. If it is more convenient to send the information with email, please email us at community@spotware.com

Best Regards,

Panagiotis


@PanagiotisCharalampous

PanagiotisCharalampous
07 Dec 2018, 15:11 ( Updated at: 21 Dec 2023, 09:21 )

Strange. I ran it on Spotware Beta 3.4 and works fine. See below

However I noticed that your cBot code has an issue and does not build. So I had to fix it. Can you make sure that you do not get any compilation errors and that you are using the latest version?

Best Regards,

Panagiotis


@PanagiotisCharalampous

PanagiotisCharalampous
07 Dec 2018, 14:34

Timeframes?


@PanagiotisCharalampous

PanagiotisCharalampous
07 Dec 2018, 14:17

Hi Derek,

Can you post a screenshot of the cBot parameters as well so that I can reproduce on backtesting?

Best Regards,

Panagiotis


@PanagiotisCharalampous

PanagiotisCharalampous
07 Dec 2018, 11:41

Hi netread2004,

You should be sending a Market Data Request whenever you want to update your market data with new prices. Refresh rate is up to you even though I believe 500ms is a bit slow. You can try 100ms.

Best Regards,

Panagiotis


@PanagiotisCharalampous

PanagiotisCharalampous
07 Dec 2018, 11:20

Hi dmn,

First of all I would like to thank you for all the feedback you have provided to us during the last days. I want to assure you that all feedback provided by the community is taken seriously into consideration. However you need to understand that changes cannot happen overnight for such large scale projects for many reasons, some of them listed below

  1. We have a huge user base, millions. Something that might make sense for one trader might not make for several others. We need to have that in mind and consider all the implications before making a change. The fact that several traders requested a feature or a change is not enough to proceed. Because there might be several more that might be affected negatively by the change. Therefore before deciding a change, we need to do our homework and this takes time.

  2. We have a huge To Do list and if you check our UserVoice forum, announcements and what’s new section you will notice that we prioritize and deliver. UserVoice is updated frequently, so you can check there on which features proposed by the community we are currently working on. Things not been done yet will always exist. If you notice, during the last year we have delivered major features on all the range of our applications, many of them requested by traders, and this fact proves that we listen.

  3. We are not a one-man-show company. We are a large organization with several departments, products and clients and there are decision making and development processes in place. One decision might affect more than one products and departments so coordination is required something that makes the process lengthtier.

I hope that you will give us enough time to meet your expectations.

Best Regards,

Panagiotis

 


@PanagiotisCharalampous

PanagiotisCharalampous
07 Dec 2018, 10:30

Hi Derek,

Can you share the full cBot code as well some steps to reproduce what you see? Maybe the problem is somewhere else.

Best Regards,

Panagiotis


@PanagiotisCharalampous

PanagiotisCharalampous
07 Dec 2018, 10:23 ( Updated at: 21 Dec 2023, 09:21 )

Hi Luigi,

A cBot is nothing less than a C# project. So if you edit it using Visual Studio you can have all the options available for a C# project. This means that you can have separate classes for reusable code. See below an example of calling a function of another class inside the cBot.

This way you can organize your code in a proper object oriented approach. Let me know if you need any additional assistance.

Best Regards,

Panagiotis


@PanagiotisCharalampous

PanagiotisCharalampous
07 Dec 2018, 10:14

Hi tgjobscv,

I modified the cBot to accept stop loss and take profit as parameters. See 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 SampleRSIcBot : Robot
    {
        [Parameter("Source")]
        public DataSeries Source { get; set; }

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

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

        [Parameter("Stop Loss", DefaultValue = 10, MinValue = 0.1, Step = 0.1)]
        public double StopLoss { get; set; }

        [Parameter("Take Profit", DefaultValue = 10, MinValue = 0.1, Step = 0.1)]
        public double TakeProfit { get; set; }

        private RelativeStrengthIndex rsi;

        protected override void OnStart()
        {
            rsi = Indicators.RelativeStrengthIndex(Source, Periods);
        }

        protected override void OnTick()
        {
            if (rsi.Result.LastValue < 20)
            {
                Close(TradeType.Sell);
                Open(TradeType.Buy);
            }
            else if (rsi.Result.LastValue > 70)
            {
                Close(TradeType.Buy);
                Open(TradeType.Sell);
            }
        }

        private void Close(TradeType tradeType)
        {
            foreach (var position in Positions.FindAll("SampleRSI", Symbol, tradeType))
                ClosePosition(position);
        }

        private void Open(TradeType tradeType)
        {
            var position = Positions.Find("SampleRSI", Symbol, tradeType);
            var volumeInUnits = Symbol.QuantityToVolume(Quantity);

            if (position == null)
                ExecuteMarketOrder(tradeType, Symbol, volumeInUnits, "SampleRSI", StopLoss, TakeProfit);
        }
    }
}

Best Regards,

Panagiotis


@PanagiotisCharalampous

PanagiotisCharalampous
07 Dec 2018, 10:07

Hi DelTrader,

I would suggest  the below approach

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

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

        MarketSeries _daySeries;
        DateTime _lastDayOpen;
        protected override void OnStart()
        {
            _daySeries = MarketData.GetSeries(TimeFrame.Daily);
            _lastDayOpen = _daySeries.OpenTime.LastValue;
        }

        protected override void OnTick()
        {
            if (_lastDayOpen != _daySeries.OpenTime.LastValue)
            {
                _lastDayOpen = _daySeries.OpenTime.LastValue;
                foreach (var _PendingOrders in PendingOrders)
                {
                    if (_PendingOrders.Label == Label)
                    {
                        Print("Cancel by time");
                        CancelPendingOrder(_PendingOrders);
                    }
                }
            }
        }

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

Best Regards,

Panagiotis


@PanagiotisCharalampous

PanagiotisCharalampous
06 Dec 2018, 17:23

Hi oliveira.phc,

There is no such possibility at the moment.

Best Regards,

Panagiotis


@PanagiotisCharalampous

PanagiotisCharalampous
06 Dec 2018, 14:59

Hi Dim13,

Thank you for posting in our forum. See below an example. 

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

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

        protected override void OnStart()
        {
            // Put your initialization logic here
        }

        protected override void OnTick()
        {
            if (EquityLevel > Account.Equity)
            {
                foreach (var position in Positions)
                {
                    position.Close();
                }
            }
        }

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

This cBot will close all positions as soon as the equity drops below the level set in the predefined parameter.

Best Regards,

Panagiotis


@PanagiotisCharalampous

PanagiotisCharalampous
06 Dec 2018, 10:51

Hi jam584St1,

Depending on the Market Data Request you will send (tag 264) you will be receiving either spot prices or the full depth of market. If you have subscribed for the full depth of market, then the highest bid and the lowest ask are the spot prices.

Best Regards,

Panagiotis


@PanagiotisCharalampous

PanagiotisCharalampous
06 Dec 2018, 10:00

Hi eirik_1993,

You can use Templates for this.

Best Regards,

Panagiotis


@PanagiotisCharalampous

PanagiotisCharalampous
06 Dec 2018, 09:42

Hi D D,

Can you please explain what do you mean? I cannot see any problem in the example.

Best Regards,

Panagiotis


@PanagiotisCharalampous

PanagiotisCharalampous
06 Dec 2018, 09:27

Hi eirik_1993,

There is no such option available at the moment. You can post your suggestion in the Suggestions section so that we can keep track of it.

Best Regards,

Panagiotis


@PanagiotisCharalampous

PanagiotisCharalampous
06 Dec 2018, 09:23

Hi tgjobscv,

I could not reproduce any problem with the login. Can you please post a screenshot?

Best Regards,

Panagiotis


@PanagiotisCharalampous