Custiom indicators, experts and strategy testing

 
Greetings,

I am facing the following problem:

I created an expert advisor and a custom indicator designed to work together. However, when I try to access the indicator's data from the expert by using the iCustom function, I am unable to get any values other than zero.

Here's the headers for the indicator:

#property indicator_chart_window
#property indicator_buffers 1
#property indicator_color1 Red

SetIndexStyle(0,DRAW_LINE);
SetIndexBuffer(0,ExtMapBuffer1);
IndicatorShortName("LME");
SetIndexDrawBegin(0,draw_begin);

It works perfectly when attached by itself to the chart. I then try calling the indicator by using this function:

iCustom(NULL,0,"LME",50,0,0);

where 50 is a parameter required by my indicator. I've tried different values in the last two arguments with no luck, it always returns a 0 value. The journal reports the indicator was loaded succesfuly.

All this is happening in the Strategy Tester, since it's a weekend I've been unable to do real-time testing.

Any help regarding this issue would be greatly appreciated.
 
Use that:
double myIndicator=iCustom(NULL,0,"LME",50,0,0);
Print("My indicator's value=",myIndicator);
 
Rosh:
Use that:
double myIndicator=iCustom(NULL,0,"LME",50,0,0);
Print("My indicator's value=",myIndicator);

Same result as last time. Any other ideas?

Thanks for the reply.

 
Rosh:
Use that:
double myIndicator=iCustom(NULL,0,"LME",50,0,0);
Print("My indicator's value=",myIndicator);




I think this question of mine is also related to this topic.If not, excuse me for disturbing.

I used a custom Indicator in an EA using iCustom(), then I used Startegy tester for that EA. How can I see my indicator behaviour on chart while using Strategy Tester? I need it during backtest because I want exact value of my custom indicator every minute, as I asked you afew days ago.

Plus:
My Indicator uses a user defined library which outputs CSV files and shows some arrows on chart. This usually works well. does it work during back testing?

thanks

 
Press "Open chart" button in the tester settings tab after testing
 

Ask how I can use the automatic transaction system parameter how to suppose

me to be possible to join the parameter?

 
Guru:
Greetings,

It works perfectly when attached by itself to the chart. I then try calling the indicator by using this function:

iCustom(NULL,0,"LME",50,0,0);

where 50 is a parameter required by my indicator. I've tried different values in the last two arguments with no luck, it always returns a 0 value. The journal reports the indicator was loaded succesfuly.

It suppose to give a 0 value because you are using it in a wrong way. If you have a indicator which calculates moving average, for example, and you are using more than one variable then this 50 will be which one? What you could do is:
1. declare variable, let's call it "something", at the global level in your indicator code. It is at the beginning where
#property indicator_chart_window
#property indicator_buffers 1
#property indicator_color1 Red
are. ideal would be probably use
extern int something=50;
but you can use just
int something=50;

2.you declare "something" in your expert as well. somewhere inside your expert you say how much this somethis is suppose to be -> int something=51
3. you call your indicator by iCustom(NULL,0,"LME,something,0,0);
if it still gives zero or some very big result then try iCustom(NULL,0,"LME", something, 0,1); as some indicator codes can't give result at the moment but they have a result for one or more period back.

sometimes you need to use more than one variable, so it will look something like:
iCustom(NULL,0,"LME",something1,something2, something3,0,0);

Hope it helps you to use this function!
Reason: