Topics
03 Jul 2015, 12:05
 0
 2284
 2
12 May 2015, 10:44
 2835
 3
28 Apr 2015, 16:57
 2291
 2
13 Apr 2015, 17:07
 3141
 4
10 Dec 2014, 12:13
 0
 2264
 4
11 Oct 2014, 11:04
 3383
 1
16 Sep 2014, 11:36
 0
 3688
 1
11 Sep 2014, 12:43
 0
 3090
 5
Replies

Forex19
30 May 2015, 00:48

RE:

Spotware said:

cAlgo API doesn't contain such methods. We plan to add them in the future.

After about a year, contain cAlgo API such methods?

These two functions are present for some time with the buttons on screen.
It would be very useful to manage them by API.


@Forex19

Forex19
13 May 2015, 18:10

RE:

Hi, now I try it.
To close the 1a pos, I add the TP in "ExecuteMarketOrder"

Bye and thanks for the suggestion.

Waxy said:

Here's the code, please notice, you didn't say anything about the 1st position being closed.

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 XROpenPositionsinOpposed : Robot
    {
        [Parameter("Label", DefaultValue = "MyLabel")]
        public string MyLabel { get; set; }

        bool _isSent;

        protected override void OnStart()
        {
            ExecuteMarketOrder(TradeType.Buy, Symbol, 10000, MyLabel);
        }

        protected override void OnTick()
        {
            var x = Positions.Find(MyLabel);

            if (x != null && !_isSent)
            {
                if (x.TradeType == TradeType.Buy)
                {
                    PlaceStopOrder(TradeType.Sell, Symbol, (x.Volume * 2), x.EntryPrice - 20 * Symbol.PipSize);
                    _isSent = !_isSent;
                }
                else
                {
                    PlaceStopOrder(TradeType.Buy, Symbol, (x.Volume * 2), x.EntryPrice + 20 * Symbol.PipSize);
                    _isSent = !_isSent;
                }
            }
        }
    }
}

 

 


@Forex19

Forex19
13 Feb 2015, 15:49

RE:

Spotware said:

Hello,

This functionality is available in the Web version of cTrader. You are able to filter the closing positions not only by symbol pairs, but also by direction of positions (buy/sell) and profit/loss. You may do so by using the Close button, located above the positions.

In the future it will be also available in the Desktop version.

Regards

 

News about when it will be available for the desktop version?


@Forex19

Forex19
12 Feb 2015, 15:47

RE:

AlexanderRC said:

indicator_instance.Result.Last(bars_ago)

Can you give examples of code line?

Thanks.


@Forex19

Forex19
09 Nov 2014, 22:55

RE:

I too have found the same thing, with all the problems of operation that follows.

I would say something unacceptable. Who pays for these inefficiencies?

Elogos said:

cTrader platform available with IC Markets has closed an hour early today.

This is the 6th seperate error that IC Markets have had with daylight savings and cTrader.

It is pretty serious condition not being if not being able to close positions for the week.

 


@Forex19

Forex19
03 Nov 2014, 15:23

I think I've solved. 
I wrote a simple indicator that reads OHLC candlesticks that interest me, using the API MarketSeries, who then called in the cBot. 

I have to do some testing but I think it can work.


@Forex19

Forex19
11 Oct 2014, 14:22

RE: RE: RE: RE:

The problem is that var count and var sum don't reset when the positions are closed and then start again.

breakermind said:

::::::::::::::::

        protected override void OnTick()
        {

            double nPos = 0;
            double gPos = 0;

            var AllPositions = Positions;
            foreach (var position in AllPositions)
            {
                if (position.Label == MyLabel)
                {
                    nPos += position.NetProfit;
                    gPos += position.GrossProfit;


                    if (count < 4)
                    {
                        count++;
                        sum = sum + count;
                    }

                }
            }
            Print("Net: " + nPos + " Gros: " + gPos + " Count: " + count + " sum: " + sum);

        }

 

