MarketSeries.Close

Created at 16 Jan 2019, 22:29
How’s your experience with the cTrader Platform?
Your feedback is crucial to cTrader's development. Please take a few seconds to share your opinion and help us improve your trading experience. Thanks!
PM

pmcarvalho

Joined 16.01.2019

MarketSeries.Close
16 Jan 2019, 22:29


Hi

I use the MarketSeries.Close to get the close price of older periods.

But how can i get close prices of even older periods?

 Print(MarketSeries.Close[5000]); -> NaN

Thanks


@pmcarvalho
Replies

PanagiotisCharalampous
17 Jan 2019, 15:40

Hi pmcarvalho,

Currently Close Series contains only values that are displayed on the chart. To get more values, you will need to scroll the chart to the left. See an example below.

using System;
using System.Linq;
using cAlgo.API;
using cAlgo.API.Indicators;
using cAlgo.API.Internals;
using cAlgo.Indicators;

namespace cAlgo.Robots
{
    [Robot(TimeZone = TimeZones.UTC, AccessRights = AccessRights.None)]
    public class NewcBot : Robot
    {
        protected override void OnStart()
        {
            Chart.ScrollXTo(0);

        }

        private void Positions_Closed(PositionClosedEventArgs obj)
        {

        }

        protected override void OnBar()
        {
            Print(MarketSeries.Close.Last(5000));
        }

        protected override void OnStop()
        {
            // Put your deinitialization logic here
        }
    }
}

Best Regards,

Panagiotis


@PanagiotisCharalampous

pmcarvalho
24 Jan 2019, 22:48

Hi Panagiotis

I have tried your code but it does not work. 

Error CS0117: 'cAlgo.API.Chart' does not contain a definition for 'ScrollXTo'

Am I missing something?

Thanks


@pmcarvalho

PanagiotisCharalampous
25 Jan 2019, 09:42

Hi pmcarvalho,

Which version of cTrader do you use? This function is available in v3.3 and above.

Best Regards,

Panagiotis


@PanagiotisCharalampous

pmcarvalho
25 Jan 2019, 15:19

I think I have the latest version.
But at the top of the application appears FxPro cTrader 3.0
But I downloaded it right now and I ran the setup and it still says the same thing.
I can not find this new version.

Thanks


@pmcarvalho

pmcarvalho
25 Jan 2019, 15:24

RE:

pmcarvalho said:

I think I have the latest version.
But at the top of the application appears FxPro cTrader 3.0
But I downloaded it right now and I ran the setup and it still says the same thing.
I can not find this new version.

Thanks

It's Beta???


@pmcarvalho

PanagiotisCharalampous
25 Jan 2019, 15:52

Hi pmcarvalho,

FxPro does not offer the latest version of cTrader yet. You will have to wait a bit more.

Best Regards,

Panagiotis


@PanagiotisCharalampous

pmcarvalho
25 Jan 2019, 16:22

So there is no way to solve my question?

Thanks


@pmcarvalho