Read history data and buffer data from custom indicator ( MQL "mode" and "shift" equivalent )

Created at 23 Mar 2014, 15:19
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!
DI

dimak

Joined 22.03.2014

Read history data and buffer data from custom indicator ( MQL "mode" and "shift" equivalent )
23 Mar 2014, 15:19


Hello ,

 

I'm trying to read history data from indicator buffer ( ZigZag Indicator ).

In MQL I used following code :

iCustom(Symbol(),Timeframe(),"ZigZag",ExtDepth,ExtDeviation,ExtBackstep,0,1)

Last values in this example are:

  mode : Line index. Can be from 0 to 7 and must correspond with the index, specified in call of the SetIndexBuffer() function.

  shift : Index of the value taken from the indicator buffer (shift relative to the current bar the given amount of periods ago).

How can I access these fields using CAlgo ? 

Here is source code of ZigZag Indicator : /algos/indicators/show/157

Thank you.

 

 


@dimak
Replies

Spotware
24 Mar 2014, 09:45

Please read Referencing Custom Indicators.

If you prefer shift-style indexes, you will like method Last of DataSeries class. 


@Spotware

6878977
02 Oct 2019, 22:54

RE:

Spotware said:

Please read Referencing Custom Indicators.

If you prefer shift-style indexes, you will like method Last of DataSeries class. 

But what about "mode"? How can I chose the buffer?

For example, I have an indicator, I know that it has 5 buffers. How can I get the data of the 3rd buffer 9 candles back?


@6878977

PanagiotisCharalampous
03 Oct 2019, 08:12

Hi 6878977,

Thanks for posting in our furum. Indicator outputs are explicitely defined in cTrader Automate. See below an example from Sample Alligator


        [Output("Jaws", LineColor = "Blue")]
        public IndicatorDataSeries Jaws { get; set; }

        [Output("Teeth", LineColor = "Red")]
        public IndicatorDataSeries Teeth { get; set; }

        [Output("Lips", LineColor = "Lime")]
        public IndicatorDataSeries Lips { get; set; }

If you want to get the data 9 candles back for e.g. Lips, you just need to call Lips.Last(9).

Best Regards,

Panagiotis


@PanagiotisCharalampous

6878977
03 Oct 2019, 09:48

RE:

Panagiotis Charalampous said:

Hi 6878977,

Thanks for posting in our furum. Indicator outputs are explicitely defined in cTrader Automate. See below an example from Sample Alligator

        [Output("Jaws", LineColor = "Blue")]
        public IndicatorDataSeries Jaws { get; set; }

        [Output("Teeth", LineColor = "Red")]
        public IndicatorDataSeries Teeth { get; set; }

        [Output("Lips", LineColor = "Lime")]
        public IndicatorDataSeries Lips { get; set; }

If you want to get the data 9 candles back for e.g. Lips, you just need to call Lips.Last(9).

Best Regards,

Panagiotis

Thanks so much for the quick reply!
What should I do if I don’t have the source code and I don’t see the name of the Data Series?

For example:

        [Output("Sweet Lips", LineColor = "Lime")]
        public IndicatorDataSeries Lips { get; set; }

So the display name is "Sweet Lips". The real name is "Lips". Remember, I don’t have the source code. How do I access this buffer?


@6878977

PanagiotisCharalampous
03 Oct 2019, 10:08

Hi 6878977,

If you do not have access to the source code, you cannot reference the indicator in your cBot.

Best Regards,

Panagiotis


@PanagiotisCharalampous

6878977
03 Oct 2019, 10:28

RE:

Panagiotis Charalampous said:

Hi 6878977,

If you do not have access to the source code, you cannot reference the indicator in your cBot.

Best Regards,

Panagiotis

OK, got it! Thank!


@6878977