maybe something like this

 


@Forex19

Forex19
11 Oct 2014, 13:21

RE: RE:

Hi, meantime thanks.
I had tried something like this as well but I've noticed that the var count and sum remain at the maximum value. Example:

If MaxPositions = 4

- positions open 1  => count = 1 , sum = 1

- positions open 2  => count = 2 , sum = 3

- positions open 3  => count = 3 , sum = 6

- positions open 4  => count = 4 , sum = 10

then

- positions open 1  => count = 4 , sum = 10

- positions open 2  => count = 4 , sum = 10

- positions open 3  => count = 4 , sum = 10

ecc, ecc.

Why?

breakermind said:

protected override void OnTick()

{

 

    double nPos = 0;

    double gPos = 0;

    int count = 0;

    int sum = 0;

 

    var AllPositions = Positions;

    foreach (var position in AllPositions)

    {

        if (position.Label == MyLabel)

        {

            nPos += position.NetProfit;

            gPos += position.GrossProfit;

            count++;

            sum = sum + count;

        }

    }

    Print("Net: " + nPos + " Gros: " + gPos + " Count: " + count + " sum: " + sum);

 

}


@Forex19

Forex19
09 Oct 2014, 21:01

Without changing anything in the code of the CBOT, from tuesday "Optimization" works.
It would seem without any problems.


@Forex19

Forex19
08 Oct 2014, 20:26

RE:

Hi, that's interesting. 
Can you put the code, please?

Gamezxz said:

Check it out! This is my last cbot.

http://www.youtube.com/watch?feature=player_embedded&v=IuUmTnIjnTk

 


@Forex19

Forex19
02 Oct 2014, 19:53

RE:

I've tested both but the problem persists

Spotware said:

We can recommend you to try other data modes:

  • m1 bars (open prices)
  • tick data mode

 


@Forex19

Forex19
02 Oct 2014, 15:07 ( Updated at: 21 Dec 2023, 09:20 )

RE:

If you normally start the CBOT seems to work and open positions. 

If I start the backtesting results is as follows:

If I start the Optimization results is as follows:

Spotware said:

Do you observe the same problem with standard built-in cBots?

 


@Forex19

Forex19
29 Sep 2014, 18:31

RE:

I would like to close all position with a specific label, which generate a P&L less than -10, for example.

In OnTick, is correct put:

            var pnl = Positions.FindAll(Label).Sum(position => position.NetProfit);
            foreach (var position in Positions.FindAll(Label))
            {
                if (pnl <= -10)
                    ClosePosition(position);
            }

???

Spotware said:

Then you will be able to calculate profit/loss for positions with that specific label:

var pnl = Positions.FindAll(Label).Sum(position => position.NetProfit);

You can also close all positions with specific label:

            foreach (var position in Positions.FindAll(Label))
            {
                ClosePosition(position);
            }

 

 


@Forex19

Forex19
29 Sep 2014, 16:01

RE:

Since I have already adapted the label to other needs of the code. 
is possible to obtain the same result in another way? I think for example to use a list where converge all positions of a cBot.

Spotware said:

You can use Label for such purpose.

        [Parameter(DefaultValue = "cBot unique identifier")]
        public string Label { get; set; }

When you open position, you need to use Label:

ExecuteMarketOrder(TradeType.Buy, Symbol, someVolume, Label);

Then you will be able to calculate profit/loss for positions with that specific label:

var pnl = Positions.FindAll(Label).Sum(position => position.NetProfit);

You can also close all positions with specific label:

            foreach (var position in Positions.FindAll(Label))
            {
                ClosePosition(position);
            }

 

 


@Forex19

Forex19
15 Sep 2014, 20:02

RE: RE: RE:

Can you tell me a MT4 indicator which you refer?

Thanks

motu828mk2 said:

Forex19 said:

The screenshot that you have shown, it refers to an existing indicator?

motu828mk2 said:

