Topics
16 Nov 2023, 07:42
 1103
 1
15 Nov 2023, 10:36
 1979
 16
Replies

Spotware
12 Jun 2014, 09:33

RE: RE:

breakermind said:

Hi and thanks,

 

I have this:

        public override void Calculate(int index)
        {

            // access to different series
            var weeklySeries = MarketData.GetSeries(TimeFrame.Weekly);

            // open price bars
            double open = weeklySeries.Open[index];
            Print(open);

            // If first bar is first bar of the day set open
            Week1Open[index] = open;

        }

How get Week open price and draw line on this price ? what is wrong ? 

index is wrong. The weeklySeries object has different indexes.


@Spotware

Spotware
12 Jun 2014, 09:31

OnPositionOpened method is obsolete. It works only for old trading API accessible through the Trade object.

In your case you need to subscribe to Positions.Opened event:

        protected override void OnStart()
        {            
            Positions.Opened += OnPositionsOpened;
        }
        
        void OnPositionsOpened(PositionOpenedEventArgs args)
        {
            ...
        }

 


@Spotware

Spotware
12 Jun 2014, 09:28

You can try to use OnBar method instead of OnTick. Please don't forget that last bar is not formed in OnBar method and you need to take values from previous index.


@Spotware

Spotware
12 Jun 2014, 09:27

We always read and take seriously into account the user's feedback. Workspaces are in our short term roadmap. Unfortunately we don't get more specific with release dates and features. Thank you for your patience. 


@Spotware

Spotware
12 Jun 2014, 09:19

Antonma is right, you need to take previous bar. Here is some clarifications:

OnBar event happens when new bar is opened. At that moment MarketSeries collection already contains tick from new bar. It means that last bar is not formed and in general cases open = high = low = close. If you want to access to last formed bar you need take previous one.

You can use following code to access to the previous bar:

   Print("Open: {0}, Close: {1}", MarketSeries.Open.Last(1), MarketSeries.Close.Last(1));


@Spotware

Spotware
11 Jun 2014, 12:05

In next version of cTrader and cAlgo we optimized the memory usage. We plan to release next version this week. We will investigate other problems.


@Spotware

Spotware
11 Jun 2014, 09:08

You can check the TimeFrame in the code:

if (TimeFrame == TimeFrame.Minute)
  param = 0;
if (TimeFrame == TimeFrame.Minute15)
  param = 100;

 


@Spotware

Spotware
10 Jun 2014, 15:28

RE:

casado said:

After you instructions  ("We apologize for any inconvenience. Please press Shift+Ctrl+Alt+T. It will send us the troubleshooting information."), I pushed it a few times.

I think that ctrader sent you the troubleshooting information.

Have you notice about? I don´t use ctrader from then. It´s imposible.

Do you what happened with cTrader new version?  Will it be solution to memory  troubleshooting?

Thank you

We do not see any problem in your troubleshooting report. Could you please be more specific and describe what kind of problems do you observe? We can also recommend you to remove all custom indicators and try to reproduce the problem without custom indicators.


@Spotware

Spotware
10 Jun 2014, 09:37

We plan to release Timer this week. We can recommend you to wait while Timer will be released.


@Spotware

Spotware
10 Jun 2014, 09:34

We can recommend you to have a look at Sample Trend Robot. It uses indicators and checks their crosses.


@Spotware

Spotware
10 Jun 2014, 09:30

Unfortunately, we use some internal functions in Ichimoku Kinko Hyo indicator. Therefore it cannot be published.


@Spotware

Spotware
10 Jun 2014, 09:10

RE: RE: RE:

Marin0ss said:

Hi, Thank you very much! I left out te part in OnStart, as I don't want an order to be opened. (this will not cause any problems for the rest of the code?)

I would also like to Backtest this, this is not possible because of use of Server.Time; how must the code look to make this work?

I tried to replace Server.Time for MarketSeries.OpenTime.LastValue but this won't work.

 

Server.Time is emulated in backtesting, therefore you can backtest such cBot. Please do not forget to change TimeZones.UTC to the desired timezone.


@Spotware

Spotware
10 Jun 2014, 08:24

OnTick and MaketDepth.Updated are not synchronized. Even more MarketDepth.Updated event occurs more frequent than Tick happens. We can recommend you to use MarketDepth.Updated event and retrieve spot prices from the MarketDepth object. 


@Spotware

Spotware
10 Jun 2014, 08:20

We do not provide such API. You can post your idea to vote.spotware.com


@Spotware

Spotware
10 Jun 2014, 08:16

1) Yes, you can use an Indicator instead of cBot. In order to do that you need to create new Indicator in cAlgo and copy your code there. Please note that Indicator doesn't have OnStart and OnTick methods. You will need to use Initialize and Calculate methods instead. In Calculate method please do not forget to check IsRealTime property in order to filter historical bars.

2)  var filePath = @"C:\my folder\my file.txt";

3) There is no such method in cAlgo.API, but you can code such formatting.


@Spotware

Spotware
06 Jun 2014, 09:09

You can use the TimeFrame property of cBot

Print(TimeFrame);

 


@Spotware

Spotware
05 Jun 2014, 17:14

There is no such functionality at the moment. You can post your idea to vote.spotware.com 


@Spotware

Spotware
05 Jun 2014, 15:24

We do not disclose our broker list because of NDA agreements. We can only recommend you to do a simple internet search.


@Spotware

Spotware
05 Jun 2014, 09:01

cAlgo requires .NET Framework 4. It is not possible to run cAlgo under .NET Framework 4.5. Please install .NET Framework 4 and try again.


@Spotware

Spotware
04 Jun 2014, 11:23

RE:

floydprice said:

Yes, in this instance i'm running a virtual machine.

Is "Documents" a shared folder? Are you running your virtual machine on Mac?


@Spotware