Hi Kima,
I believe that if you specify no input parameters the default values will be used automatically, see below:
int iCustom( string symbol, // symbol name ENUM_TIMEFRAMES period, // period string name // folder/custom indicator_name ... // list of indicator input parameters );
Parameters
symbol
[in] The symbol name of the security, the data of which should be used to calculate the indicator. The NULL value means the current symbol.
period
[in] The value of the period can be one of the ENUM_TIMEFRAMES values, 0 means the current timeframe.
name
[in] The name of the custom indicator, with path relative to the root directory of indicators (MQL5/Indicators/). If an indicator is located in a subdirectory, for example, in MQL5/Indicators/Examples, its name must be specified like: "Examples\\indicator_name" (it is necessary to use a double slash instead of the single slash as a separator).
...
[in] input-parameters of a custom indicator, separated by commas. Type and order of parameters must match. If there is no parameters specified, then default values will be used.
I see i messed up the post, after a review it works now. At least i dont get the error anymore.
But now how to get the data from the indicator..
void OnTick() { for(int i=0;i<symbols;i++) { Print(get_Custom(handles[i],0)); } } double get_Custom(int handle,int bar) { double lw[1]={0}; CopyBuffer(handle,0,bar,1,lw); return(lw[0]); }
Ive red the copybuffer part an reviewed a view other example EA's but i dont get it yet..
With the code above i thought i can get the information from the indicater:
"SetIndexBuffer(0,UpSignal,INDICATOR_DATA); PlotIndexSetInteger(0,PLOT_ARROW,108);"
is set to true or false.
So i thought in the copybuffer the 0 before the 'UpSignal' was:
int start_pos, // start position
Or am i thinking the wrong way?
iCustom returns the handle of the indicator. You have to create an array and then copy the inidicator's buffer to it. Then you access the data as you would an array.
Example:
handle = iCustom( etc....
double indicatorName[]; //rezise this to the amount of data you want to get, countToRetrieve below
ArraySetAsSeries(indicatorName,true); //ensures, the latest value is at the beginning of the buffer.
CopyBuffer(handle,bufferNumer,start,countToRetrieve,indicatorName);
To get the current value, you invoke indicatorName[0].
Mike
I see i messed up the post, after a review it works now. At least i dont get the error anymore.
But now how to get the data from the indicator..
Ive red the copybuffer part an reviewed a view other example EA's but i dont get it yet..
With the code above i thought i can get the information from the indicater:
"SetIndexBuffer(0,UpSignal,INDICATOR_DATA); PlotIndexSetInteger(0,PLOT_ARROW,108);"
is set to true or false.
So i thought in the copybuffer the 0 before the 'UpSignal' was:
int start_pos, // start position
Or am i thinking the wrong way?
I don't understand what you mean by "So i thought in the copybuffer the 0 before the 'UpSignal' was: in start_pos ...". Where's the 0 before 'UpSignal' ?.
With your code, you will get the data of the current bar. The current bar may not yet fully develop, and so the indicator may not draw anything yet. Also this indicator only draw some dot, so it possible that it won't draw dot at all.
To solve this, get the indicator data of bar 1 instead of bar 0.
void OnTick() { for(int i=0;i<symbols;i++) { Print(get_Custom(handles[i],1)); //--- data of bar 1 } } double get_Custom(int handle,int bar) { double lw[1]={0}; CopyBuffer(handle,0,bar,1,lw); return(lw[0]); }

- www.mql5.com

- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
Ive tried to load this indicator to my EA: https://www.mql5.com/en/forum/9660/page9#comment_411206
But i need some help..
Ive tried:
My idea was that with:
handles2[0]=iCustom(symbol[0],Time_Frame,"PriceChannel_Signal_v1");
it would just load the standaard inputs from the indicator self .. But it still says "array out of range"