Hi everybody,
I wrote the following code to get the indexes from the LSMA indicator on the current bar:
index0=iCustom(NULL,0,"LSMA in Color",34,1500,0,0);
index1=iCustom(NULL,0,"LSMA in Color",34,1500,1,0);
index2=iCustom(NULL,0,"LSMA in Color",34,1500,2,0);
but it always give me the same value for
index0=1
index1=1
index2=1
how I can recognize the color of the indicator on the current bar ?
Please somebody help me . May be Phy ?
Your indicator has three indexes, for three colors.
Figure out which index corresponds to which color,
and when that index has a value in it which is near price for that bar,
that is your clue to the color.
Your index0/1/2 need to be type double.
You need to verify that your iCustom call is correctly formatted.
What you are doing "looks" ok, but you don't show all your code, so who knows.
Your indicator has three indexes, for three colors.
Figure out which index corresponds to which color,
and when that index has a value in it which is near price for that bar,
that is your clue to the color.
Your index0/1/2 need to be type double.
You need to verify that your iCustom call is correctly formatted.
What you are doing "looks" ok, but you don't show all your code, so who knows.
Hi Phy
thanks for your support.
Hereafter it's my code:
bool difference_found=false;
double LSMA_index0,LSMA_index1,LSMA_index2;
LSMA_index0=iCustom(NULL,0,"LSMA in Color",34,1500,0,0);
LSMA_index1=iCustom(NULL,0,"LSMA in Color",34,1500,1,0);
LSMA_index2=iCustom(NULL,0,"LSMA in Color",34,1500,2,0);
if(LSMA_index0 != LSMA_index1 || LSMA_index1!=LSMA_index2 || LSMA_index0!=LSMA_index2)
{
difference_found=true;
}
string sComment;
sComment="";
sComment=sComment+"LSMA color0=" +LSMA_index0+"\n";
sComment=sComment+"LSMA color1=" +LSMA_index1+"\n";
sComment=sComment+"LSMA color2=" +LSMA_index2+"\n";
sComment=sComment+"Difference found=" +difference_found+"\n";
Comment(sComment);
but it never set difference_found = true ;-(
The value of LSMA_index0, LSMA_index1, LSMA_index2 are always the same . Like this I never can find out which color is it.
Once I could clear identify a color changing I would like to write an EA that buy when color changed from red->green or from yellow -> green and sell when the opposite occurs.
Can you please HELP me ?
Thanks in advance
Fabio
Why don't you just post your code, Why make us guess?
Also, you posted a different indicator than what you are calling in your snips.
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
Hi everybody,
I wrote the following code to get the indexes from the LSMA indicator on the current bar:
index0=iCustom(NULL,0,"LSMA in Color",34,1500,0,0);
index1=iCustom(NULL,0,"LSMA in Color",34,1500,1,0);
index2=iCustom(NULL,0,"LSMA in Color",34,1500,2,0);
but it always give me the same value for
index0=1
index1=1
index2=1
how I can recognize the color of the indicator on the current bar ?