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
Hi Mladen!
I think the call of my iCustom ist right, because in test and normal (exporting data or use as indi)
it works fine so far. I think the problem is as you mentioned value double/array.
When I now use a
double mom1[];
mom1 = iCustom(NULL,0,"myIndi",0,i);
and than a -> mom(mom1,Bars,20,i);
-> "mom" - parameter conversation not allowed
How do I write this right?
Thanks a lot and bye, ATTry like this :
Also, change the mom function to be like this :
[PHP]double Mom(double& series[], int period, int totcount, int index) { if (totcount<1 || period<1) return (EMPTY_VALUE); if (indextotcount-1) return (EMPTY_VALUE); return (series-series); }Hi Mladen!
Thanks for your help!
My problem is, I need the "const" because other parts of the program need it...
To write "everything" new is too much work, so the question is, can I do it the other way around,
so that the mom1 works with the sub-function?
Thanks a lot and bye, AT
Hi Mladen!
Thanks for your help!
My problem is, I need the "const" because other parts of the program need it...
To write "everything" new is too much work, so the question is, can I do it the other way around,
so that the mom1 works with the sub-function?
Thanks a lot and bye, ATYou can use the mom function as is (and the rest)
Just change the mom(mom1,Bars,20,i); to mom(mom1,Bars,20,i);
then I get the error:
-> "mom1" - parameter conversation not allowed
man this is tricky... any other idea?
Thanks and bye, AT
then I get the error:
-> "mom1" - parameter conversation not allowed
man this is tricky... any other idea?
Thanks and bye, ATI do not get that error
See the example :
double buffer[];
int init() { SetIndexBuffer(0,buffer); return(0); }
int deinit() { return(0); }
int start()
{
double mom = Mom(buffer,10,50,0);
return(0);
}
double Mom(const double& series[], int period, int totcount, int index)
{
if (totcount<1 || period<1) return (EMPTY_VALUE);
if (indextotcount-1) return (EMPTY_VALUE);
return (series-series);
}Compiles with no errors at all
Hi Mladen!
Maybe it's because of a for {} function? (to get the Bars?) or because of...
the other point is: mom1 is a custom indi... mom1 = iCustom(NULL,0,"myIndi",0,i);
which i call here: mom(mom1,Bars,20,i);
Thanks for your help!!
Bye, AT
Hi Mladen!
Maybe it's because of a for {} function? (to get the Bars?) or because of...
the other point is: mom1 is a custom indi... mom1 = iCustom(NULL,0,"myIndi",0,i);
which i call here: mom(mom1,Bars,20,i);
Thanks for your help!!
Bye, ATNo, that can not be the cause
See this example :
double buffer[];
int init() { SetIndexBuffer(0,buffer); return(0); }
int deinit() { return(0); }
int start()
{
int counted_bars=IndicatorCounted();
if(counted_bars<0) return(-1);
if(counted_bars>0) counted_bars--;
int limit = MathMin(Bars-counted_bars,Bars-1);
for(int i = limit; i>=0; i--)
{
buffer = iCustom(NULL,0,"custom name",0,i);
double mom = Mom(buffer,10,50,i);
}
return(0);
}
double Mom(const double& series[], int period, int totcount, int index)
{
if (totcount<1 || period<1) return (EMPTY_VALUE);
if (indextotcount-1) return (EMPTY_VALUE);
return (series-series);
}Also, no compiler errors at all
Hi Mladen!
Maybe because my code look more like this, and there is a "error"... :-/
#property indicator_chart_window
double buffer[];
int init() { SetIndexBuffer(0,buffer); return(0); }
int deinit() { return(0); }
int start()
{
int counted_bars=IndicatorCounted();
if(counted_bars<0) return(-1);
if(counted_bars>0) counted_bars--;
int limit = MathMin(Bars-counted_bars,Bars-1);
for(int i = limit; i>=0; i--)
{
double mom1;
mom1 = iCustom(NULL,0,"custom name",0,i);
buffer = (
Mom(mom1,10,Bars,i);
);
}
return(0);
}
double Mom(const double& series[], int period, int totcount, int index)
{
if (totcount<1 || period<1) return (EMPTY_VALUE);
if (indextotcount-1) return (EMPTY_VALUE);
return (series-series);
}
);Thanks and bye, AT
Hi Mladen!
Maybe because my code look more like this, and there is a "error"... :-/
#property indicator_chart_window
double buffer[];
int init() { SetIndexBuffer(0,buffer); return(0); }
int deinit() { return(0); }
int start()
{
int counted_bars=IndicatorCounted();
if(counted_bars<0) return(-1);
if(counted_bars>0) counted_bars--;
int limit = MathMin(Bars-counted_bars,Bars-1);
for(int i = limit; i>=0; i--)
{
double mom1;
mom1 = iCustom(NULL,0,"custom name",0,i);
buffer = (
Mom(mom1,10,Bars,i);
);
}
return(0);
}
double Mom(const double& series[], int period, int totcount, int index)
{
if (totcount<1 || period<1) return (EMPTY_VALUE);
if (indextotcount-1) return (EMPTY_VALUE);
return (series-series);
}
);at120
In your code mom1 is defined as double (simple double variable) not as an array or buffer.
Define it the same way as the "buffer" is defined, add it in init section to buffers and it will be OK (make sure to adjust the buffers number appropriately)
Hi Malden!
Thanks for your support! ;-)
Even, when I write the code like you told me:
(I think so...)
#property indicator_chart_window
double buffer[];
double mom1[];
int init() { SetIndexBuffer(0,buffer); SetIndexBuffer(1,mom1);return(0); }
int deinit() { return(0); }
int start()
{
int counted_bars=IndicatorCounted();
if(counted_bars<0) return(-1);
if(counted_bars>0) counted_bars--;
int limit = MathMin(Bars-counted_bars,Bars-1);
for(int i = limit; i>=0; i--)
{
mom1 = iCustom(NULL,0,"custom name",0,i);
buffer = (
Mom(mom1,10,Bars,i);
//doesn't work - no value in indi
// Mom(mom1,10,Bars,i); //error: parameter conversation not allowed
// mom1 // this works
);
}
return(0);
}
double Mom(const double& series[], int period, int totcount, int index)
{
if (totcount<1 || period<1) return (EMPTY_VALUE);
if (indextotcount-1) return (EMPTY_VALUE);
return (series-series);
}
);So when I use the "First" version, I get no value..
When I use the second version, I get the error... hmmm.
Only call the mom1 works... but this isn't the right value...
Thanks for your help!
Bye, AT