Topics

Forum Topics not found

Replies

ap11
08 Dec 2017, 09:54

RE:

Hi Dan,

We are planning to work on multi symbol backtesting in the near future. This task has high priority as it's a second top voted request from our users.

If you didn't vote for this feature, please leave your vote here:
http://vote.spotware.com/forums/229166-ideas-and-suggestions-for-ctrader-and-calgo/filters/top?category_id=76800

Kind Regards,
Andrey

danblackadder said:

It currently works in a live environment, but I can not actually test if my algorithm will be profitable over the long term, so I am not willing to risk it.

Any update on the subject would be appreciated.

Thanks,
Dan

 


@ap11

ap11
08 Dec 2017, 09:34 ( Updated at: 21 Dec 2023, 09:20 )

RE:

Hi,

Right now it's not possible. But we are planning to add parameters grouping in the future.

Kind Regards,
Andrey

nohejl027@gmail.com said:

Hello,

is it possible to separate the input paramters into some sections to look like this?

 


@ap11

ap11
07 Dec 2017, 12:43

RE: RE:

Hi,

This workaround fixes support cBot projects in new Visual Studio. But it doesn't fix the problem with opening cBot in Visual Studio using context menu item 'Edit in Visual Studio'.
You need to open cBot solution file manualy:

  1. In cBot context menu select 'Show in Folder'
  2. Find folder with the name of cBot
  3. Open solution file from that folder

P.S. Update for Visual Studio Extension will be release with new version of cTrader. It works with Visual Studio 2015 and 2017.

Kind Regards,
Andrey

 

nohejl027@gmail.com said:

Hello Unfortunately it does not work for me (The extension is installed but I can't opene the cBot in VS 2017).

Please could you help?

 

Thanks.

 


@ap11

ap11
06 Dec 2017, 12:20

RE:

Hi Tony,

Do you have a MarketData.GetSeries() method call inside OnBar?

There is a known issue with version 2.01. When you call MarketData.GetSeries() method inside OnBar, On bar will be called once again on the next tick.

Kind Regards,
Andrey

 

hungtonydang said:

Hi all,

Just wondering has anyone else ever come across the scenario of a cbot placing 2 limit or stop orders in the exact same location as per the algo logic on an on onbar trigger event. It seems to me that logic is looping through the code twice at the onbar event only a few seconds apart. I don't mind it can just set a smaller position size, however I would like to understand why it would be doing this. I am using segments of code from the trading time interval reference page.

Thanks,

Tony

 


@ap11

ap11
06 Dec 2017, 12:15

RE:

Hi Nobulart,

The problem is that cAlgo does not support decimal volumes. It causes following issues with BTCUSD and ETHUSD:

  • You can't open positions or create pending orders with decimal part via cAlgo APIs
  • You won't get correct value for existing Position, PendingOrder or HistoricalTrade if volume has decimal part
  • Backtesting for this symbols is not working as Symbol.VolumeStep is equal to 0 after casting from double to long. That's why you get DivideByZeroException

We are fixing this issues. But this fixes will be in the next release of cTrader.

Kind Regards,
Andrey

 

nobulart said:

I'm running cAlgo 2.01 on BTCUSD.
My broker is FXPro.

It would seem that there is some issue with the execution of both market and limit orders in backtesting on BTCUSD.

I've stripped this down to the bare minimum code to demonstrate this:

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 BTCUSDTest : Robot
    {
        protected override void OnStart()
        {
            ExecuteMarketOrder(TradeType.Buy, Symbol, 1, "BTC Test", 100000, 5000, 2000, "BTCUSD Test Trade");
        }
    }
}

The minimum order volume for BTCUSD on FXPro is 0.01BTC. If I attempt to execute a market order with a volume from 1 to 5, I get the following result...

27/11/2017 02:00:00.000 | Backtesting started
27/11/2017 02:00:00.000 | Executing Market Order to Buy 1 BTCUSD (SL: 100000, TP: 5000, MR: 2000)
27/11/2017 02:00:00.000 | Crashed in OnStart with DivideByZeroException: Attempted to divide by zero.
27/11/2017 02:00:00.000 | Backtesting was stopped

Any volume greater than 5 exceeds FXPro's 5 BTC maximum and is rejected as it should be.
Any volume less than 1 also fails because the volume parameter is of type long.

 


@ap11

ap11
04 Dec 2017, 11:13

There is no way to create cBot using Python code. cBots can be created only using C#.

If you want to integrate python app into cTrader there are 2 possible workarounds:

  • Create .Net dll using IronPython and use it from cBot
  • Communicate with Python app from cBot

In both cases you need to create cBot using C#.

 

Best Regards,
Andrey


@ap11

ap11
04 Dec 2017, 10:44

RE:

Hi,

https://connect.spotware.com/

Here you can find documentation and examples for Open API. Unfortunately there is no examples for Python.

Kind Reagrds,
Andrey

 

