Forex Tester Forum (Professional Training Software for Traders) Forum Index Forex Tester Forum (Professional Training Software for Traders)

Back to main site   Risk disclosure
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Indicator return value

 
Post new topic   Reply to topic    Forex Tester Forum (Professional Training Software for Traders) Forum Index -> FT API
View previous topic :: View next topic  
Author Message
Eve



Joined: 28 Mar 2012
Posts: 19

PostPosted: Fri Apr 06, 2012 10:02 am    Post subject: Indicator return value Reply with quote

Hello!

I've programmed the indicator which i would like to use inside the strategy. The indicator is working fine but the problem is that at this point it's just graphical solution which means that it's just drawing some lines and not returning any values which i could use while prgramming the strategy.

How can I do that?
If I want to return the value which i could later grab with the GetIndicatorValue function what should i change inside the Calculate procedure?

Thanx a lot!
Back to top
View user's profile Send private message
FT Support



Joined: 11 Jul 2009
Posts: 901

PostPosted: Sat Apr 07, 2012 7:33 pm    Post subject: Reply with quote

Hello,

Is it correct that you're just using graphical objects instead of buffers?

You can only get buffers values with GetIndicatorValue but not objects values.

There are 2 options how you can transfer indicator values to the strategy:

1) create invisible buffers (recommended)
2) export objects information into the files and then read these files with strategy.

_________________
Check our other products here:
www.fx-metropolis.com
www.forexcopier.com
Back to top
View user's profile Send private message Visit poster's website
Eve



Joined: 28 Mar 2012
Posts: 19

PostPosted: Tue Apr 10, 2012 8:35 am    Post subject: Reply with quote

Thank you for the reply!

I have a problem using GetIndicatorValue function. I'm getting zero value all the time... Can you please explain the parameters of the function a bit more? I've read the help files but i'm still not sure that i'm using it correctly.
I have 3 visible buffers and one invisible buffer in the indicator which i listed in that order (inside the indicator). Is the Buffer Index automaticly selected or? Should the bufferIndex for the invisible buffer in this case be number 3?

And what about index inside the indicator's buffer? If u understood it correctly that's the index as the index of a bar??

Thank you in advance!
Back to top
View user's profile Send private message
Eve



Joined: 28 Mar 2012
Posts: 19

PostPosted: Tue Apr 10, 2012 3:37 pm    Post subject: Reply with quote

Just to explain it into a little bit more details...

Inside the indicator i created index buffer which i would like to get from the strategy with:

TIndexBuffer izlaz;

inside the init procedure:
izlaz=CreateIndexBuffer();
SetIndexBuffer(10,izlaz);

and just so i can check if it's working inside the calculate procedure i put the line:

izlaz[0]=555;


inside the strategy i'm trying to get the value with the following code:

int indicatorMoje;
double VrijednostMoje;

