View Single Post
 
Old 11-11-2005, 01:31 AM
codersguru's Avatar
codersguru codersguru is offline
Senior Member
 
Join Date: Oct 2005
Posts: 994
codersguru has a spectacular aura aboutcodersguru has a spectacular aura aboutcodersguru has a spectacular aura about
Lightbulb 214783647 means there's an error!

Quote:
Originally Posted by homicida
hi

i tested it ,your code works well.....
but that dosent fix the problem^^

i got the returnvalue like you said but its allways the same value no madder what the trend really is its 214783647 all the time.

i searched the value in the indicatorcode there are 3 buffers and the buffer that holds the 214783647 is the trend not the value that stored in it

like

if buffer1 holds the 214783647 means trend up,other 2 buffers holds then something like 174...

if buffer2 holds the 214783647 means trend down,other 2 buffers holds then something like 174...

could that cause the problem?


greets homi
Hi homi,

I think there's an error in your iCustom call.
Anyway, here is the code which will call iCustom of LSMA to return the value of its 3 lines.

Note 1: The values of the 3 lines are the same because LSMA is color indicator (if you want to know more ask me)

Note 2: 214783647 is an error. I included in the demo example some lines of code which will return the same error to make it clear for you.


PHP Code:
//+------------------------------------------------------------------+
//|                                                 iCustom_Demo.mq4 |
//|                                                    Coders' Guru. |
//|                                         http://www.forex-tsd.com |
//+------------------------------------------------------------------+
#property copyright "Coders Guru"
#property link      "http://www.forex-tsd.com"

#property indicator_chart_window
//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int init()
  {
//---- indicators
//----
   
return(0);
  }
//+------------------------------------------------------------------+
//| Custor indicator deinitialization function                       |
//+------------------------------------------------------------------+
int deinit()
  {
//---- 
   
//----
   
return(0);
  }
//+------------------------------------------------------------------+
//| Custom indicator iteration function                              |
//+------------------------------------------------------------------+
int start()
  {
   
int    counted_bars=IndicatorCounted();
//---- 
  
  
Alert("Line3 on LSMA is: " iCustom(NULL,0,"LSMA in Color",14,1500,2,0));
  
Alert("Line1 on LSMA is: " iCustom(NULL,0,"LSMA in Color",14,1500,0,0));
  
Alert("Line2 on LSMA is: " iCustom(NULL,0,"LSMA in Color",14,1500,1,0));
  
  
//Some mis-typed iCustom calls which will return:
  
  //Wrong LSMA parameter 
  
Alert("This is an error " iCustom(NULL,0,"LSMA in Color",0,1500,0,0));
  
//Wrong line number 
  
Alert("This is an error " iCustom(NULL,0,"LSMA in Color",14,1500,3,0));
  
//Wrong Bar number 
  
Alert("This is an error " iCustom(NULL,0,"LSMA in Color",14,1500,3,counted_bars)); 
 
//----
   
return(0);
  }
//+------------------------------------------------------------------+ 
Attached Files
File Type: mq4 iCustom_Demo.mq4 (2.0 KB, 171 views)
__________________
Hope it helps !
Coders' Guru
Senior MQL programmer:
www.xpworx.com/custom.htm