Getting a buffer value from the previous bar

How to create strategies and indicators
Message
Author
Konval
Posts: 5
Joined: Mon Jan 31, 2011 8:30 am

Getting a buffer value from the previous bar

#1 Postby Konval » Thu May 26, 2011 4:27 pm

Hallo!

I have a C++ problem.
I want to develop my own EMA.
How can I get the previous EMA?

I have this:

TIndexBuffer ema;


And in the Calculate function:

double GetPrevEma;
GetPrevEma=ema.GetValue(index+1);

But this doesn't work.
How can I get the value of a buffer from the previous bar?

Many thanks.

Best Regards.

FT Support
Posts: 905
Joined: Sat Jul 11, 2009 10:54 am

#2 Postby FT Support » Sat May 28, 2011 10:30 am

I'm not C++ programmer, but i'd recommend to change "ema.GetValue(index+1)" with "ema[index+1]" maybe these constructions are same but i'm not sure.

can you post the whole code of your indicator? are you sere that buffer is populated correctly?
Check our other product here:
http://www.forexcopier.com

Konval
Posts: 5
Joined: Mon Jan 31, 2011 8:30 am

#3 Postby Konval » Mon May 30, 2011 9:32 am

You are right!

ema[index+1]

This works well.

Thanks a lot.


Return to “FT API”

Who is online

Users browsing this forum: No registered users and 10 guests