Download MetaTrader 5

iADX-MQL4 <=> iAdx-MQL5

To add comments, please log in or register
All articles are available from MetaTrader 5. Contribute your own one!
Carl Schreiber
6590
Carl Schreiber 2016.11.18 23:43 

Hi, I just realized in MQL4 iADX is defined as:

double  iADX(
   string       symbol,        // symbol
   int          timeframe,     // timeframe
   int          period,        // averaging period
   int          applied_price, // applied price
   int          mode,          // line index
   int          shift          // shift
   );

in MQL5 some options are missing - or am I wrong:

int  iADX(
   string           symbol,         // symbol name
   ENUM_TIMEFRAMES  period,         // period
   int              adx_period      // averaging period
   );

the "timeframe" and "applied_price" - have they been lost or is there another way of getting that?

Marco vd Heijden
Moderator
4700
Marco vd Heijden 2016.11.19 02:18  

Timeframe has become period and i guess they dropped the base price enumeration because when trend moves up the average direction of all these price bases will also move up and when there is a down trend, all prices will also have a decreasing direction.

So the question will be why do you need them ?

Carl Schreiber
6590
Carl Schreiber 2016.11.19 11:21  

I just re-coded a mql5 indicator for mql4 and I realized the difference of the parameters. Yes, I have overseen the existence of timeframe, but the applied_price - I don't need it in my case, but generally speaking?

Ok, PRICE_HIGH and PRICE_LOW or PRICE_OPEN are probably very seldom used, but what about Median, Weighted, ...?

Marco vd Heijden
Moderator
4700
Marco vd Heijden 2016.11.19 12:27  

Well it's a directional indicator so if one moves up they all move up.

One can not simply stay behind.

Median for example is Ask+Bid / 2 so if the trend direction is up those two will also move up and there will be no difference in the directional output of said indicator.

Carl Schreiber
6590
Carl Schreiber 2016.11.19 12:39  
Marco vd Heijden:

Well it's a directional indicator so if one moves up they all move up.

One can not simply stay behind.

Median for example is Ask+Bid / 2 so if the trend direction is up those two will also move up and there will be no difference in the directional output of said indicator.

hmm?

double prcMedian[i]  = (High[i]+Low[i])/2.0, // in MQL4  Not (Ask+Bid)/2.0
       prcTypical[i] = (High[i]+Low[i]+Close[i])/3.0,
       ...
       ;


Marco vd Heijden
Moderator
4700
Marco vd Heijden 2016.11.19 12:45  

Well that depends on which median you are looking for of course you can also use High and Low or Open and Close and etc.

ENUM_APPLIED_PRICE

ID

Value

Description

PRICE_CLOSE

0

Close price

PRICE_OPEN

1

Open price

PRICE_HIGH

2

The maximum price for the period

PRICE_LOW

3

The minimum price for the period

PRICE_MEDIAN

4

Median price, (high + low)/2

PRICE_TYPICAL

5

Typical price, (high + low + close)/3

PRICE_WEIGHTED

6

Weighted close price, (high + low + close + close)/4

Carl Schreiber
6590
Carl Schreiber 2016.11.19 13:00  
Marco vd Heijden:

Well that depends on which median you are looking for of course you can also use High and Low or Open and Close and etc.

ENUM_APPLIED_PRICE

ID

Value

Description

PRICE_CLOSE

0

Close price

PRICE_OPEN

1

Open price

PRICE_HIGH

2

The maximum price for the period

PRICE_LOW

3

The minimum price for the period

PRICE_MEDIAN

4

Median price, (high + low)/2

PRICE_TYPICAL

5

Typical price, (high + low + close)/3

PRICE_WEIGHTED

6

Weighted close price, (high + low + close + close)/4

The price-option for an indicator! Anyway, back to my question, these options have been lost?
Marco vd Heijden
Moderator
4700
Marco vd Heijden 2016.11.19 13:09  

Reduced to one if you ask me.

This is related to the actual indicator.

If you look at for example iMacd it's still there.

iMACD

The function returns the handle of the Moving Averages Convergence/Divergence indicator. In systems where OsMA is called MACD Histogram, this indicator is shown as two lines. In the client terminal the Moving Averages Convergence/Divergence looks like a histogram.

int  iMACD(
   string              symbol,              // symbol name
   ENUM_TIMEFRAMES     period,              // period
   int                 fast_ema_period,     // period for Fast average calculation
   int                 slow_ema_period,     // period for Slow average calculation
   int                 signal_period,       // period for their difference averaging
   ENUM_APPLIED_PRICE  applied_price        // type of price or handle
   );
To add comments, please log in or register