Replies

PanagiotisCharalampous
17 Sep 2018, 12:25

Hi Raefe,

Can you please tell me your broker and when did this happened?

Best Regards,

Panagiotis


@PanagiotisCharalampous

PanagiotisCharalampous
17 Sep 2018, 12:20

Hi behzad.arian,

You can reset your password here https://id.ctrader.com/reset

Best Regards,

Panagiotis


@PanagiotisCharalampous

PanagiotisCharalampous
17 Sep 2018, 12:14

Hi swingfish,

You cannot do this via the API. You will need to do the calculations in your cBot.

Best Regards,

Panagiotis


@PanagiotisCharalampous

PanagiotisCharalampous
11 Sep 2018, 10:37

Hi,

No, this information is not available via FIX.

Best Regards,

Panagiotis


@PanagiotisCharalampous

PanagiotisCharalampous
10 Sep 2018, 16:12

Hi Allan,

Symbol.PipSize represents the absolute size of each pip. For example, for EURUSD it is 0.0001. If the prize moves up by five pips then it has moved by 0.0005.

Best Regards,

Panagiotis


@PanagiotisCharalampous

PanagiotisCharalampous
10 Sep 2018, 15:40

Hi useretinv,

Here is how you can close all positions when a max has been reached

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 int MaxPositions { get; set; }

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

        protected override void OnTick()
        {
            if (Positions.Count > MaxPositions)
                foreach (var position in Positions)
                {
                    ClosePositionAsync(position);
                }            
        }

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

Best Regards,

Panagiotis


@PanagiotisCharalampous

PanagiotisCharalampous
10 Sep 2018, 15:18

Hi useretinv,


In this forum we are trying to help programmers to use cTrader and cAlgo by addressing questions related to the API and the usage of the platform and by providing suggestions in development questions.

If you wish me to provide a sample on how to do what you have asked and then adjust the code yourself, I am more than happy to do so.

But understanding what a 300 lines cBot does and making the change you request is a task that could take some hours and can be considered custom development service. In this case, you should contact a professional.

Let me know if want me to provide you with a code sample.

Best Regards,
Panagiotis

 


@PanagiotisCharalampous

PanagiotisCharalampous
10 Sep 2018, 10:08

Hi useretinv,

As I proposed in another post, you can post a job or hire a professional consultant.

Best Regards,

Panagiotis


@PanagiotisCharalampous

PanagiotisCharalampous
10 Sep 2018, 10:06

Hi useretinv,

Unfortunately I cannot engage in custom development requests. If you want somebody to help you with developing your cBot, you can post a job or hire a professional consultant.

Best Regards,

Panagiotis


@PanagiotisCharalampous

PanagiotisCharalampous
10 Sep 2018, 09:53

Hi procumulative@gmail.com,

I will send you an email soon.

Best Regards,

Panagiotis


@PanagiotisCharalampous

PanagiotisCharalampous
10 Sep 2018, 09:53

Hi procumulative@gmail.com,

For which feature of all that you have proposed are you talking about?

Best Regards,

Panagiotis


@PanagiotisCharalampous

PanagiotisCharalampous
10 Sep 2018, 09:45

Dear Trader,

Your message does not seem to follow our rules of engagement. Tags are missing while not defined tags are sent. You can find the rules of engagement here and an example New Order Single message below

8=FIX.4.4|9=143|35=D|49=theBroker.12345|56=CSERVER|34=77|52=20170117-
10:02:14|50=any_string|57=TRADE|11=876316397|55=1|54=1|60=20170117-
10:02:14|40=1|38=10000|10=010|

Best Regards,

Panagiotis


@PanagiotisCharalampous

PanagiotisCharalampous
07 Sep 2018, 10:26

Hi swingfish,

"thanks for the reply, for some reason cTrader 3.0 and 3.01 do not have the Positions.Average call ". 

This is not part of cTrader but of .Net. As i said you need to use System.Linq library.

Best Regards,

Panagiotis


@PanagiotisCharalampous

PanagiotisCharalampous
07 Sep 2018, 10:24

Hi alidarvish64@yahoo.com,

It is not clear to me what is the problem

  1. Was the NoMoney issue solved?
  2. What do you expect from the cBot to do? In order to help you, I need to know what is the cBot supposed to do and what it does instead.

Best Regards,

Panagiotis


@PanagiotisCharalampous

PanagiotisCharalampous
07 Sep 2018, 10:18

Hi cerradus@gmail.com,

Thanks for posting in our forum. Your conditions for checking the distance are wrong. If you want to check the distance between entry price and current price, you should use something like the below

(Symbol.Bid - posi.EntryPrice) / Symbol.PipSize > Distance

Best Regards,

Panagiotis


@PanagiotisCharalampous

PanagiotisCharalampous
07 Sep 2018, 10:01

Hi Waxy,

I agree that this is helpful and we will try to implement a similar reporting of cTrader products release notes soon.

Best Regards,

Panagiotis


@PanagiotisCharalampous

PanagiotisCharalampous
07 Sep 2018, 09:50

Hi swingfish,

You can easily calculate this information. For example

Positions.Average(x => x.Pips);

Note that you need to add a reference to System.Linq to your indicator

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

Best Regards,

Panagiotis


@PanagiotisCharalampous

PanagiotisCharalampous
07 Sep 2018, 09:39

Hi alidarvish64@yahoo.com,

The error message indicates that there is not enough money in your account to trade. From a brief view in your logic, it seems that you are opening several positions in OnTick() without any check if the position has already been opened. This is also visible in the log you attached. I would suggest to revisit your logic. Probably you should use OnBar() instead of OnTick().

Best Regards

Panagiotis

 


@PanagiotisCharalampous

PanagiotisCharalampous
06 Sep 2018, 17:02

Hi swingfish,

You dont need to make a loop. just keep the code outside the if-else statement at the botton of the calculate funtion. See below

 if (CurrentDay == oldCurrentDay)
            {
                double sum = 0.0;
                for (int i = start_bar; i <= end_bar; i++)
                {
                    sum += MarketSeries.Close[i];
                    VWAP[i] = TotalPV / TotalVolume;
                    for (int k = start_bar; k <= i; k++)
                    {
                        double HLC = (MarketSeries.High[k] + MarketSeries.Low[k] + MarketSeries.Close[k]) / 3;
                        double OHLC = (MarketSeries.High[k] + MarketSeries.Low[k] + MarketSeries.Open[k] + MarketSeries.Close[k]) / 4;
                        double avg = HLC;
                        double diff = avg - VWAP[i];
                    }

                    // cut vwap short



                }
            }
            else
            {
                oldCurrentDay = MarketSeries.OpenTime[end_bar].DayOfYear;
                start_bar = end_bar - TimeOffset;
            }
            if (!ShowHistoricalvWap)
            {
                if (i < index - 15)
                {
                    VWAP[i] = double.NaN;
                }
                // this does not work (supposed to delete the old days data
            }

Best Regards,

Panagiotis


@PanagiotisCharalampous

PanagiotisCharalampous
06 Sep 2018, 16:34

Hi useretinv,

You can use the code below


            if (position.GrossProfit > 0)
            {
                ExecuteOrder(InitialQuantity, GetRandomTradeType());
            }
            else
            {
                if (position.TradeType == TradeType.Buy)
                    ExecuteOrder(position.Quantity * 2, TradeType.Sell);
                else
                    ExecuteOrder(position.Quantity * 2, TradeType.Buy);
            }

Best Regards,

Panagiotis


@PanagiotisCharalampous