You need to also pass the extern variables in order seperated by commas.
https://book.mql4.com/samples/shared
hth
V
Hi Viffer,
Let's say I did that. The code is actually really big, I just tried to simplify here, supposing there are no parameters at all. I still couldn't figure it out though. Passing the return value to a buffer should work, but it doesn't.
Sure, but I still don't understand how can it be different. I changed the code!
// indicator code #property indicator_buffers 1 extern int x = 0; int value []; int init () { SetIndexBuffer (0, value); } int start () { value [0] = x + 3; return (x + 3); }
// ea code int start () { int i; i = iCustom (NULL, 0, "indicator", 0, 0, 0); Print (i); return (0); }
I'm not great on indicators, but it looks to me as though the problem is in there. I'm wondering if it's to do with the shifts and the way the indicator is set up. I'm not sure where value[0] is relative to the icustom shift. It may be that is the first bar on the chart and icustom is looking at the last... not sure though. I'm more familiar with indicators set up like...
int start() { int i; int counted_bars = IndicatorCounted(); i = CountBars - 1; //---- while(i >= 0) { value [i] = 3; } //---- //---- return(0); }
As I say, indicators are not my strongpoint though
V
Sure, but I still don't understand how can it be different. I changed the code!
Hi marco & Viffer, try this...
// indicator code #property indicator_buffers 1 extern int x = 0; int Buf_1[]; int init() { SetIndexBuffer(0, Buf_1); return(0); } int start() { int counted_bars = IndicatorCounted(); if( counted_bars < 0 ) return(-1); if( counted_bars > 0 ) counted_bars--; int limit = Bars - counted_bars - 1; for(int i=limit; i>=0; i--) Buf_1[i] = x + 3; return(0); } // EA code extern string Indy_name = ""; extern int buf_index = 0; int EA_output0, EA_output1, EA_output2; int start() { EA_output0 = iCustom(NULL,0,Indy_name,0,buf_index,0); EA_output1 = iCustom(NULL,0,Indy_name,0,buf_index,1); EA_output2 = iCustom(NULL,0,Indy_name,0,buf_index,2); Alert(" EA_output2 = ",EA_output2); Alert(" EA_output1 = ",EA_output1); Alert(" EA_output0 = ",EA_output0); return(0); }I haven't test it....but it should be ok
Hello
I am having the same problem.
I have 3 lines of code at the beginning of my start function.
They run at every tick.
Basically it says
Takein0 = icustom(........."fib"....0)
Takein1 = icustom(........."fib"....1)
Takein2 = icustom(........."fib"....2)
the function is properly filled with the variables, so no problem there.
Also the variables are accessible by any part of the program..
The only thing is that only Takein0 gives me updated values. Takein1 and Takein2 never change....
any idea??anyone?
thanksany idea??anyone?
thanksThis question is simple but I couldn't find an answer to it. I built and indicator and I want to use it's return value in my robot.
// indicator code int start () { ... // a lot of calculations return (3); }How can I use iCustom or any other method to get this value ?
You can't. The return value from start is IGNORED.
You'll have to add another buffer and put the value in there.

- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
Hi guys,
This question is simple but I couldn't find an answer to it. I built and indicator and I want to use it's return value in my robot.
How can I use iCustom or any other method to get this value ? For what I was reading, it seems thar iCustom only return values that are on buffers, so I created a buffer and tried to put its return value on it, but it didn't work.
Any hints on how to get this value 3 on the indicator to be returned to the variable i in the robot ?
Thanks!! Any help is appreciated
Marco