Pedro,
Not exactly sure what you're referring to here but I'll take a stab at it as it may well be of interest. Are you trying to write a custom indicator and store the data that that indicator refers to?
If that was available, I then presume you'd be able to apply a further indicator to this extracted custom indicator data - which would be pretty cool.
Did I get that right ? If so, then, yes, I am interested in getting information. Excuse my ignorance here, Pedro, as I've only just written my first expert but am getting there.
Cheers
Martin
Not exactly sure what you're referring to here but I'll take a stab at it as it may well be of interest. Are you trying to write a custom indicator and store the data that that indicator refers to?
If that was available, I then presume you'd be able to apply a further indicator to this extracted custom indicator data - which would be pretty cool.
Did I get that right ? If so, then, yes, I am interested in getting information. Excuse my ignorance here, Pedro, as I've only just written my first expert but am getting there.
Cheers
Martin
Hi Martin,
I don't mean store the data but you do get the idea.
So for example you write a custom indicator and in an expert you want to do say an average of the last 20 bars. Currently you would need to call icustom in a loop 20 times with the relevant shift value, sum each value then devide by 20. By doing this the indicator is loaded and unloaded 20 time in order to get each value which is an overhead in performance.
Ideally I would like to be able to make one call to icustom to return me the last 20 bars.
I have gotten arround this problem by creating a library and function for the indicators. So for I will illustrate using my own MA function
void pedMA( int period, double& aVal[], int nBars)
{
//nBars is the number of bars to process
//check aVal array size is less than nBars then resize to nBars
//loop to build the aVal Array
}
Then in the indicator I #include the library file. Then in the start function of the indicator I will do the following
double MapBuffer[]
int start()
{
int i;
int counted_bars=IndicatorCounted();
i=Bars-1;
if(counted_bars>1) i=Bars-counted_bars-1;
//MapBuffer is the indicator line to be drawn and populated by call to pedMA
pedMA(14, MapBuffer, i);
}
In an expert I could make use of the same function call to get the same values that the indicator has so I could call
double aVal;
pedMA(14, aVal, 20);
I could also make further call on this array data from the indicator say
iMAOnArray(aVal.......
It would be nice if Highest and Lowest functions in MT could accept an Array paramenter but they don't and it is easy enough to write such a function.
I hope this illustrates clearer what I meant in my original post, I have worked arround the problem but it would be nice if it was part of the core product.
Pedro
I don't mean store the data but you do get the idea.
So for example you write a custom indicator and in an expert you want to do say an average of the last 20 bars. Currently you would need to call icustom in a loop 20 times with the relevant shift value, sum each value then devide by 20. By doing this the indicator is loaded and unloaded 20 time in order to get each value which is an overhead in performance.
Ideally I would like to be able to make one call to icustom to return me the last 20 bars.
I have gotten arround this problem by creating a library and function for the indicators. So for I will illustrate using my own MA function
void pedMA( int period, double& aVal[], int nBars)
{
//nBars is the number of bars to process
//check aVal array size is less than nBars then resize to nBars
//loop to build the aVal Array
}
Then in the indicator I #include the library file. Then in the start function of the indicator I will do the following
double MapBuffer[]
int start()
{
int i;
int counted_bars=IndicatorCounted();
i=Bars-1;
if(counted_bars>1) i=Bars-counted_bars-1;
//MapBuffer is the indicator line to be drawn and populated by call to pedMA
pedMA(14, MapBuffer, i);
}
In an expert I could make use of the same function call to get the same values that the indicator has so I could call
double aVal;
pedMA(14, aVal, 20);
I could also make further call on this array data from the indicator say
iMAOnArray(aVal.......
It would be nice if Highest and Lowest functions in MT could accept an Array paramenter but they don't and it is easy enough to write such a function.
I hope this illustrates clearer what I meant in my original post, I have worked arround the problem but it would be nice if it was part of the core product.
Pedro
Thanks for the clarification, Pedro.
I was thinking of coding a Renko expert actually. I'm not after a graphical display as I don't see how Metatrader could display the price related movement as opposed to the time related charts currently in use.
I'm simply after a way to build an array / history file of valid Renko blocks and apply Moving Average, Keltner Channel indicators to these to extract data on which to apply a trading strategy.
Can you see this as being possible and, if so, steer me in the right direction with which to make a start ? Any help would be really cool, if you have the time (or inclination).
Best Regards
Martin
I was thinking of coding a Renko expert actually. I'm not after a graphical display as I don't see how Metatrader could display the price related movement as opposed to the time related charts currently in use.
I'm simply after a way to build an array / history file of valid Renko blocks and apply Moving Average, Keltner Channel indicators to these to extract data on which to apply a trading strategy.
Can you see this as being possible and, if so, steer me in the right direction with which to make a start ? Any help would be really cool, if you have the time (or inclination).
Best Regards
Martin
![MQL5 - Language of trade strategies built-in the MetaTrader 5 client terminal](https://c.mql5.com/i/registerlandings/logo-2.png)
You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
First gotta say I love MT4.
Is it possible to return the index array from a call to iCustom. The call to iCustom could be made once instead of put the call in a loop to build the array values to then be used which forces the custom indicator to be loaded and released for every call.
double arrayVal[];
double arrayValMA[];
// the 1000 would be the number of elements to return, then 0 would be the shift value, ie similar to calling highest
arrayVal = iCustom(NULL,0,"CustInd",,,,,0,1000,0) ;
this would then enable me to do this
arrayValMA = iMAOnArray(arrayVal,,,,,,,,
Other advantages would be say in an EA when checking for a cross for example only one call would need to be made to return the array instead of calling multiple times to get current and previous values.
Hope this makes sense. Would anyone else find this useful?
Pedro