Topics
16 Nov 2023, 07:42
 1088
 1
15 Nov 2023, 10:36
 1967
 16
Replies

Spotware
01 Oct 2013, 16:50

RE:

fx_trader said:

1. It seems to not be possible to identify the pending order from which a position was opened, right?

Right now you can do it using labels. If you specify label for an order position will inherit this label.

 

First issue here is that the pending order might have become a position during the time I am sending the delete request. What happens in this case - do I get an OnError event?

cAlgo will not notify your robot in case pending order no longer exists.


After I have sent the delete request, I send a new request for buy stop order w/ target price 1.3549. What happens if the Ask has moved to 1.3550 in this time (while I was busy sending the delete request). Will I get an OnError event, or will I get straight OnPositionOpened event without OnPendingOrderCreated?

In this case trade server will fill your order with the current market price.

In your case it would be perfect to use modify order command, but it's not supported now. The only consistent way to implement such robot is to emulate stop orders in cAlgo, I mean to send market orders when spot price reaches certain level and use VPS to minimize possible latency. Note that if you use market orders you can also specify maximum slippage in pips.

We currently work on new trading API that will be much more flexible and allow to modify pending orders and handle errors properly.


@Spotware

Spotware
01 Oct 2013, 14:59

New version of cAlgo supports backtesting of multi-timeframe robots. Please check our demo build.


@Spotware

Spotware
01 Oct 2013, 14:54 ( Updated at: 15 Jan 2024, 14:51 )

Our new enhanced tabs and additional information windows contain this information. Read [this thread ]for details.


@Spotware

Spotware
01 Oct 2013, 14:50

Yes. Version with the fix is already released for our demo build. You can download it from www.spotware.com


@Spotware

Spotware
01 Oct 2013, 11:08

Dear Trader,

 

We will implement tick chart very soon in both downloadable and Web version of cTrader.

Please stay tuned.


@Spotware

Spotware
01 Oct 2013, 10:31

cAlgo uses asynchronous events almost everywhere, all methods can called in different threads. However, at any time only one method can be invoked. cAlgo never invokes you methods in parallel so you have not to worry about multi-threading issues.


@Spotware

Spotware
30 Sep 2013, 13:01 ( Updated at: 15 Jan 2024, 14:50 )

RE: RE:

Balena said:

1.

i look to trade every x number of minutes based on 

