Windows Range

Ricardo Rodrigues Lucca
935
Ricardo Rodrigues Lucca  

Hello everyone,

I'm trying to make an indicator that can be drawn in the same window with other indicator and I've seen that each indicator has a different range to draw. What do I mean by that? The A indicator and my indicator (let's call it, B) have the same value. So, should both indicators overlap right? Well, the B indicator is drawn too high in relation to the A indicator that is in the same window. Therefore, they are not in the same range of values. I would like to change my code to correct this behavior. Could anyone suggest an approach?

Although I easily fix this by setting a fixed minimum and maximum fixed between both indicators, I do not like this approach.

So, if anyone could suggest another approach, thank you.

Jose Francisco Casado Fernandez
6703
Jose Francisco Casado Fernandez  
You can normalize the values of both indicators to the same scale (for example between 0 and 100).  Regards.
Fernando Carreiro
5136
Fernando Carreiro  
rlucca: I'm trying to make an indicator that can be drawn in the same window with other indicator and I've seen that each indicator has a different range to draw. What do I mean by that? The A indicator and my indicator (let's call it, B) have the same value. So, should both indicators overlap right? Well, the B indicator is drawn too high in relation to the A indicator that is in the same window. Therefore, they are not in the same range of values. I would like to change my code to correct this behavior. Could anyone suggest an approach?

Although I easily fix this by setting a fixed minimum and maximum fixed between both indicators, I do not like this approach.

So, if anyone could suggest another approach, thank you.

You can also set the same range on the affected Indicators by setting the Minimum and Maximum values with the IndicatorSetDouble() function.

ENUM_CUSTOMIND_PROPERTY_DOUBLE

ID

Description

Property type

INDICATOR_MINIMUM

Minimum of the indicator window

double

INDICATOR_MAXIMUM

Maximum of the indicator window

double

IndicatorSetDouble - Custom Indicators - MQL4 Reference
IndicatorSetDouble - Custom Indicators - MQL4 Reference
  • docs.mql4.com
The function sets the value of the corresponding indicator property. Indicator property must be of the double type. There are two variants of the function. [in]  Modifier of the specified property. Only level properties...
Ricardo Rodrigues Lucca
935
Ricardo Rodrigues Lucca  
Fernando Carreiro:

You can also set the same range on the affected Indicators by setting the Minimum and Maximum values with the IndicatorSetDouble() function.

ENUM_CUSTOMIND_PROPERTY_DOUBLE

ID

Description

Property type

INDICATOR_MINIMUM

Minimum of the indicator window

double

INDICATOR_MAXIMUM

Maximum of the indicator window

double


It doesn't help me. As I said I'm already setting the indicator minimum and maximum on both indicator as workaround, but I prefer the other indicator be scale free and I adjust my scale ever time I recalculate. Is it possible? I didn't see any function that allow me to get the minimum/maximum from window or other indicator, so I think IndicatorSetDouble() will not help me...

Thank you.

Ricardo Rodrigues Lucca
935
Ricardo Rodrigues Lucca  
Jose Francisco Casado Fernandez:
You can normalize the values of both indicators to the same scale (for example between 0 and 100).  Regards.
I don't  have the code of the other one, but thanks for the suggestion! :)
Fernando Carreiro
5136
Fernando Carreiro  
rlucca: I don't  have the code of the other one, but thanks for the suggestion! :)

Then assuming Indicator "A" is the propriety (no code) one, and Indicator "B" is the open-source one, then from within the code of "B", use iCustom() to get the values of "A" and build extra buffers in "B".

In this way, only Indicator "B" will need to be placed on the chart, but will display all the values of both "A" and "B" together at the same scale and range but totally free flowing without the need for minimum or maximum settings.

PS! That is assuming the the values of "A" and "B" are compatible and within a single common range and scale. If they are not, then re-scale them as @Jose Francisco Casado Fernandez suggested (from inside the "B" code using iCustom).

iCustom - Technical Indicators - MQL4 Reference
iCustom - Technical Indicators - MQL4 Reference
  • docs.mql4.com
[in]  Custom indicator compiled program name, relative to the root indicators directory (MQL4/Indicators/). If the indicator is located in subdirectory, for example, in MQL4/Indicators/ The passed parameters and their order must correspond with the declaration order and the type of extern variables of the custom indicator...