HI

 

is possible someone make an correlation indicator with custom pair  collection  ,something like that...

 

thanks

yes is an mt4 indicator , not work with mt4toc# ctrader converter  , ...

 


@Forex19

Forex19
14 Sep 2014, 12:19

RE:

The screenshot that you have shown, it refers to an existing indicator?

motu828mk2 said:

HI

 

is possible someone make an correlation indicator with custom pair  collection  ,something like that...

 

thanks


@Forex19

Forex19
11 Sep 2014, 19:23

RE: RE: RE: RE:

I started VS and open PayBackII. 
I then followed your link in the "Adding a Project Reference in Visual Studio" but tells me error. 

Almost certainly I'm doing something wrong, could you please show me some screenshots of the steps to do? 

I would be very grateful.

Invalid said:

you need to add a reference to a project (not a library). Take a look here.


@Forex19

Forex19
11 Sep 2014, 16:25

RE:

Is there a guide to which to refer?

Thanks and good job.

Spotware said:

Certainly I'm missing something and I'm sorry. 
But in cAlgo platform where I find a way to add a reference to a existing project? 

Or should I use Visual Studio? but I miss it

In cAlgo you can add a reference to a .net library or custom indicator. You can use Visual Studio to add a reference to existing .csproj

 


@Forex19

Forex19
11 Sep 2014, 16:06

RE: RE: RE: RE:

Certainly I'm missing something and I'm sorry. 
But in cAlgo platform where I find a way to add a reference to a existing project? 

Or should I use Visual Studio? but I miss it

Invalid said:

you need to add a reference to a project (not a library). Take a look here.

 

Forex19 said:

I followed your suggestion: 

  - Remove "using cAlgo.Lib;" 
  - Right click on the mouse and select Add Reference, but when I select the folder of the file "cAlgo.Lib.csproj" doesn't see it so I can't add it. 

I misunderstood and mistaken something?

Invalid said:

Just opened the solution and it works.

Most probably your project has invalid reference path. Remove cAlgo.Lib from reference list in your project and  add reference to project ..\Solution-calgobots-36873\Sources\Library\cAlgoLib\cAlgo.Lib.csproj

Forex19 said:

Hi,
I wanted to test some cBots (for example PayBack II) but during the compilation by me:

Error CS0234: The type or namespace name 'Lib' does not exist in the namespace 'cAlgo' (are you missing an assembly reference?)

with reference to "using cAlgo.Lib."

In the page: 

https://calgobots.codeplex.com/

I found the cAlgobots Sources and binary Build 36873 that contains the folder cAlgo.Lib end file cAlgo.Lib.csproj.
I made some attempts to include files that I thought was missing but I could not solve.

How can I fix? Thanks. 

 

 

 

 


@Forex19

Forex19
11 Sep 2014, 15:01

RE: RE:

I followed your suggestion: 

  - Remove "using cAlgo.Lib;" 
  - Right click on the mouse and select Add Reference, but when I select the folder of the file "cAlgo.Lib.csproj" doesn't see it so I can't add it. 

I misunderstood and mistaken something?

Invalid said:

Just opened the solution and it works.

Most probably your project has invalid reference path. Remove cAlgo.Lib from reference list in your project and  add reference to project ..\Solution-calgobots-36873\Sources\Library\cAlgoLib\cAlgo.Lib.csproj

Forex19 said:

Hi,
I wanted to test some cBots (for example PayBack II) but during the compilation by me:

Error CS0234: The type or namespace name 'Lib' does not exist in the namespace 'cAlgo' (are you missing an assembly reference?)

with reference to "using cAlgo.Lib."

In the page: 

https://calgobots.codeplex.com/

I found the cAlgobots Sources and binary Build 36873 that contains the folder cAlgo.Lib end file cAlgo.Lib.csproj.
I made some attempts to include files that I thought was missing but I could not solve.

How can I fix? Thanks. 

 

 


@Forex19