Using Indicators in Strategies

Bug reports and errors in the program
Message
Author
yousky
Posts: 15
Joined: Tue Apr 24, 2007 3:33 pm

Using Indicators in Strategies

#1 Postby yousky » Thu Jul 26, 2007 3:43 pm

Hello Terranin,

I'm trying to use 2 indicators in my strategy but have some problems :-(, here what I have done (summary):

var
IndRSI,
IndATR: Integer;
.....
procedure ResetStrategy; stdcall;
begin
IndATR := CreateIndicator('GBPUSD', PERIOD_H1, 'ATR', '21;Close');
IndRSI := CreateIndicator('GBPUSD', PERIOD_H1, 'RSI', '21;Close');
end;
......
procedure GetSingleTick; stdcall;
var
cnt: Integer;

begin
// check our currency
if Symbol <> string(Currency) then exit;

// set currency and timeframe
SetCurrencyAndTimeframe(Symbol, TimeFrame);

if Bars < 30 then exit;

Print(FloatToStr(GetIndicatorValue(IndATR, 0, 0)));
Print(FloatToStr(GetIndicatorValue(IndRSI, 0, 0)));
..........
end;


So I create 2 indicators (ATR & RSI with params as 14 and Close), in ResetStrategy function according to the help file. But only one is showing during strategy :-(, the first one.

Then, in the GetSingleTick, I need to access values from those indicators so I use the GetIndicatorValue function.

The first call of this function to the ATR indicator give me the good value, but the second one to the RSI don't give me the RSI value, but the ATR value :-( ....

And if I change the order of the indicators creation like this :

procedure ResetStrategy; stdcall;
begin
ticket := -1;
IndRSI := CreateIndicator('GBPUSD', PERIOD_H1, 'RSI', '21;Close');
IndATR := CreateIndicator('GBPUSD', PERIOD_H1, 'ATR', '21;Close');
end;

Now the first retrieved value from IndATR give me the RSI value and the IndRSI give me the good value of RSI.

More over, during the reset of the strategy just in the beginning, in the log window in forextester, 2 lines are written like this :

Connecting to history server...
Created new indicator ATR.dll, (21;Close) <=
Found indicator with same params: RSI.dll, (21;Close) <= Why not like above ???
Congratulations. Connection is successful.


Can you explain me what is wrong :)
Thanks
Yousky

User avatar
Terranin
Site Admin
Posts: 833
Joined: Sat Oct 21, 2006 4:39 pm

#2 Postby Terranin » Sun Nov 04, 2007 1:41 pm

Fixed.
Hasta la vista
Mike


Return to “Bug reports”

Who is online

Users browsing this forum: No registered users and 36 guests