r.houlahan said:

Hi there,

I am developing a non-C# algorithmic trading program and am wondering how I can use the Open API to interface with cTrader. I am not interested in using cAlgo to write C# bots, as the bulk of my code is written in Python. I cannot seem to find any documention on how to connect the Open API to cTrader - could someone link me any resources so that I can learn about this? 

Thanks in advance. 

 


@ap11

ap11
04 Dec 2017, 10:39

RE:

Hi,

When OnBar is called, you have a new bar as last one. This Bar has only one tick in it, so Open, High, Low, Close are the same. If you want to get data of closed bar, you need to get previous bar:

Print("MarketSeries.TimeFrame: {0} | MarketSeries.Open: {1} | MarketSeries.Close: {2} | MarketSeries.Low: {3} | MarketSeries.High: {4}",
        MarketSeries.OpenTime.Last(1).ToString(),
        MarketSeries.Open.Last(1),
        MarketSeries.Close.Last(1),
        MarketSeries.Low.Last(1),
        MarketSeries.High.Last(1));

Best Regards,
Andrey

 

yuri_paez@hotmail.com said:

When I try to get the values for Open, Close, Low & High values from MarketSeries I allways get the same value for all, look my sample code.

protected override void OnBar() 
{ 
base.OnBar();

Print("MarketSeries.TimeFrame: {0} | MarketSeries.Open: {1} | MarketSeries.Close: {2} | MarketSeries.Low: {3} | MarketSeries.High: {4}", MarketSeries.OpenTime.LastValue.ToString(), MarketSeries.Open.LastValue, MarketSeries.Close.LastValue, MarketSeries.Low.LastValue, MarketSeries.High.LastValue); 
}

 

A sample result: 


12/11/2017 18:01:00.322 | MarketSeries.TimeFrame: 13/11/2017 12:01:00 a. m. | MarketSeries.Open: 1275.5 | MarketSeries.Close: 1275.5 | MarketSeries.Low: 1275.5 | MarketSeries.High: 1275.5 
12/11/2017 18:02:00.199 | MarketSeries.TimeFrame: 13/11/2017 12:02:00 a. m. | MarketSeries.Open: 1275.57 | MarketSeries.Close: 1275.57 | MarketSeries.Low: 1275.57 | MarketSeries.High: 1275.57 
12/11/2017 18:03:00.386 | MarketSeries.TimeFrame: 13/11/2017 12:03:00 a. m. | MarketSeries.Open: 1275.32 | MarketSeries.Close: 1275.32 | MarketSeries.Low: 1275.32 | MarketSeries.High: 1275.32

I tested with diferent symbols and time frames

Am I doing something wrong?

 Regards

 


@ap11

ap11
04 Dec 2017, 10:12

RE: RE:

Hi Mirko,

That is correct. You need to have 2 indicators for this, Alligator and Signals indicator. Signals indicator will use Alligator as a nested indicator. Alligator should be added manually to the chart with same settings.

You can use Sample Alligator for this:
 

SampleAlligator alligator;

protected override void Initialize()
{
    alligator = Indicators.GetIndicator<SampleAlligator>(JawsPeriods, JawsShift, TeethPeriods, TeethShift, LipsPeriods, LipsShift);
}

public override void Calculate(int index)
{

    var jaws = alligator.Jaws[index];
    var teeth = alligator.Teeth[index];
    var lips = alligator.Lips[index];
    ...
}

 

Best Regatds,
Andrey

 

Mikro said:

Hi Panagiotis,

From I read about nested indicators using the Moving Average Indicators in my code is pretty much using nested indicators, isn't it?

 protected override void Initialize()
        {
            jawsMa = Indicators.SimpleMovingAverage(MarketSeries.Close, JawsPeriods);
            teethMa = Indicators.SimpleMovingAverage(MarketSeries.Close, TeethPeriods);
            lipsMa = Indicators.ExponentialMovingAverage(MarketSeries.Close, LipsPeriods);
        }

This way the indicator parameters can be handled by the algo but I have no option to draw the used indicators to different chart types, do I?

THX

Mirko

 


@ap11

ap11
01 Dec 2017, 17:29

mto1995 said:

i use an algorith, who use the economics data and i need to access on time of backtesting data because when i check the date, it's the date time of now

thks,

 

Hi mto1995,
You can use

var barIndex = MarketSeries.OpenTime.GetIndexByTime(...)

 

Best Regards,
Andrey


@ap11

ap11
01 Nov 2017, 10:00

Hi Anthony,

Thank you for your interest in cAlgo.
Indeed Microsoft is doing interesting stuff and we now have more options for our project in the future.
For now we are only planning to investigate this opportunity. Compilation against .Net Standard seems to be one of the promising options.
Although it seems like a possible scenario, it will require a lot of work to implement this. So, unfortunately it won't happen any time soon.

Kind Regards,

Andrey


@ap11