how can i find a bar which have lowest or highest indicator index?

 

Hello,

I are not familiar with English.  please understand.

 

 how can i find out a bar's open or close price which have lowest or highest indicator index?

 

example,,       how can i do? please let me know...^^

  

 

Maybe something like this:

int BarsToCheck=10;
double IndicatorValues[10];
for(int i=0;i<BarsToCheck;i++){
   IndicatorValues[i]=iRSI(NULL,0,9,PRICE_CLOSE,i);     
}
int BarIndexHigh=ArrayMaximum(IndicatorValues);
int BarIndexLow =ArrayMinimum(IndicatorValues);  
 
kronin:

Maybe something like this:

 

Hi kronin, The CI is ATR :|
 
phi.nuts:
Hi kronin, The CI is ATR :|

Thanks for the hint. 

Do you see any problems using it with ATR or just in general I should have used his CI for the example?
Like this:

int BarsToCheck=10;
double IndicatorValues[10];
for(int i=0;i<BarsToCheck;i++){
   IndicatorValues[i]=iATR(NULL,0,14,i);     
}
int BarIndexHigh=ArrayMaximum(IndicatorValues);
int BarIndexLow =ArrayMinimum(IndicatorValues);  
 
kronin:

Maybe something like this:

 


Hello. Thank you,,

and, how can i know the bar's open and close price??

 

ex) 

int BarsToCheck=10;
double IndicatorValues[10];
for(int i=0;i<BarsToCheck;i++){
   IndicatorValues[i]=iRSI(NULL,0,9,PRICE_CLOSE,i);     
}
int BarIndexHigh=ArrayMaximum(IndicatorValues);
int BarIndexLow =ArrayMinimum(IndicatorValues); 

double ATRlowestbar_closeprice = iClose(Symbol(),60, i)  <-- add code

 if i use iclose function to know the bar's open and close price, is the value i point the bar which have lowest and highest ATR index?

when i use add code, can i find out bar's open or close price? 

I are not familiar with English.  please understand. 

 
kjwoong001:


Hello. Thank you,,

and, how can i know the bar's open and close price??

 

ex) 

 if i use iclose function to know the bar's open and close price, is the value i point the bar which have lowest and highest ATR index?

when i use add code, can i find out bar's open or close price? 

I are not familiar with English.  please understand. 

int BarsToCheck=10;
double IndicatorValues[10];
for(int i=0;i<BarsToCheck;i++){
   IndicatorValues[i]=iATR(NULL,0,14,i);
   Print(StringConcatenate("BarIndex_",i," ATR: ",IndicatorValues[i]));     
}
int BarIndexHigh=ArrayMaximum(IndicatorValues);
int BarIndexLow =ArrayMinimum(IndicatorValues);  
double ATRlowestbar_closeprice = iClose(Symbol(),60, BarIndexLow); //<-- don't use i, use BarIndexLow/BarIndexHigh instead. 

From which bar with the same lowest ATR do you expect to get the closing price.

10:12:02 test EURUSD,H1: BarIndex_0 ATR: 0.0012
10:12:02 test EURUSD,H1: BarIndex_1 ATR: 0.0012
10:12:02 test EURUSD,H1: BarIndex_2 ATR: 0.0012
10:12:02 test EURUSD,H1: BarIndex_3 ATR: 0.0012
10:12:02 test EURUSD,H1: BarIndex_4 ATR: 0.0013
10:12:02 test EURUSD,H1: BarIndex_5 ATR: 0.0015
10:12:02 test EURUSD,H1: BarIndex_6 ATR: 0.0015
10:12:02 test EURUSD,H1: BarIndex_7 ATR: 0.0016
10:12:02 test EURUSD,H1: BarIndex_8 ATR: 0.0016
10:12:02 test EURUSD,H1: BarIndex_9 ATR: 0.0018

This is probably a problem with the suggested code.    

The above code returns BarIndex_2. This is probably not the bar you are looking for.

 
phi.nuts:
Hi kronin, The CI is ATR :|

I got it! Thanks.
 
kronin:

From which bar with the same lowest ATR do you expect to get the closing price.

