Using iCustom to pass indicator_level from separate window in custom indicator

 

Hi,

the documentation on iCustom says that you can pass input parameters from a custom indicator. I would like to pass:

#property indicator_level1 1  (or something similar)

As this is not an input parameter as far as I'm aware (I'm a beginner) how might I express this?

My idea is to have an EA take an action if an oscillator is above or below a certain level.


Many thanks

iCustom - Technical Indicators - MQL4 Reference
iCustom - Technical Indicators - MQL4 Reference
  • docs.mql4.com
iCustom - Technical Indicators - MQL4 Reference
 
mql4acc: the documentation on iCustom says that you can pass input parameters from a custom indicator.

No, you pass the input parameters from the EA to the custom indicator, not the other way.

mql4acc: I would like to pass: "#property indicator_level1 1" (or something similar)

No, that information is not programmatically accessible. You can only set it, not read it.

 
Fernando Carreiro #:

No, you pass the input parameters from the EA to the custom indicator, not the other way.

No, that information is not programmatically accessible. You can only set it, not read it.

Thanks for your reply and sorry for the double post. (I mis-read an old message in my account control panel, and thought that this post had been deleted, when in fact it was one from last week. I'm still getting used to the layout of using a forum. Thanks

Can you suggest how I might try to have an oscillator signal when it crosses above/below an indicator level or other line in a separate window?

Also with regards your comment above:

Fernando Carreiro #:

No, you pass the input parameters from the EA to the custom indicator, not the other way.

The book says ICustom calculates the specified custom indicator and returns its value. So surely this works the way I suggested? it is calculating parameters from a custom indicator, so if called from an EA it would be passing from an indicator to an ea?


Thanks again.

Using iCustom to pass indicator_level from separate window in custom indicator
Using iCustom to pass indicator_level from separate window in custom indicator
  • 2024.10.29
  • mql4acc
  • www.mql5.com
Hi, the documentation on iCustom says that you can pass input parameters from a custom indicator...
 
mql4acc #: The book says ICustom calculates the specified custom indicator and returns its value. So surely this works the way I suggested? it is calculating parameters from a custom indicator, so if called from an EA it would be passing from an indicator to an ea?

Don't confuse the "parameters" that you supply to the Indicator, and the resulting "buffer" data that the Indicator produces and that you can access.

mql4acc #: Can you suggest how I might try to have an oscillator signal when it crosses above/below an indicator level or other line in a separate window?

That is just a normal indicator that is displayed separately below the main chart.

#property indicator_separate_window

Then pass the "level" as a parameter to the custom indicator and have it set that level programmatically.

If that is not what you mean, then please explain in more detail and with a screenshot or some graphic to illustrate your point.

 
Fernando Carreiro #:

Don't confuse the "parameters" that you supply to the Indicator, and the resulting "buffer" data that the Indicator produces and that you can access.

That is just a normal indicator that is displayed separately below the main chart.

Then pass the "level" as a parameter to the custom indicator and have it set that level programmatically.

If that is not what you mean, then please explain in more detail and with a screenshot or some graphic to illustrate your point.

Hi, thanks for your reply.

I've attached an image file. There is a crossover signal, long (signified by a vertical line)

This crossover long takes place below the minus -1 level. I am interested in getting a signal from that and also the reverse, so, a short crossover signal that occurs above the +1 level. 

I then want to set an ea to use this signal and ignore the other crossovers given by the oscillator.

I hope this makes it more clear.


Thanks again.

 
mql4acc #: I've attached an image file. There is a crossover signal, long (signified by a vertical line)

This crossover long takes place below the minus -1 level. I am interested in getting a signal from that and also the reverse, so, a short crossover signal that occurs above the +1 level. I then want to set an ea to use this signal and ignore the other crossovers given by the oscillator. I hope this makes it more clear.

Then what is the problem exactly?

Read the indicator buffer data and detect when the values are as per your requirements for the signal.

 
Fernando Carreiro #:

Then what is the problem exactly?

Read the indicator buffer data and detect when the values are as per your requirements for the signal.

Hi, thanks for your reply.

Perhaps I am confusing buffer data and parameters.

In my custom indicator I set 6 lines as:

#property indicator_level1 1
#property indicator_level2 0
#property indicator_level3 -1

extern int  period         = 10;
extern int  PriceType      = PRICE_MEDIAN;
extern bool showSignalLine = true;

Maybe the book is confusing things, but it says I can use only input parameters in iCustom, so this would mean only using period and PriceType, right?

Can you link an article or otherwise explain how I read/pass the indicator_level data?

I found this one, are they simply indexed, as 0,1,2 and included in iCustom or do you read them another way?

A line of code might really help to make things clearer for me.

Thanks

Reading buffer values from custom indicators
Reading buffer values from custom indicators
  • 2021.08.03
  • Luka Savic
  • www.mql5.com
Hi everyone, I am programming in MQL4 for some time but there is an issue I can't resolve and it is around using buffers in custom indicators...
 
Fernando Carreiro #:

Don't confuse the "parameters" that you supply to the Indicator, and the resulting "buffer" data that the Indicator produces and that you can access.

That is just a normal indicator that is displayed separately below the main chart.

Then pass the "level" as a parameter to the custom indicator and have it set that level programmatically.

If that is not what you mean, then please explain in more detail and with a screenshot or some graphic to illustrate your point.

Hi, when you say "Then pass the "level" as a parameter to the custom indicator and have it set that level programmatically"

How exactly would you do that?

 

Problem fixed!!

As a beginner I mistakenly thought the #property indicator_level (s) were required for me to be able to pull numerical data from, in a separate window.
These are really only visual aids for more manual trading.

All required data & levels are implicitly included in the oscillator itself. While this seems glaringly obvious now, it didn't at the time.

You literally hover your mouse over the buffer/signal/crossover lines in the separate window and the levels are revealed in a data window hover/pop up.


Thanks

 
mql4acc #:

Problem fixed!!

As a beginner I mistakenly thought the #property indicator_level (s) were required for me to be able to pull numerical data from, in a separate window.
These are really only visual aids for more manual trading.

All required data & levels are implicitly included in the oscillator itself. While this seems glaringly obvious now, it didn't at the time.

You literally hover your mouse over the buffer/signal/crossover lines in the separate window and the levels are revealed in a data window hover/pop up.


Thanks

or you could add the data window to the mt4/5 screen, like so... CTRL-D (note) the macd value in the white box, matches the buffer in the data window.)
These buffers are what you read from with iCustom.