protected override void OnPositionOpened(Position openedPosition)
        {
            lastExecutedTime = Server.Time;

so how would I know what lastExecutedTime = ? (code please)

After you restart the robot all variables will be reset. The only information you can retrieve is open position information. Therefore you can use EntryTime instead. In order to find the positions of a specific robot you may assign Labels to these positions when the trade Requests are sent. Then retrieve the positions by their Label and find their entry time. The latest position will have the latest entry time. If the position closes the entry time will not be available.

        /// <summary>
        /// If there is no position, returns 01/01/0001 00:00:00	
        /// </summary>
        protected DateTime LastExecutedTime
        {
            get
            {
                Position lastOrDefault = Account.Positions.LastOrDefault(position => position.Label == RobotLabel);
                return lastOrDefault != null ? lastOrDefault.EntryTime : new DateTime();
            }
        }

the Linq namespace is required for the above code

using System.Linq;

2.

if i have a max position size of 10 and I have 5 befor the disconnect how do I tell the robot this on restart? (code please)

 The same as above, use Labels and count how many positions have the Label that is set with this robot. 

[Labels and a New Method to Create Orders]

 

 

 


@Spotware

Spotware
30 Sep 2013, 10:53 ( Updated at: 21 Dec 2023, 09:20 )

To include an indicator in a robot you can start by looking at the examples in the platform. For instance:

  • "Sample Breakout Robot" uses the "BollingerBands" build in indicator and  
  • "Sample Robot Reference SMA" uses the "Sample SMA" custom indicator

If you need further help referencing indicators you can start a new thread in the appropriate section of the forum Indicator Development Support

Levels are horizontal lines drawn at the y value indicated by the values in parenthesis.

The above will display three level (horizontal) lines at values 25, 50 and 75.


@Spotware

Spotware
27 Sep 2013, 09:06

The fix for this will be released soon. Thank you for reporting it.


@Spotware

Spotware
25 Sep 2013, 15:36

We have such an issue in the current version, but in the next version it will be fixed.


@Spotware

Spotware
25 Sep 2013, 15:30

We don't have and do not plan to provide such API for now.


@Spotware

Spotware
25 Sep 2013, 15:17

RE:

MrTrader said:

I'm having difficulties changing the moving average type to Welles Wilder Smoothing, can you help me out with this?

WilderSmoothing is added to MovingAverageType enum now.


@Spotware

Spotware
25 Sep 2013, 14:47

Dear Trader,

We intend to modify Fibonacci tools as described by you in upcoming releases of cTrader. 

We will notify you in this thread or by email, when it's ready.

Best regards,

SPOTWARE FEEDBACK TEAM


@Spotware

Spotware
25 Sep 2013, 11:10

You can currently save workspaces in cTrader Web. In the future it will be possible to do this in cTrader desktop platform as well.


@Spotware

Spotware
25 Sep 2013, 10:29

Right now it is not possible to add custom indicators in the cTrader Web. It may be included in the future.


@Spotware

Spotware
24 Sep 2013, 12:31 ( Updated at: 23 Jan 2024, 13:16 )

RE: RE:

andromeda said:

How that index relates to instantiated m10 or m1 for that matter ?

How often Calculate method is called by who and when and what is index relative to ?

(I know it is called at some irregular intervals in real time and any time a graph point is evaluated,

but I cannot correlate it to the last "10 minute" or "one minute" bar.)

 

The Calculate method is called on each historical bar in the series the instance is attached to (i.e. EURUSD H1). Once it reaches real time, it is called on each incoming tick of that symbol, as well as on each incoming tick of any other symbols for which the series are retrieved.

The "index" that is the parameter to the Calculate method, is the index of the series that the instance is attached to. The series of other timeframes / symbols have different indexes. So, to get the index of a specific series you would need to use a method such as GetIndexByDate (Described in the example above: [Multi-timeframe moving average])

 

         private int GetIndexByDate(MarketSeries series, DateTime time)
        {
            for (int i = series.Close.Count - 1; i > 0; i--)
            {
                if (time == series.OpenTime[i])
                    return i;
            }
            return -1;
        }
    }
}

Descriptions are minimalistic. A simple question like Print method nowhere describes where

does the print go to. So far I know it goes o a log file, but could not find the log anywhere.

I find cAlgo exeptionally cool tool but I am having trouble to get started due to insufficient

description. C# is not an issue here but general concept of all classes and objects and how they tie together.

 The Print method prints to the Log within the platform, not a log file. It is the last tab in the bottom panel of the chart view.

We are preparing a manual for cAlgo with more detailed descriptions of all the main classes in the API.


@Spotware

Spotware
24 Sep 2013, 10:55

Thank you for the suggestion and the kind words. A section for bug reports will be added to the forum in the near future.


@Spotware

Spotware
24 Sep 2013, 10:30

If you are referring to lines created using ChartObjects such as ChartObjects.DrawHorizontalLine then this cannot be changed at the moment. You can only set the color thickness and line style from the code.

If you are referring to the horizontal lines added on the chart manually from the toolbox, then you can right click on the line and a settings window will pop up to allow you to make modifications to the line appearance.


@Spotware

Spotware
23 Sep 2013, 18:17

This is a bug that will be fixed soon. Thank you for reporting it.


@Spotware

Spotware
23 Sep 2013, 16:52

You can set the AutoRescale property to false.

    [Indicator(IsOverlay = true, AutoRescale = false)]
    public class EnvelopeChannels : Indicator

/api/indicatorattribute/autorescale


@Spotware