Topics
17 May 2022, 11:22
 960
 3
14 Dec 2020, 13:38
 1557
 3
Replies

ClickAlgo
09 Sep 2016, 08:07

afhacker is correct

There is a hack workaround to this issue and you can use a timer to check for the last open position that opened and get the SL and TP.


@ClickAlgo

ClickAlgo
09 Sep 2016, 07:44

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

        protected override void OnStart()
        {
            Positions.Opened += OnPositionOpened;
        }

        protected override void OnTick()
        {
            // Put your core logic here
        }

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


        private void OnPositionOpened(PositionOpenedEventArgs args)
        {
            System.Threading.Thread.Sleep(5000);
            var p = args.Position;

            for (int i = 0; i < 2; i++)
            {
                if (p.Label != "duplicates")
                {
                    ExecuteMarketOrder(p.TradeType, this.Symbol, p.Volume, "duplicates", p.StopLoss, p.TakeProfit);
                }
            }
        }
    }
}

 


@ClickAlgo

ClickAlgo
09 Sep 2016, 07:40

I have a customer request to duplicate manually opened orders. I have also noticed that the first time the OnPositionOpened method is called the position object does not contain the SL or TP values of the opened order, all subsequent calls work correctly and they have the correct SL and TP values.

I set a timer for 5 seconds and it did not correct the problem. So I would say there is an issue with the API


@ClickAlgo

ClickAlgo
29 Aug 2016, 14:14 ( Updated at: 30 Aug 2016, 11:35 )

We have just upgraded our website to now offer applications for the cTrader & cAlgo trading platform.

In the coming months we will release many useful tools.

Please visit us at clickalgo.com

Regards,

Paul Hayes


@ClickAlgo

ClickAlgo
29 Aug 2016, 14:10 ( Updated at: 23 Jan 2024, 13:16 )

the link on the image is incorrect, use this:

[clickalgo.com]


@ClickAlgo

ClickAlgo
11 Aug 2016, 16:52

Try this.

/algos/indicators/show/705

 


@ClickAlgo

ClickAlgo
23 Jul 2016, 07:31

Take a look in the following folder, your code should be there:

documents/calgo/sources/


@ClickAlgo

ClickAlgo
29 Jun 2016, 10:20

My mistake, it is ordered by opening time and not closing time. the 2nd position did close, but when it moved from positions to history it updated the closing time to the incorrect value. The error still stands.


@ClickAlgo

ClickAlgo
18 Jun 2016, 07:51

Additional Steps to Lower CPU

Some additional steps you can take to lower the CPU usage on the VPS with cTrader is to always minimize the platform application, if you leave the charting window visible, then the CPU will work hard to calculate and draw all the graphics. 


@ClickAlgo

ClickAlgo
30 May 2016, 06:33

here is a ready made version, the previous link no longer works.

http://www.clickalgo.com/blog/post/visual-studio-ctrader-programming.aspx


@ClickAlgo

ClickAlgo
03 May 2016, 13:13

thanks martin for a nice reply, I would stick with VS for your dev with cTrader. The cAlgo IDE and the API is still in its infancy stage, but there is a lot of potential in the future for Add-On's for bespoke trading and charting applications with it. I also apologies as I understand now you were trying to get Spotware to provide a development environment like you have in MT4, but this may be years away.

I hope you stay with cTrader and share ideas in the future. :-)


@ClickAlgo

ClickAlgo
03 May 2016, 12:32

Hi Martin,

I was just trying to be helpful, with cTrader you have the benefit of harnessing the power of .NET with C# as the programming language, as standard you use Visual Studio for the development. Remember you can have separate class files in the project, you do not need external assemblies. I will stop trying to help now.

good luck :-)


@ClickAlgo

ClickAlgo
03 May 2016, 10:04

Hi Martin,

You do not need to use assemblies, you can have a single Visual Studio project and put as many files with classes in there as you wish. The cAlgo IDE only allows a single file as it is for very basic use, but with VS you can have a normal development environment. 

Do this, edit your cAlgo cBot with Visual Studio and just add any additional classes files you require, reference them from your main cBot class and when you compile your algo file it will compile the whole project with all related .cs files

cTDN Website Limitations

you may be referring to the cTDN website which does not support multiple file uploaded of projects, so if you want to upload your VS project with multiple files it will only show your cBot class and not any referenced classes, this could your issue. The classes are there, they are just not shown on the website.


@ClickAlgo

ClickAlgo
02 May 2016, 20:12

Hi Martin,

Not quite sure about the question, but take a look at partial classes.

I think your question relates to the Microsoft .NET framework with the C# programming language, you may be better off asking them on a forum like stack exchange  or Msdn as the cTrader platform offers an API for automated trading and not how you would design or use the C# programming language with .NET.

I hope you find the answers to your questions by visiting one of the above sites.

Paul. :-)


@ClickAlgo

ClickAlgo
02 May 2016, 11:55 ( Updated at: 21 Dec 2023, 09:20 )

Hi Martin, 

Nice to meet you too.

I assume you are using Visual Studio and not the cAlgo platform for development. You can design your architecture for you candle patterns with separate assemblies if you wish for portability. Again I am sorry if you already know this, but the images below demonstrates how you can manage your logic with visual studio. 

If you want to chat further for me to help you get kick started with the cTrader API, just email me direct at development@clickalgo.com


@ClickAlgo

ClickAlgo
02 May 2016, 10:00

Hi Martin,

You should be able to just extend the API with your own object hierarchy to suit any patterns you would like to implement, you will also serialize the data for persistence.

My apologies if you already know this, but all your candle patterns would benefit from using Unified Modelling (UML) or amore modern technique with Agile Modelling (AM)

The API is very basic and has limited or no interface-based architecture as far as I am aware, if you create a simple cBot you should be able to see all that is available through the Robot base class.


@ClickAlgo

ClickAlgo
23 Apr 2016, 06:46

Hi Onn,

Create an external assembly which you call from your Robot class and use the software below for obfuscation and code protection, you can then build the entire algo file without source for the cBot project and any referenced assemblies will be added to the file. You will notice a larger file than normal and finally you will have just a single file with the .algo extension.

http://www.secureteam.net/.NET-Obfuscator.aspx

Regard,

Paul.


@ClickAlgo

ClickAlgo
19 Apr 2016, 16:08

Thank you Jiri. :-)


@ClickAlgo