I've given up. I can't access indicator buffer other than the first one whith iCustom

 

Hello there,


I usually solve the problems I encounter on my own, but this time I have run out of ideas.

I have another indicator where I do not encounter this problem. My indicator works as expected when inserted into a chart,

but when I try to access two buffers with iCustom, both buffers give me the value of the first one, whichever has the index 0.

Anybody has an idea what the cause could be ?


Thanks in advance.
 

Maybe both buffers have the same value?

You are not providing enough information.

Where is your code?

What values are you expecting and why?

What values show in the data window?

 
The cause is in your code which we can't see.
 
Keith Watford:

Maybe both buffers have the same value?

I said the indicator works as expected when inserted into a chart.

 
Alain Verleyen:
The cause is in your code which we can't see.

Thanks for the quick reply, but can't you give me some valid ideas without seeing code ?

Print(iCustom(SYMBOL,TIMEFRAME,"IndicatorName",parameter1,0,PRICE_CLOSE,0));
Print(iCustom(SYMBOL,TIMEFRAME,"IndicatorName",parameter1,1,PRICE_CLOSE,0));
 
The buffer should be the second to last parameter
 
Keith Watford:
The buffer should be the second to last parameter

this is correct answer

 

I found the problem: PRICE_CLOSE  in the parameters. For some reason I thought it was supposed to be there and I never questioned it again. The other indicator I made has it.

I'm so happy it works now.

 
Thanks for the helpful comments anyway. Funny how such a dumb mistake could give me so much trouble. It was hiding in plain sight all along.
 

In future, please show the code that is giving you problems.

As soon as I was able to see your iCustom calls, your mistake was obvious.

If the code had been shown in your first post, you would have received the answer straightaway.

 
Print(iCustom(SYMBOL,TIMEFRAME,"IndicatorName",parameter1,0,PRICE_CLOSE,0));
Print(iCustom(SYMBOL,TIMEFRAME,"IndicatorName",parameter1,1,PRICE_CLOSE,0));

In addition, you posted in the general forum. Therefor we assume that you are talking MT5, and iCustom returns a handle. Therefor your Print statements are meaningless, they should print random integers.

Why did you post your MT4 question in the Root / MT5 General section instead of the MQL4 section, (bottom of the Root page?)
          General rules and best pratices of the Forum. - General - MQL5 programming forum
Next time post in the correct place. The moderators will likely move this thread there soon.

Reason: