icustom output?

 

if I use:

Variable=iCustom()

indicating the name of script and the buffer # from within the script

the returned variable is: the position in decimal value of the height of the indicator right?

Or does it return a different value?

 
ricloud:

if I use:

Variable=iCustom()

indicating the name of script and the buffer # from within the script

the returned variable is: the position in decimal value of the height of the indicator right?

Or does it return a different value?


How do you use iCustom() function this way it is not working
Variable=iCustom()

Don't know what tineframe, symbol, indicator, parameters of indicator, the bufferarray the value has come from and for what bar you want to know that value

If you fill in that first and then do the question we see what you are doing and we can help the way you like

https://docs.mql4.com/indicators/iCustom

So basiccally what it has to do is "giving the value of the bufferarray of the indicator for the bar you ask for"

 
deVries:

How do you use iCustom() function this way it is not working

Don't know what tineframe, symbol, indicator, parameters of indicator, the bufferarray the value has come from and for what bar you want to know that value

If you fill in that first and then do the question we see what you are doing and we can help the way you like

https://docs.mql4.com/indicators/iCustom

So basiccally what it has to do is "giving the value of the bufferarray of the indicator for the bar you ask for"


Variable=iCustom(NULL,0,"Indicator",0,1); 
no parameters (the "...")=none, buffer=0, current time frame(1 pip previous).
It should return a numerical value according to the position of the previous time interval of line0 right? or am I misunderstanding something?
 
//+------------------------------------------------------------------+
//| ATRChannel.mq4
//| Copyright © Pointzero-indicator.com
//+------------------------------------------------------------------+
#property copyright "Copyright © Pointzero-indicator.com"
#property link      "http://www.pointzero-indicator.com"

//---- indicator settings
#property indicator_chart_window
#property indicator_buffers 2
#property indicator_color1 Red
#property indicator_color2 DodgerBlue

//---- indicator parameters
extern bool CalculateOnBarClose = true;
extern bool UseMedianPrice      = false;
extern int  ATRPeriod           = 14;

//---- indicator buffers
double ExtMapBuffer1[];
double ExtMapBuffer2[];

//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int init()
  {
   // Drawing settings
   SetIndexStyle(0,DRAW_LINE);
   SetIndexStyle(1,DRAW_LINE);
   IndicatorDigits(MarketInfo(Symbol(),MODE_DIGITS));
   
   // Name and labels
   IndicatorShortName("ATRChannel");
   SetIndexLabel(0,"Upper Channel");
   SetIndexLabel(1,"Lower Channel");
   
   // Buffers
   SetIndexBuffer(0,ExtMapBuffer1);
   SetIndexBuffer(1,ExtMapBuffer2);
   
   Comment("Copyright © http://www.pointzero-indicator.com");
   return(0);
  }
//+------------------------------------------------------------------+
//| Custom indicator iteration function                              |
//+------------------------------------------------------------------+
int start()
  {
     // Start, limit, etc..
     int start = 0;
     int limit;
     int counted_bars = IndicatorCounted();

     // check for possible errors
     if(counted_bars < 0) 
        return(-1);
        
     // Only check these
     limit = Bars - 1 - counted_bars;
    
     // Check if ignore bar 0
     if(CalculateOnBarClose == true) start = 1;
    
     // Check the signal foreach bar
     for(int i = limit; i >= start; i--)
     {           
         // Median
         double high = iHigh(Symbol(), 0, i);
         double low  = iLow(Symbol(), 0, i);
         double median = (high + low) / 2;
         
         // Atr
         double atr = iATR(Symbol(), 0, ATRPeriod, i);
         
         // Draw
         if(UseMedianPrice)
         {
            ExtMapBuffer1[i] = median + atr;
            ExtMapBuffer2[i] = median - atr;
         } else {
            ExtMapBuffer1[i] = high + atr;
            ExtMapBuffer2[i] = low - atr;
         }
     }
   
   // Bye Bye
   return(0);
  }
//+------------------------------------------------------------------+

https://www.mql5.com/en/code/10687 This indicator you can find here

Look to the picture at that topic the indicator is showing a blue and a red line on the chart

You want to know the value of the red line above bar number 8 for the time frame one hour and for the currency "GBPUSD"

QUESTION FOR ricloud How do you do that with iCustom( .......) ???

 
deVries:

https://www.mql5.com/en/code/10687 This indicator you can find here

Look to the picture at that topic the indicator is showing a blue and a red line on the chart

You want to know the value of the red line above bar number 8 for the time frame one hour and for the currency "GBPUSD"

QUESTION FOR ricloud How do you do that with iCustom( .......) ???


Yes, that Is what I would like to get. Is the position of the red or blue line in numerical format. I take it from your response that this is not the output that iCustom() gives. I was unsure which is why I asked

...Or does it return a different value?

So what output is iCustom() actually giving me? and how would I get the position of the red or blue line in numerical format?

Thanks for baring with me so far, I'm relatively new to this language in particular.

 
ricloud:

So what output is iCustom() actually giving me? and how would I get the position of the red or blue line in numerical format?

Thanks for baring with me so far, I'm relatively new to this language in particular.

Have a read of this thread: https://www.mql5.com/en/forum/138594

and this thread: https://www.mql5.com/en/forum/138577

 
RaptorUK:

Have a read of this thread: https://www.mql5.com/en/forum/138594

and this thread: https://www.mql5.com/en/forum/138577


1st thread uses objects;the indicators I'm using don't(gave it a read-through anyways).

2nd thread brached off into many other topics (which I also read) saying things like "iCustom() returns a double" and debates on whether or not external values need to be included in iCustom() //I always include them anyways so this is not an issue.




I understand how to use iCustom, or atleast input the required parameters, what I'm confused about is what the output is.
documentation says: "Calculates the specified custom indicator and returns its value" (sounds like what I want to do)


Using ATRChannel posted by deVries as an exmple:

VariableRedCurrent=iCustom(NULL,0,"ATRChannel",true,false,14,0,0);
VariableRedPrevious=iCustom(NULL,0,"ATRChannel",true,false,14,0,1);

VariableBlueCurrent=iCustom(NULL,0,"ATRChannel",true,false,14,1,0);
VariableBluePrevious=iCustom(NULL,0,"ATRChannel",true,false,14,1,1);
Does this mean it will return to me the value of the red/blue lines? (this is what I want to achieve)
By "value" I mean numerical data of said position(current or previous) on the graph, which in this case would be between 1.2 and 1.6(25 Feb - 29 Oct) in the picture.

or am I in need of using a different function(s) to achieve this?

 
Attach any indicator. Open Data Window (Ctrl + D) on MetaTrader, move your cursor around the chart, what you see on Data Window is what the value of attached indicator. Use iCustom to get those values.
 
ricloud:

I understand how to use iCustom, or atleast input the required parameters, what I'm confused about is what the output is.

This is the output: https://www.mql5.com/en/forum/138577
 
ricloud:

VariableRedCurrent=iCustom(NULL,0,"ATRChannel",true,false,14,0,0);
VariableRedPrevious=iCustom(NULL,0,"ATRChannel",true,false,14,0,1);





VariableBlueCurrent=iCustom(NULL,0,"ATRChannel",true,false,14,1,0);
VariableBluePrevious=iCustom(NULL,0,"ATRChannel",true,false,14,1,1);

Using ATRChannel posted by deVries as an exmple:

Does this mean it will return to me the value of the red/blue lines? (this is what I want to achieve)
By "value" I mean numerical data of said position(current or previous) on the graph, which in this case would be between 1.2 and 1.6(25 Feb - 29 Oct) in the picture.

or am I in need of using a different function(s) to achieve this?


Now trie it out use your metaeditor and you can check it....

what it has to do is "giving the value of the bufferarray of the indicator for the bar you ask for"

You can make a program to check the outcome of the function in this program you gonna use the same settings as in the indicator

Then you can read the outcome of the function

Place the indicator "ATRChannel" also on this chart with the mouse pointing at the blue or red line you can read the value of that point

This way you can check yourself......

Can you answer now this question ???

You want to know the value of the red line above bar number 8 for the time frame one hour and for the currency "GBPUSD"

QUESTION FOR ricloud How do you do that with iCustom( .......) ???

 
ricloud:
Does this mean it will return to me the value of the red/blue lines? (this is what I want to achieve)
Yes!
Reason: