How can I use my indicator in cBot

Created at 24 Jan 2016, 23:01
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!
AN

andrisom

Joined 24.01.2016

How can I use my indicator in cBot
24 Jan 2016, 23:01


Dear Spotware,

I am beginer in c#.

I created an indicator (myIndicator.algo) and I don't konw, how can I use it in my cBot.

I tried some method.

For exemple:

private myIndicator (???) my_indicator;

...

protected override void OnStart()
{

      my_indicator = Indicators.GetIndicator<myIndicator>();

...

Please help!

Thank you!

 

 

 


@andrisom
Replies

Spotware
25 Jan 2016, 02:17

Dear Trader,

Please have a look at the Referencing Custom Indicators section of our API Programmers Guides.


@Spotware

andrisom
25 Jan 2016, 09:39

RE:

Spotware said:

Dear Trader,

Please have a look at the Referencing Custom Indicators section of our API Programmers Guides.

Thank you very much!

The "Manage References" was the key. :)

I have one more question:

How can I get the OnBar() function "this (actual) bar" index?

protected override void OnBar( int bars ??? )
{

      double v = my_indicator.values[bars];

,,,,

Is the indicator values index the bar count?

The my_indicator.values.LastValue always put same value to me.

What is MT4 Bars in cBots?

Thank you!

ps. Sorry my English!


@andrisom

Spotware
25 Jan 2016, 23:13

Dear Trader,

What you are currently describe doesn't exist. 

Please have a look at the following code snippet, which could help you find the index.

int index = MarketSeries.Close.Count - 1;
double close = MarketSeries.Close[index];
double high = MarketSeries.High[index];
double low = MarketSeries.Low[index];
double open = MarketSeries.Open[index];

 


@Spotware

andrisom
26 Jan 2016, 09:47

RE:

Spotware said:

Dear Trader,

What you are currently describe doesn't exist. 

Please have a look at the following code snippet, which could help you find the index.

int index = MarketSeries.Close.Count - 1;
double close = MarketSeries.Close[index];
double high = MarketSeries.High[index];
double low = MarketSeries.Low[index];
double open = MarketSeries.Open[index];

 

Thanks a lot!


@andrisom