Finding Range over all bars in a chart for N periods...High to Lowest ??? New comment [Deleted] 2007.01.27 12:40 int limit, records, N=2; int counted_bars = IndicatorCounted(); limit = Bars - counted_bars; if ( counted_bars < 0 ) return(0); if ( counted_bars ==0 ) limit=Bars-1; double JPY; for(int i = 0; i < limit; i++) { JPY = (iHigh("USDJPY", 0, i) - Low[iLowest("USDJPY", 0, MODE_LOW, N, i )] ); } I am trying to find the range from the current bar high to the lowest low over N periods, Including current bar,,,the above does seam to work ?? Does not like pulling up USDJPY data or having iHigh and ilowest on the same line. .. IHigh gives me 120.56 where as Low(iLowest[]) gives me 1.3201 Any ideas... DeMarker - Oscillators - Technical Indicators - Price Charts, Technical and Fundamental Analysis DeMarker - Oscillators - Indicators - Charts - MetaTrader 5 for Android DeMarker - Oscillators - Indicators - Chart - MetaTrader 5 for iPhone Iggy 2007.01.27 18:12 #1 Low[] gives you a low from current chart, you probably ran it on EURUSD chart, rather than USDJPY pair. The corect way is iLow(["USDJPY",0,iLowest("USDJPY", 0, MODE_LOW, N, i )] ); [Deleted] 2007.01.27 20:16 #2 Thanks New comment
int counted_bars = IndicatorCounted();
limit = Bars - counted_bars;
if ( counted_bars < 0 ) return(0);
if ( counted_bars ==0 ) limit=Bars-1;
double JPY;
for(int i = 0; i < limit; i++)
{
JPY = (iHigh("USDJPY", 0, i) - Low[iLowest("USDJPY", 0, MODE_LOW, N, i )] );
}
I am trying to find the range from the current bar high to the lowest low over N periods, Including current bar,,,the above does seam to work ??
Does not like pulling up USDJPY data or having iHigh and ilowest on the same line. ..
IHigh gives me 120.56 where as Low(iLowest[]) gives me 1.3201
Any ideas...