Replies

PanagiotisCharalampous
20 Nov 2017, 12:14

Hi mto1995,

Thanks for posting your question, but it is not very clear what exactly you need. From what I understand you want something to happen after the limit order is triggered. Can you please elaborate on that so that the community can help you?

Best Regards,

Panagiotis


@PanagiotisCharalampous

PanagiotisCharalampous
20 Nov 2017, 12:10

Hi 344260146,

The solution to your problem is to properly handle the exception thrown by your code. Read more about exception handling here or here.

Best Regards,

Panagiotis


@PanagiotisCharalampous

PanagiotisCharalampous
20 Nov 2017, 11:06

Hi davideng5555,

There is no full script. It is just the three lines above that show how to calculate the 2/3 of a position and use it in the ClosePosition function.

Is it possible to combine with the Close Position you wrote?

Can you please point me to the code you refer to and what you would actually like to achieve?

Best Regards,

Panagiotis 


@PanagiotisCharalampous

PanagiotisCharalampous
20 Nov 2017, 11:03

Hi zendoo,

Your question is very general for somebody to give a more specific answer to it. In principle, you should write your code in a way that it does not fall into infinite loops. If you could share your code with us then we could maybe give you a more specific advice.

Best Regards,

Panagiotis


@PanagiotisCharalampous

PanagiotisCharalampous
20 Nov 2017, 10:59

Hi myinvestmentsfx,

Thanks for your suggestion. However these features are not API specific but general C# features and there are plenty available on the internet. As mentioned in another thread, cAlgo uses .Net Framework 4.0 so features available in .Net 4.0 should work. Nevertheless, if you have any trading specific examples you would like to see, let us know the scenario and we can post some sample cBots/Indicators on the forum.

Best Regards,

Panagiotis


@PanagiotisCharalampous

PanagiotisCharalampous
20 Nov 2017, 10:55

Hi myinvestmentsfx,

I have some feedback from the product team. 

  1. cAlgo APIs are not thread safe. All invocations of API methods should be done in main thread. If you are calling API method from another thread, you should use BeginInvokeOnMainThread() to wrap API call.
  2. cAlgo is currently working on .Net version 4.0 to support early versions of Windows. We are planning to upgrade it soon. Since .Net version 4.0, code compilation at runtime has changed. Now it's compiled against latest version of .Net Framework installed on client PC. So you can use things like Async Await, but it's not supported by cAlgo.
    One of the issue with this is that context is not synchronized and you will return on another thread after awaiting method call.

Best Regards,

Panagiotis


@PanagiotisCharalampous

PanagiotisCharalampous
20 Nov 2017, 10:40

Hi lec0456,

Can you please check if the difference between the backtesting data and the live data is constant i.e. 0.4 pips? It could be that there is some additional markup on the price from your broker.

Best Regards,

Panagiotis


@PanagiotisCharalampous

PanagiotisCharalampous
16 Nov 2017, 12:53

Hi dusek.martin,

Thanks for posting in our forum. You can get information about positions using the Request for Positions message. You will need to calculate the P&L yourself based on the position's opening price and the current price.

Best Regards,

Panagiotis


@PanagiotisCharalampous

PanagiotisCharalampous
16 Nov 2017, 11:50

Dear g61232,

Thanks for posting in our forum and letting us know about the issue. Can you please send us the log so that we can check what the problem might be? Please send it at feedback@spotware.com

Best Regards,

Panagiotis


@PanagiotisCharalampous

PanagiotisCharalampous
10 Nov 2017, 17:23

Hi tmc.

Thanks for reporting then :) It has been confirmed that it is a bug and will be resolved soon.

Best Regards,

Panagiotis


@PanagiotisCharalampous

PanagiotisCharalampous
10 Nov 2017, 17:20

Hi BeardPower,

Thanks for reporting this. I will forward to our QA team to investigate further.

Best Regards,

Panagiotis


@PanagiotisCharalampous

PanagiotisCharalampous
10 Nov 2017, 12:18

Hi myinvestmentsfx,