10:12:02 test EURUSD,H1: BarIndex_0 ATR: 0.0012
10:12:02 test EURUSD,H1: BarIndex_1 ATR: 0.0012
10:12:02 test EURUSD,H1: BarIndex_2 ATR: 0.0012
10:12:02 test EURUSD,H1: BarIndex_3 ATR: 0.0012
10:12:02 test EURUSD,H1: BarIndex_4 ATR: 0.0013
10:12:02 test EURUSD,H1: BarIndex_5 ATR: 0.0015
10:12:02 test EURUSD,H1: BarIndex_6 ATR: 0.0015
10:12:02 test EURUSD,H1: BarIndex_7 ATR: 0.0016
10:12:02 test EURUSD,H1: BarIndex_8 ATR: 0.0016
10:12:02 test EURUSD,H1: BarIndex_9 ATR: 0.0018

This is probably a problem with the suggested code.    

The above code returns BarIndex_2. This is probably not the bar you are looking for.

 


This was only because I didn't convert DoubleToStr and made it more precise in the log.
More precise:

10:55:49 test EURUSD,H1: BarIndex_0 ATR: 0.00129286
10:55:49 test EURUSD,H1: BarIndex_1 ATR: 0.00121571
10:55:49 test EURUSD,H1: BarIndex_2 ATR: 0.00115714
10:55:49 test EURUSD,H1: BarIndex_3 ATR: 0.00116786
10:55:49 test EURUSD,H1: BarIndex_4 ATR: 0.00125214
10:55:49 test EURUSD,H1: BarIndex_5 ATR: 0.00149286
10:55:49 test EURUSD,H1: BarIndex_6 ATR: 0.00154500
10:55:49 test EURUSD,H1: BarIndex_7 ATR: 0.00162357
10:55:49 test EURUSD,H1: BarIndex_8 ATR: 0.00164643
10:55:49 test EURUSD,H1: BarIndex_9 ATR: 0.00178286

So BarIndex_2 is correct and the code should work. 

int BarsToCheck=10;
double IndicatorValues[10];
for(int i=0;i<BarsToCheck;i++){
   IndicatorValues[i]=iATR(NULL,0,14,i);
   Print(StringConcatenate("BarIndex_",i," ATR: ",IndicatorValues[i]));     
}
int BarIndexHigh=ArrayMaximum(IndicatorValues);
int BarIndexLow =ArrayMinimum(IndicatorValues);  
double ATRlowestbar_closeprice  = iClose(Symbol(),60, BarIndexLow);
double ATRhighestbar_closeprice = iClose(Symbol(),60, BarIndexHigh);
 
kronin:

From which bar with the same lowest ATR do you expect to get the closing price.

10:12:02 test EURUSD,H1: BarIndex_0 ATR: 0.0012
10:12:02 test EURUSD,H1: BarIndex_1 ATR: 0.0012
10:12:02 test EURUSD,H1: BarIndex_2 ATR: 0.0012
10:12:02 test EURUSD,H1: BarIndex_3 ATR: 0.0012
10:12:02 test EURUSD,H1: BarIndex_4 ATR: 0.0013
10:12:02 test EURUSD,H1: BarIndex_5 ATR: 0.0015
10:12:02 test EURUSD,H1: BarIndex_6 ATR: 0.0015
10:12:02 test EURUSD,H1: BarIndex_7 ATR: 0.0016
10:12:02 test EURUSD,H1: BarIndex_8 ATR: 0.0016
10:12:02 test EURUSD,H1: BarIndex_9 ATR: 0.0018

This is probably a problem with the suggested code.    

The above code returns BarIndex_2. This is probably not the bar you are looking for.

 


I tried that.. same error.. :(

How can i get code i am looking for?

I don't have concept of direction i'm looking for.

 let me know the concept. 

I are not familiar with English.  please understand.  

 
kjwoong001:

Hello,

I are not familiar with English.  please understand.

  how can i find out a bar's open or close price which have lowest or highest indicator index? 


Highest and Lowest during what time period ?  10 minutes, 3 days,  2 weeks ?
 
kjwoong001:


I tried that.. same error.. :(

How can i get code i am looking for?

I don't have concept of direction i'm looking for.

 let me know the concept. 

I are not familiar with English.  please understand.  


What 'same error'?
The example provided is for a period of 10 bars. You have to adjust it, to get the period you want.
Reason: