What's new in cAlgo API 3.0

What's new in cAlgo API 3.0

StopLimit order
Added support for StopLimit orders.

// Place StopLimit order
PlaceStopLimitOrder(TradeType.Buy, Symbol, 10000, Symbol.Ask + 10 * Symbol.PipSize, 1);

// Get all StopLimit orders
var stopLimitOrders = PendingOrders.Where(o => o.OrderType == PendingOrderType.StopLimit);

Trailing Stop
Added support for Trailing Stop parameter.
cTrader supports Trailing Stops for positions that work on server side. Position has a boolean parameter called HasTrailingStop.
If Trailing Stop is set, StopLoss will be changed when price moves in your favor.
You can set this parameter during position opening or when placing a pending order. Also, you can change it in ModifyPosition or ModifyPendingOrder methods.

Stop trigger method
cTrader supports different Stop Trigger methods for Stop, StopLimit orders and for positions Stop Loss.
Now these parameters available via API using methods to open position, place pending orders and using modify methods.
There are 4 different trigger method:

Added property Account.AccountType. It can be Netted or Hedged.

StopOut Level
Added property Account.StopOutLevel.

Dynamic Leverage
Now you can get multiple tiers of Symbol leverage using Symbol.DynamicLeverage.

Fractional Volumes

Up to now, cAlgo API accepted only integer values for volume in trading operations. Also some data could be accessed using integer properties only, like position volume, Symbol volume settings etc. With the introduction of cryptocurrencies, now there are instruments that can be traded using fractional units volume. To adapt to these changes, we added possibilities to work with fractional volumes using API.

For trading operations you can pass double value as volume parameter. Both integer and double values are working:
ExecuteMarketOrder(TradeType.Buy, Symbol, 1);
ExecuteMarketOrder(TradeType.Buy, Symbol, 0.5);

For volume properties we added new properties of type double, that replace old integer properties that are now deprecated.
Instead of old 'Volume' properties, you should use new 'VolumeInUints' properties. Here are some example:
Position.Volume -> Position.VolumeInUnits
HistoricalTrade.Volume -> HistoricalTrade.VolumeInUnits
Symbol.VolumeMin -> Symbol.VolumeInUnitsMin
MarketDepthEntry.Volume -> MarketDepthEntry.VolumeInUnits

Modify position volume and reverse position
Now you can change volume of existing position using ModifyPosition method
Also position could be reversed using ReversePosition method

Market Hours
Added access to Symbol trading session. You can get sessions using Symbol.MarketHours.

Connection status
Now you can get current connection status to the server using Server.IsConnected property.
Also added events Server.Connected and Server.Disconnected.

Trading events
Added new trading events:

Also Position.Closed event now contains close reason.


Hi Afhacker,

Thank you for your feedback!

Currently, we are testing a top requested feature - Visual Backtesting. It would be in the next release.
We didn't start to work on multi-currency backtesting yet, but it is in our top priorities as a second top requested feature by the users.

We are finishing with the updated version for ChartObjects API that has the following features:

Also, we have a new Color type, where you can specify transparency.

Regarding other features you mentioned.

We are planning to update .Net version in the near future. For this, we need to update cTrader to the same .Net version. Which means that we are getting rid of support for some old versions of Windows. We need to make sure that users have required .Net version installed on their machines prior to release. So we are planning to make a release with the .Net installer first, which will ask users to update. It is planned that next version will have this installer. After that we can proceed with .Net version update.

Proper parameters UI for custom enums, DateTime and Color are planned to be supported. But these tasks are not in the top priority list.

There are no plans yet to introduce new drawing objects. Your feedback on this subject is very welcome. Please tell us what do you want to see here.

Regarding TimeZone of the platform, it's a good idea to add this property and a change event.

Thank you,

afhacker said:

First thanks for adding this new features but what about community requests? where is multi-symbol backtesting? or different parameter types like Enums, date time picker,...

And is there any property to get a collection of all available symbols? that will be a simple feature to add before releasing the new version of API.

The current API library is based on .Net framework 4 which is obsolete, please update the .Net version to > 4.6 at least.

Another main issue of current API is limited drawing, please improve the API chart drawing feature by adding:

1. Transparency

2. Different shapes drawing

3. Checking current objects on chart and modifying those objects

4. A collection of objects drawn by current indicator or cBot

And please add a property to get the user platform (not system as it's available by .Net) time zone as a .Net TimeZoneInfo object.

Adding all these features will not get much time but I don't know why Spotware is very slow in adding new features?

Multi-symbol backtesting is one of the top suggestions and most voted of the community so please add it!

Editor Settings

In version 3, Calgo was integrated with CTrader. Ok... however:

1) Where are the editor settings? The default changes when saving the code format to a fixed one I hate, not very useful for many users. And I cannot change it to unselect the "auto formatting" dumb option.

2) The integrated version of Calgo has a huge problem: the optimization is now MUCH SLOWER (3x to 10x) than when the calgo executable was independent.

It is so slow that I was forced to change from tick backtests and optimizations to the M1 simulation. And this is VERY BAD !!

In fact, EVERYTHING in the "automate" section of the new CTrader 3 is VERY SLOW. Too much slow. Take attention to this guys, because it is tottaly unfeasible to work that way at a point that can force people go to other plataform. I suggest strongly to offer a Calgo independet version to those who work a lot with backtests and optimizations. I think this is a must.

3) After you optimize, the backtest does not run. Try to "apply" one optimization parameters set to the robot and then try a backtest. It does not run. You need to exit the ctrader/calgo program to make it work again on that instance.

4) The "play" buttons for backtesting and optimization does not show when it is working, active, or not. There are times you click on the button, things do not work and you do not know what is going on... you need to click again and again to be sure.

5) And old issue not related top the version 3: I already used Ninja and MT... and they do implement a true optimization algorithm. But CAlgo seems to choose the parameters randomly. Certainly it is NOT an optimization clever algorithm. In general, the optimization process is a VERY WEAK feature that lacks a better implementation in CTrader, specially when you compare it to other plataforms like MT and Ninja.

Thanks, Lavio