The product team is looking into it. I will update you as soon as I get their feedback.

Best Regards,

Panagiotis


@PanagiotisCharalampous

PanagiotisCharalampous
10 Nov 2017, 09:23 ( Updated at: 21 Dec 2023, 09:20 )

Hi swingfish,

Yes it is possible to start cTrader from command line. Just navigate to cTrader's folder and run cTrader.exe. See below an example from my computer

Currently passing parameters is not available.

Best Regards,

Panagiotis


@PanagiotisCharalampous

PanagiotisCharalampous
09 Nov 2017, 15:06

Hi tmc.

This is probably happening because the ReferencedIndicator is not the one attached to the chart. Would like to tell us what you are trying to achieve so that we can propose a workaround? 

Best Regards,

Panagiotis


@PanagiotisCharalampous

PanagiotisCharalampous
09 Nov 2017, 14:40

Hi myinvestmentsfx,

Multithreading in general was not and is not a problem for cAlgo. The discussion you posted inquires whether cAlgo application itself is multithreaded, more specifically if it runs the bots on separate threads than the main application, causing synchronization issues. The answer to this question is no, cAlgo is not running cBots in separate threads, except the Timer class, therefore there should not be any synchronization issues.

However, this does not mean that you cannot use multithreading techniques within your cBot. As long as your programming techniques are correct, then you should not experience any problems. If you want, you can post the issues you face one by one and we can discuss them.

Best Regards,

Panagiotis


@PanagiotisCharalampous

PanagiotisCharalampous
09 Nov 2017, 10:03

Hi obaum1@gmail.com,

Slippage is unavoidable in the case of market execution. Market range orders, used in cTrader, ensure only the fact that your orders will be executed in the range requested, based on the available liquidity. So if the total slippage of your order, based on market conditions during execution time, is outside the market range, then your order will be filled partially only for the part that falls within your market range. 

Currently FIX API does not include Marker Range and Stop Limit Orders but we plan to add them in the future.

Best Regards,

Panagiotis 


@PanagiotisCharalampous

PanagiotisCharalampous
09 Nov 2017, 09:44

Hi guys,

Indeed cAlgo works with .Net Framework 4.0 for compatibility reasons. We will upgrade the framework in a later version.

Best Regards,

Panagiotis


@PanagiotisCharalampous

PanagiotisCharalampous
08 Nov 2017, 16:11

Hi myinvestmentsfx,

cAlgo does not crash, you just get a build error. You will get the same message if you open your indicator in Visual Studio. 

Best Regards,

Panagiotis


@PanagiotisCharalampous

PanagiotisCharalampous
08 Nov 2017, 14:41

Hi itmfar,

With some more coding, you can develop something more proper, that could also take dates as input. But it will need somebody to devote time for this to developed. If i find some free time soon, then I might prepare something for you.

Best Regards,

Panagiotis 


@PanagiotisCharalampous

PanagiotisCharalampous
08 Nov 2017, 13:00

Hi itmfar,

Thanks now it is more clear what you are trying to achieve. You can try the following approach

using System;
using cAlgo.API;
using cAlgo.API.Internals;
using cAlgo.API.Indicators;
using cAlgo.Indicators;

namespace cAlgo
{
    [Indicator(IsOverlay = false, TimeZone = TimeZones.UTC, AccessRights = AccessRights.None)]
    public class NewIndicator : Indicator
    {
        [Parameter(DefaultValue = 0.0)]
        public double Parameter { get; set; }

        [Output("Main")]
        public IndicatorDataSeries Result { get; set; }

        protected override void Initialize()
        {
          
        }

        public override void Calculate(int index)
        {
            if (IsLastBar)
            {
                ChartObjects.RemoveAllObjects();
                for (int i = MarketSeries.Close.Count - 20; i < MarketSeries.Close.Count - 10; i++)
                    ChartObjects.DrawVerticalLine("v" + i, i, Colors.White);
            }
        }
    }
}

Let me know if this works for you.

Best Regards,

Panagiotis


@PanagiotisCharalampous