Download MetaTrader 5

ADX(14 day ago) ?

To add comments, please log in or register
Eric Tschumi
38
Eric Tschumi 2016.10.16 14:37 

Hello,

Can somebody indicate me how is it possible to get an array with ADX(14 days ago) for all the bars of current chart (MQL4) ?

Thank you very much in advance !

Eric

Biantoro Kunarto
15259
Biantoro Kunarto 2016.10.19 10:25  

You can use this :

int DayAgo = 14; // 14 Days ago
int ADXPeriod  = 14;
double ADXValue14Ago = iADX(Symbol(),PERIOD_D1,ADXPeriod,PRICE_CLOSE,MODE_MAIN,DayAgo);
GBWT094114
3342
GBWT094114 2016.10.23 14:13  
Biantoro Kunarto:

You can use this :

int DayAgo = 14; // 14 Days ago
int ADXPeriod  = 14;
double ADXValue14Ago = iADX(Symbol(),PERIOD_D1,ADXPeriod,PRICE_CLOSE,MODE_MAIN,DayAgo);
How about ADX(dynamic) = changes with conditions that apply?
Eric Tschumi
38
Eric Tschumi 2016.10.24 20:30  
Biantoro Kunarto:

You can use this :

int DayAgo = 14; // 14 Days ago
int ADXPeriod  = 14;
double ADXValue14Ago = iADX(Symbol(),PERIOD_D1,ADXPeriod,PRICE_CLOSE,MODE_MAIN,DayAgo);

Thank you very much Biantoro,


Ok, I suppose this for the last bar of the current chart. For all the current chart I think the formula will be :


for (int i=Bars-1;i>=0;i--)

{

adx[i]=iADX(Symbol(),PERIOD_D1,ADXPeriod,PRICE_CLOSE,MODE_MAIN,i-14);

}

Is it right ?


But now, if I want the formula is applicable for all the timeframe :

How to write this formula ?

int 4HourAgo = ?

int HourAgo = ?

int 5MinuteAgo = ?

int MinuteAGo = ?

->

for (int i=Bars-1;i>=0;i--)

{

adx[i]=iADX(Symbol(),0,ADXPeriod,PRICE_CLOSE,MODE_MAIN,i-???);

}  ?


Thank you  for your help and best regards,


Eric

Mladen Rakic
56241
Mladen Rakic 2016.10.25 16:52  
Eric Tschumi:

Thank you very much Biantoro,


Ok, I suppose this for the last bar of the current chart. For all the current chart I think the formula will be :


for (int i=Bars-1;i>=0;i--)

{

adx[i]=iADX(Symbol(),PERIOD_D1,ADXPeriod,PRICE_CLOSE,MODE_MAIN,i-14);

}

Is it right ?


But now, if I want the formula is applicable for all the timeframe :

How to write this formula ?

int 4HourAgo = ?

int HourAgo = ?

int 5MinuteAgo = ?

int MinuteAGo = ?

->

for (int i=Bars-1;i>=0;i--)

{

adx[i]=iADX(Symbol(),0,ADXPeriod,PRICE_CLOSE,MODE_MAIN,i-???);

}  ?


Thank you  for your help and best regards,


Eric

Yes, that would be the correct formula

For the rest : use this general formula

adx[i]=iADX(NULL,0,ADXPeriod,PRICE_CLOSE,MODE_MAIN,iBarShift(NULL,0,Time[i]-timeDifferenceInMinutes*60));

and (in that format) it will try to find the first bar with that desired time (approximations will happen if the exact time does not match) and return the value of adx for that bar

Eric Tschumi
38
Eric Tschumi 2016.10.25 22:50  
Mladen Rakic:

Yes, that would be the correct formula

For the rest : use this general formula

adx[i]=iADX(NULL,0,ADXPeriod,PRICE_CLOSE,MODE_MAIN,iBarShift(NULL,0,Time[i]-timeDifferenceInMinutes*60));

and (in that format) it will try to find the first bar with that desired time (approximations will happen if the exact time does not match) and return the value of adx for that bar

Everything is clear now ! thank you very much, Mladen !
squalle
5
squalle 2016.11.09 10:11  

hello everybody,

i want to change my adx too, where do i go to put this code ?

thanks a lot. 

Mladen Rakic
56241
Mladen Rakic 2016.11.09 10:23  
squalle:

hello everybody,

i want to change my adx too, where do i go to put this code ?

thanks a lot. 

You have to have a custom indicator for that

You can not change the built in indicators

To add comments, please log in or register