Topics
Reverse Position

completed Closed cTrader Automate

Suggestions
13 Nov 2014, 08:53
 18
 1418
 1
Modify volume of a position

completed Closed cTrader Automate

Suggestions
28 Sep 2014, 13:15
 163
 1986
 6
28 Aug 2014, 00:33
 3017
 1
27 Aug 2014, 17:14
 49
 1911
 3
Replies

AlexanderRC
02 Dec 2014, 12:56

In the latest release notes cServer behavior was changed to close the "position with the biggest Margin will be closed on Stop Out event instead of most losing position". Assuming that all of the positions in this example have the same volume, cServer should use some other sortable metric to determine which position to close.

Spotware, can you provide an insight, what metrics are used to choose the position if volumes (and the locked margin) are the same?


@AlexanderRC

AlexanderRC
02 Dec 2014, 12:46 ( Updated at: 21 Dec 2023, 09:20 )

RE: RE:

zumzum said:

Hi Alexander,

would you mind to share your workaround?

 

Here is an example

using cAlgo.API;
using cAlgo.API.Internals;

namespace cAlgo
{
    [Robot(TimeZone = TimeZones.UTC, AccessRights = AccessRights.None)]
    public class FractionalPips : Robot
    {
        [Parameter(DefaultValue = 10.3, MinValue = 0.1)]
        public double TakeProfitPips { get; set; }
        
        [Parameter(DefaultValue = 10.3, MinValue = 0.1)]
        public double StopLossPips { get; set; }

        protected override void OnStart()
        {
            Positions.Opened += Positions_Opened;
            ExecuteMarketOrderAsync(TradeType.Sell, Symbol, 1000, "MyRobot");
        }

        void Positions_Opened(PositionOpenedEventArgs obj)
        {
            var p = obj.Position;
            if (p.Label == "MyRobot")
            {
                ModifyPositionAsync(p, p.EntryPrice + Symbol.PipSize * StopLossPips, p.EntryPrice - Symbol.PipSize * TakeProfitPips);
            }
        }

    }
}


@AlexanderRC

AlexanderRC
30 Nov 2014, 19:54

Do you have the same ticks on the Live and Demo accounts? There may be different spread in historical values. Consult symbol specifications of your broker.


@AlexanderRC

AlexanderRC
28 Nov 2014, 04:00

One of our traders complained about a similar problem with manually added horizontal lines and fibo levels indicator.


@AlexanderRC

AlexanderRC
26 Nov 2014, 12:41

I can try to implement this via programmatically invoking the UI. Contact via email in signature.
 


@AlexanderRC

AlexanderRC
26 Nov 2014, 12:36

I have experienced this problem too, but implemented a workaround to change TP and SL to exact prices in a callback and forgot to report that. Essentially, ExecuteMarketOrder[Async] and friends have take profit and stop loss parameters of the double type, but rounded to integers.


@AlexanderRC

AlexanderRC
19 Nov 2014, 15:28

RE:

newrick1962 said:

If I have a long line of code (complex if statement or a long Print line) how do I split the code over more than one line?

Thanks
 

C# syntax allows you insert new lines almost everywhere you like. As an extra precaution precaution I advise you to start a new line which part of statement with an operator (arithmetic, logic, etc.) which is part of an original statement. Adding an indent before the operator would be helpful too, but that depends on you code style. If you later go back to the code to read and modify it, it would be obvious that the line is a part of multiline statement due the leading operator.

Also see C# Coding Conventions. There are some example how a statement can be split.


@AlexanderRC

AlexanderRC
19 Nov 2014, 14:57

RE:

Elogos said:

It seems that regardless of GPU acceleration or not that the charting area performs poorly when at higher resolutions.

3200x1800 and also 3840x2160 are the two display resolutions I have to work with.

If I take the window and resize it smaller to say 70% of the screen it gets a better.

This is with the basic light/dark template defaults, so no indicators loaded.

Can you test with maximum height and width across half the monitor? There may be some hard coded maximum of width for the chart...

I plan to get a 4K monitor and this is a real showstopper for me.


@AlexanderRC

AlexanderRC
19 Nov 2014, 14:54

RE:

Spotware said:

Custom indicators will be supported in the Android version of cTrader.

This will be available in future releases.
 

How is this going to be implemented?

Java or Mono?


@AlexanderRC

AlexanderRC
19 Nov 2014, 13:09

And possibly, per symbol.


@AlexanderRC

AlexanderRC
14 Nov 2014, 10:49

RE:

DAATS said:

2) The standard list of indicators provided, doesnt have the full functions, eg, MAs i cant shift them forward, any ideas how do i do it?

A wrapper indicator can be written that adds shift parameter. If you name the indicator you need, I will post the source code to use this indicator with shift parameter. And also in the indicators section of CTDN.


@AlexanderRC

AlexanderRC
13 Nov 2014, 11:45

RE:

Spotware said:

Probably solution with UI Automation will not work because cTrader and cAlgo do not support UI Automation.

A quick proof of concept Coded UI test shows that can be done. If anyone is interested, we are ready to help.


@AlexanderRC

AlexanderRC
13 Nov 2014, 11:43

RE:

emonnier said:

Hello,

I d like to launch a robot on lists of instruments without having to repeat the provess of adding instruments from the menu.

It is a tedious task in case of 30 or 40 instruments lists. Is it possible to do it directly from the code ?

There are no known way to do that via a published API.

However it should be possible to emulate UI interaction to do what you want. Please contact us via email in signature for details.


@AlexanderRC

AlexanderRC
13 Nov 2014, 10:56

We are currently storing position ids in an external place to keep tracking positions between cBot restarts. You may use a file or a database.


@AlexanderRC

AlexanderRC
13 Nov 2014, 10:54

You may want to vote for Modify volume of a position and Reverse Positon features on vote.spotware.com.


@AlexanderRC

AlexanderRC
13 Nov 2014, 10:48

RE:

2008483 said:

I was using USD when Open Position on MT4. I'm a bit confusing converting EURO to USD when open a position. Is there way to change it to USD only?

The account currency depends on your broker. Some brokers allow to have different accounts with different account currencies, either EUR, USD or even RUB.

Contact your broker for details.


@AlexanderRC

AlexanderRC
12 Nov 2014, 15:00

RE:

1004241 said:

How much do you think it would cost for someone to create this hack?

Please contact us via email in the signature for a quote.


@AlexanderRC

AlexanderRC
11 Nov 2014, 04:15

May be via some hacks to manipulate WPF objects (GUI technology cAlgo/cTrader is based on) by using UI Automation.


@AlexanderRC

AlexanderRC
06 Nov 2014, 22:07

RE:

Some external (to cTrader/cAlgo) monitoring program from this list may be of some help.

https://www.raymond.cc/blog/keep-application-running-by-automatically-rerun-when-closed/

 


@AlexanderRC

AlexanderRC
06 Nov 2014, 22:05

RE:

Dogtrader said:

I am running MB Trading cAlgo on a new VPS at BeeksFX. I've had 13 "disconnects" logged in the journal in the past 3 hours. And I had a bunch when it was running on my home PC ... which is one reason I moved to a VPS. What is going on?

You may dump network packets with a program like WireShark into a file and investigate network activity when disconnects occur.


@AlexanderRC