inside the reset procedure:
sprintf(buff1,"%d;%d;%d;%d;Close;Yes;No;No;No;Yes;%d;Yes;Yes;0.001;No;No",9,4,6,7,1Cool;
indicatorMoje=CreateIndicator(Currency, TimeFrame, "Moje", buff1);

inside the GetSingleTick procedure:
VrijednostMoje=GetIndicatorValue(indicatorMoje,0,10);
sprintf(pomocno,"%f", VrijednostMoje);
Print(pomocno);

In the end it's printing only zeros... What am I doing wrong?
Back to top
View user's profile Send private message
FT Support



Joined: 11 Jul 2009
Posts: 901

PostPosted: Tue Apr 10, 2012 7:30 pm    Post subject: Reply with quote

Hello Eve,

Can you receive the values of other buffers?

did you get indicator handle in "indicatorMoje" variable or it is equal to 0 ?

_________________
Check our other products here:
www.fx-metropolis.com
www.forexcopier.com
Back to top
View user's profile Send private message Visit poster's website
Eve



Joined: 28 Mar 2012
Posts: 19

PostPosted: Wed Apr 11, 2012 7:02 am    Post subject: Reply with quote

Hi,

Yes, I got indicator handle in "indicatorMoje"; tried to print it and everything was ok...

But I keep receiving zeros for all buffers...
Back to top
View user's profile Send private message
Eve



Joined: 28 Mar 2012
Posts: 19

PostPosted: Wed Apr 11, 2012 7:07 am    Post subject: Reply with quote

is it ok to use

izlaz[0]=555;

the way i described above to set the indicator to that value?
Back to top
View user's profile Send private message
Eve



Joined: 28 Mar 2012
Posts: 19

PostPosted: Wed Apr 11, 2012 7:18 am    Post subject: Reply with quote

I figured it out! Smile

Thank you for the help! Smile
Back to top
View user's profile Send private message
edoughig



Joined: 15 May 2013
Posts: 7

PostPosted: Fri May 17, 2013 8:25 pm    Post subject: Reply with quote

Eve wrote:
I figured it out! Smile

Thank you for the help! Smile


What did you figure out as I am having the same issue. All I get are 0.0s from my custom indicator. Here's some code.

In ResetStrategy:
if(FGDIHandle == -1)
{
char fgdiInputs[1000];
sprintf(fgdiInputs, "%d;%d;%f;%f;", FGDIPeriod, FGDIPriceType, FGDIRandomLine, FGDIStdDevs);
FGDIHandle = CreateIndicator(Currency, Timeframe, "FGDI", fgdiInputs);
}

In GetSingleTick:
double fgdiLower = GetIndicatorValue(FGDIHandle, Shift, 2);
double test = GetIndicatorValue(FGDIHandle, Shift, 0);
double test1= GetIndicatorValue(FGDIHandle, 0, 2);
double test2 = GetIndicatorValue(FGDIHandle, 0, 0);

The indicator has 3 visible buffers and it prints fine in history mode attached to a chart. I am trying to get the last index/bar value of the third buffer (index 2). As a test I added the above calls to try to retrieve the 0-index value from buffer index 0 and 2, but no luck. I keep getting 0.0 on every bar...

Any ideas? And yes, FGDIHandle is valid and the journal shows that my indicator was created with the proper inputs.

EDIT: I should add that I can retrieve valid values from a built in indicator "ZigZag".
Back to top
View user's profile Send private message
edoughig



Joined: 15 May 2013
Posts: 7

PostPosted: Fri May 17, 2013 9:25 pm    Post subject: Reply with quote

edoughig wrote:
Eve wrote:
I figured it out! Smile

Thank you for the help! Smile


What did you figure out as I am having the same issue. All I get are 0.0s from my custom indicator. Here's some code.

In ResetStrategy:
if(FGDIHandle == -1)
{
char fgdiInputs[1000];
sprintf(fgdiInputs, "%d;%d;%f;%f;", FGDIPeriod, FGDIPriceType, FGDIRandomLine, FGDIStdDevs);
FGDIHandle = CreateIndicator(Currency, Timeframe, "FGDI", fgdiInputs);
}

In GetSingleTick:
double fgdiLower = GetIndicatorValue(FGDIHandle, Shift, 2);
double test = GetIndicatorValue(FGDIHandle, Shift, 0);
double test1= GetIndicatorValue(FGDIHandle, 0, 2);
double test2 = GetIndicatorValue(FGDIHandle, 0, 0);

The indicator has 3 visible buffers and it prints fine in history mode attached to a chart. I am trying to get the last index/bar value of the third buffer (index 2). As a test I added the above calls to try to retrieve the 0-index value from buffer index 0 and 2, but no luck. I keep getting 0.0 on every bar...

Any ideas? And yes, FGDIHandle is valid and the journal shows that my indicator was created with the proper inputs.

EDIT: I should add that I can retrieve valid values from a built in indicator "ZigZag".


Ok, I figured out my problem. Wanted to let anyone else reading this know. My custom indicator used an Enum type input and I was passing in the int value from my strategy. You have to pass in the string label of the option value...
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Forex Tester Forum (Professional Training Software for Traders) Forum Index -> FT API All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You can attach files in this forum
You can download files in this forum


Powered by phpBB © 2001, 2005 phpBB Group