CreateIndicator() always returns 0 - please respond

Examples step by step how to make your own automated strategy or user indicator
Message
Author
fx_pete
Posts: 17
Joined: Mon Jan 30, 2012 2:31 pm

CreateIndicator() always returns 0 - please respond

#1 Postby fx_pete » Thu Feb 02, 2012 1:25 am

I am trying to code a simple demo strategy ... I got lesson #1 to run fine but now I am trying my own logic.

I tried creating 2 EMA indicators but it looks like the CreateIndicator() always returns 0 ... can anyone please give me asugestion as to what may be causing this?

EXPORT void __stdcall ResetStrategy()
{
char ema05_buff[1000];
char ema13_buff[1000];

// define parameters
sprintf(ema05_buff, "%d;0;0;%s;Close", sTerm, StrMAType(ma_EMA));
sprintf(ema13_buff, "%d;0;0;%s;Close", lTerm, StrMAType(ma_EMA));

// create the Moving Average indicators
indEMA_05 = CreateIndicator(currency, timeFrame, "EMA_05", ema05_buff);
indEMA_13 = CreateIndicator(currency, timeFrame, "EMA_13", ema13_buff);
}


where sTerm, lTerm are integers to define periods of the 2 EMAs and
currency = "EURUSD" and TimeFrame is integer defining the 5min time frame.

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

#2 Postby FT Support » Thu Feb 02, 2012 7:31 am

Hello,

What indicator are you trying to add? is it MA with EMA type?

it is important to pass indicator's parameters in a correct form.
Please see more info on "Strategies guide -> API description -> Functions -> Access to indicators -> List of indicator's parameters" page of "Help -> Strategies API"
Last edited by FT Support on Mon Feb 06, 2012 12:49 pm, edited 1 time in total.
Check our other product here:
http://www.forexcopier.com

fx_pete
Posts: 17
Joined: Mon Jan 30, 2012 2:31 pm

RE:

#3 Postby fx_pete » Thu Feb 02, 2012 12:08 pm

thanks for your reply ...

... after stepping the debugger into CreateIndicator() I realized what the problem was: I thought that the parameter Indicator Name was to be "my" name for the indicator, instead it has to the name of indicator as expected by FX Tester so that the compilier can find its .dll. Everything ok now.

Thanks.

Peter


Return to “Programming lessons”

Who is online

Users browsing this forum: No registered users and 13 guests