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

To add comments, please log in or register
mt4ski
129
mt4ski  

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.
Keith Watford
Moderator
20584
Keith Watford  

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?

Alain Verleyen
38752
Alain Verleyen  
The cause is in your code which we can't see.
mt4ski
129
mt4ski  
Keith Watford:

Maybe both buffers have the same value?

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

mt4ski
129
mt4ski  
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));
Keith Watford
Moderator
20584
Keith Watford  
The buffer should be the second to last parameter
Muhammad Mudasir
29281
Muhammad Mudasir  
Keith Watford:
The buffer should be the second to last parameter

this is correct answer

mt4ski
129
mt4ski  

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.

mt4ski
129
mt4ski  
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.
Keith Watford
Moderator
20584
Keith Watford  

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.

William Roeder
20248
William Roeder  
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.

12
To add comments, please log in or register