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

Spotware
27 Jul 2017, 14:39

Hi obaum1,

Connect API does not offer this function. However, normalization requires a simple function like the following

 normalizedVolume = ((int)(volume / step) * step);

The Symbol's step is provided by the Accounts API. You can get it using  the following request

https://sandbox-api.spotware.com/connect/tradingaccounts/89214/symbols?oauth_token=test002_access_token 

Based on your needs you can replace (int) with Math.Floor() or Math.Ceiling(). You can also add conditions for minimum and maximum quantity.

Best Regards,

cTrader Team


@Spotware

Spotware
27 Jul 2017, 10:30

Dear rayscluster,

Thanks for posting your suggestion in the forum. We will forward it to the relevant product team for consideration.

Best Regards,

cTrader Team


@Spotware

Spotware
27 Jul 2017, 10:28

Dear theonlinemick,

Thanks for your post. You can try something like the following

 protected override void OnTick()
        {

            foreach (var order in PendingOrders)
            {
                var pipDistance = Math.Abs((order.TargetPrice - Symbol.Ask) / Symbol.PipValue);
                if (pipDistance > MaxPipDistance)
                {
                    CancelPendingOrder(order);
                }
            }
        }

You can ajdust the price you will consider (Symbol.Ask or Symbol.Bid) based on your order's direction.

Best Regards,

cTrader Team


@Spotware

Spotware
27 Jul 2017, 09:15

Hi MagicTurtle,

Please send your code at community@spotware.com. We will have a look at it and come back to you.

Best Regards,

cTrader Team


@Spotware

Spotware
26 Jul 2017, 15:03

Dear Trader,

Thanks for sending us your suggestion list. We will pass your suggestions to the relevant product teams for consideration.

Best Regards,

cTrader Team


@Spotware

Spotware
26 Jul 2017, 14:39

Hi,

Can you please remove it and try to add it again manually? Please follow the steps below

  1. Go to References.
  2. Select Connect API Library and press Delete.
  3. Right click on References.
  4. Select Add Reference
  5. Select Projects
  6. Select Connect API Library
  7. Press OK
  8. Try to build again

Let us know if the above fixes the problem

Best Regards,

cTrader Team


@Spotware

Spotware
26 Jul 2017, 14:30

Hi GT_Hero,

This feature is planned for development. It should be a part of the next major update of cAlgo. We expect this release in the upcoming months. We will let you know as soon as this happens.

Best Regards,

cTrader Team


@Spotware

Spotware
26 Jul 2017, 14:24 ( Updated at: 21 Dec 2023, 09:20 )

Hi again,

Can you please check if the Connect API Library project is referenced properly? Please expand the References section of Connect API Web and verify that the reference exists and doesn't have any issues. You should see the following

 

In case there is an issue e.g. a yellow sign, try to add the reference again manually.

Best Regards,

cTrader Team


@Spotware

Spotware
26 Jul 2017, 14:09 ( Updated at: 21 Dec 2023, 09:20 )

Dear Trader,

Thanks for posting your question in the forum. It seems that you are using the Connect API Web Example. The code for the missing libraries is located in a separate project within the same solution.

Have you downloaded both projects from GitHub? If you open the solution, it will contain both projects and you will be able to build without problems.

Best Regards,

cTrader Team

 


@Spotware

Spotware
26 Jul 2017, 09:41

Dear MagicTurtle,

We cannot see anything wrong in the provided code sample. Can we have a sample cBot as well trading conditions (Symbol, Timeframe) that we can use to reproduce the message? If we can reproduce the message we would be able to give you some advice. It doesn't need to be your cBot but just a cBot that reproduces the message.

Best Regards,

cTrader Team


@Spotware

Spotware
26 Jul 2017, 09:27

Dear wlife7380,

We have received your email and your issue has been forwarded to the support team. You will be contacted by email as soon as a solution to your problem is available.

Best Regards,

cTrader Team


@Spotware

Spotware
26 Jul 2017, 09:23

Dear Trader,

Here is the code for the cBot

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 CloseAllPositions : Robot
    {
        [Parameter(DefaultValue = 0.0)]
        public double Parameter { get; set; }

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

        protected override void OnTick()
        {
            if (DateTime.Now.Hour == 8 && DateTime.Now.Minute == 0)
                foreach (var position in Positions)
                {
                    ClosePosition(position);
                }
        }

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

Best Regards,

cTrader Team


@Spotware

Spotware
25 Jul 2017, 18:02

Dear danielpcas3,

Thanks for posting your suggestion. We have forwarded it to the relevant product team for consideration.

Best Regards,

cTradet Team


@Spotware

Spotware
25 Jul 2017, 18:01

Dear Bbshstu,

Renko charts are currently under development. We cannot provide a delivery date but they will be included in one of the next updates of cTrader.

Best Regards,

cTrader Team


@Spotware

Spotware
25 Jul 2017, 17:41

Dear Traders,

This issue is known to the cAlgo team and it is planned to be resolved in the next major release of cTrader. We will update you about this release soon.

Best Regards,

cTrader Team


@Spotware

Spotware
25 Jul 2017, 16:39

Hi GammaQuant,

In your first sample you should modify your PrintInMainRobot() as follows

 public void PrintInMainRobot(Printer algo)
 {
        algo.MainPrinter();
 }

Hope this helps.

Best Regards,

cTrader Team


@Spotware

Spotware
25 Jul 2017, 16:09

Hi andi21,

Thanks for bringing this up. We will check the status of this issue with the product team and update the thread soon.

Best Regards,

cTrader Team


@Spotware

Spotware
25 Jul 2017, 14:51

Dear Trader,

You can try something like this

   if (DateTime.Now.Hour == 8 && DateTime.Now.Minute == 0)
                foreach (var position in Positions)
                {
                    ClosePosition(position);
                }

You can adjust the if statement based on your needs.

Best Regards,

cTrader Team


@Spotware

Spotware
25 Jul 2017, 10:40

Dear acrigney,

Thanks for posting your question in the forum. We tried to run your cBot but the build fails with 11 errors. Community members will probably not spend their time fixing the cBot. You will increase your chances of getting an answer if you provide a cBot that is working and make your questions more specific. For example, you say that you don't get valid numbers for the indicators. What numbers do you get and what would you expect to get?

If you could provide us with a working cBot as well as some numbers that you think are not valid, we would be more than happy to have a look at it.

Best Regards,

cTrader Team


@Spotware

Spotware
25 Jul 2017, 10:20

Hi GammaQuant,

There isn't any obvious issue in your code, so maybe you could try debugging your cBot in VS and add a try/catch around your POnBar() initialization code, like below, and check what is going wrong

            try
            {
                var price = algo.MarketSeries.Open.LastValue;
                algo.Print("Hello World - Bar Open Price {0}", price);
                PrintInMainRobot();
            }
            catch
            {

            }

Let us know if the above helps

Best Regards,

cTrader Team


@Spotware