Topics
16 Nov 2023, 07:42
 1170
 1
15 Nov 2023, 10:36
 2069
 16
Replies

Spotware
30 Aug 2017, 11:55

Hi Alex,

Thanks for updating us. We are glad that the issue has been resolved.

Best Regards,

cTrader Team


@Spotware

Spotware
30 Aug 2017, 11:51

Hi Alex,

You can find example messages for all order types in the cTrader FIX Engine Rules of Engagement here. See page 21.

Best Regards,

cTrader Team

 

 


@Spotware

Spotware
30 Aug 2017, 11:26

Hi mindbreaker,

Thanks for your suggestions. Trading API was developed using Google Protocol Buffers protocol for performance reasons, since it is a lighter and faster protocol than JSON. Protocol Buffers is just a protocol and it is not binded to any programming language. Quoting Google below

"Protocol buffers are Google's language-neutral, platform-neutral, extensible mechanism for serializing structured data – think XML, but smaller, faster, and simpler. You define how you want your data to be structured once, then you can use special generated source code to easily write and read your structured data to and from a variety of data streams and using a variety of languages."

Google supports Protocol Buffers for many languages like C#, Java, C++, Go, Objective C, Python, JavaNano and Ruby with more languages coming. 

Currenlty, we do not have any plans offering Trading API through JSON. On the contrary, the next version of the API might feature a Protocol Buffers Accounts API that will offer significant performance improvements to Accounts API users.

Best Regards,

cTrader Team


@Spotware

Spotware
30 Aug 2017, 09:04

Hi hungtonydang,

See the below code sample demonstrating how to listen to the OnPositionsClosed event.

        protected override void OnStart()
        {            
            Positions.Closed += OnPositionsClosed;
        }

        void OnPositionsClosed(PositionClosedEventArgs obj)
        {
         
        }  

Best Regards,

cTrader Team


@Spotware

Spotware
30 Aug 2017, 09:00

Hi richard_alcaide,

You can use the Stop function to stop a robot.

Best Regards,

cTrader Team


@Spotware

Spotware
29 Aug 2017, 14:15

Hi mixzzz,

We have a dedicated section in the forum called Jobs. You can post your request for assistance there so that it becomes easier to professionals to see your post. Also, you can contact some of the Consultants specialized in cAlgo.

Best Regards,

cTrader Team


@Spotware

Spotware
29 Aug 2017, 08:55

Dear hiba7rain,

See a code sample below demonstrating how to get the entry price of the last trade.

var price = History.FindLast().EntryPrice;

Let us know if this is what you are looking for.

Best Regards,

cTrader Team


@Spotware

Spotware
28 Aug 2017, 17:23

Dear hiba7rain,

You can find this information in History which is a collection of Historical Trades

Best Regards,

cTrader Team


@Spotware

Spotware
28 Aug 2017, 16:14

Dear Tony,

Can you please post a cBot or at least a working section of the code which we can use to reproduce the problem, so that we can advise accordingly?

Best Regards,

cTrader Team


@Spotware

Spotware
28 Aug 2017, 14:53

RE: RE:

irmscher9 said:

Spotware said:

Hi irmscher9,

We will forward your suggestion to the product team for consideration.

Best Regards,

cTrader Team

Thanks. How may I track the response?

In case they decide to implement this feature, we will update this post and you will get notified.


@Spotware

Spotware
28 Aug 2017, 14:51

Hi irmscher9,

We will forward your suggestion to the product team for consideration.

Best Regards,

cTrader Team


@Spotware

Spotware
28 Aug 2017, 14:38

Hi irmscher9,

No this function is not supposed to work in backtesting.

Best Regards,

cTrader Team


@Spotware

Spotware
28 Aug 2017, 12:54

Dear trvago,

You can use indicators in a cBot by calling the different built-in indicators included in the Indicators namespace. See an example calling the Simple Moving Average indicator below

var sma = Indicators.SimpleMovingAverage(MarketSeries.Median,14);
var smaLastValue = sma.Result.LastValue;

You can also access custom indicators by following the steps described here.

Best Regards,

cTrader Team


@Spotware

Spotware
28 Aug 2017, 12:49

Dear irmscher9,

It works for cBots as well. See an example 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 NewcBot : Robot
    {
        [Parameter(DefaultValue = 0.0)]
        public double Parameter { get; set; }

        protected override void OnStart()
        {

        }

        protected override void OnBar()
        {
            ChartObjects.DrawText("Sample Text", "Sample Text", StaticPosition.Center);
        }

        protected override void OnStop()
        {
            
        }
    }
}

Best Regards,

cTrader Team


@Spotware

Spotware
28 Aug 2017, 12:31

Dear pavan.deshpande,

Thanks for bringing this into our attention. Tag 6 is optional in our execution report. Our FIX API Rules of Engagement states that it is required but this is wrong and will be updated soon. Is there a way to stop your FIX engine from complaining when this tag is missing?

Best Regards,

cTrader Team


@Spotware

Spotware
28 Aug 2017, 12:28

Dear bdfx,

Thanks for reporting this to us. We have forwarded the issue to the product teams of cTrader and cTrader Web to investigate why there is a discrepancy between the values of the two applications. We will keep you updated.

Regarding cAlgo, is it possible to get a sample cBot that reproduces the problem so that we can check that as well?

Best Regards,

cTrader Team


@Spotware

Spotware
28 Aug 2017, 10:57

Hi ales.sobotka@gmail.com,

Thanks for posting your issue in the forum. Do you mean that some data is missing or that the connection is interrupted? If the connection is interrupted, make sure that you are sending/receiving heartbeats to/from the server. 

Best Regards,

cTrader Team


@Spotware

Spotware
28 Aug 2017, 10:02

Dear hungtonydang,

Yes the variable needs to be declared. See a more complete example 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 NewcBot : Robot
    {
        private DateTime _lastExecutedOrder;

        protected override void OnStart()
        {
            ExecuteMarketOrder(TradeType.Buy, Symbol, 1000);
            _lastExecutedOrder = DateTime.Now;
        }

        protected override void OnBar()
        {
            if (_lastExecutedOrder.AddHours(24) < DateTime.Now)
            {
                ExecuteMarketOrder(TradeType.Buy, Symbol, 1000);
                _lastExecutedOrder = DateTime.Now;
            }
        }

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

Best Regards,

cTrader Team


@Spotware

Spotware
28 Aug 2017, 09:52

Dear alpha_austin,

In order to place an order in the same direction as a current position, you need to use the position's direction. See an example below.

            var position = Positions[0];
            ExecuteMarketOrder(position.TradeType, Symbol, 1000);

Let us know if the above answers your question.

Best Regards,

cTrader Team


@Spotware

Spotware
28 Aug 2017, 09:41

Dear irmscher9,

Check this example to see how to draw text on a chart. Let us know if this is helpful.

Best Regards,

cTrader Team

 


@Spotware