Range Breakout

Posted By: royal

Range Breakout - 01/24/14 14:10

Hi guys!
I am trying to implement a simple range breakout system and have problems with getting the high and the low of the 2 o'clock to 10 o'clock range.

Code:
function Range(){
	
	  if(lhour(CET) >= 2 && lhour(CET) <= 10){

			vars Highs = series(priceHigh());
			vars Lows = series(priceLow());
			int i;
			int j;
	
			for(i=0;i<sizeof(Highs);i++){
				if(Highs[i] > Highs[i+1])
					return Highs[i];
				else
					return Highs[i+1];	
				
			}
			
			for(j=0;j<sizeof(Lows);j++){
				if(Lows[j] < Lows[j+1])
					return Lows[j];
				else
					return Lows[j+1];	
				
			}

	  } 
}



Is there an easier way to get the max/min of a series?
And when I call the Range function I get the Error 41 because the series depends on the if condition. How can I get only the 2-10 range?

Thanks in advance for any help! laugh
Posted By: Anonymous

Re: Range Breakout - 01/24/14 14:56

I think you can use the HH and LL functions here.
Posted By: royal

Re: Range Breakout - 01/24/14 15:35

Yes HH and LL could be right, nevertheless I don't know how to use them here.

I try to implement the following, but I have problems with seperating the range frown

// range: 02:00-10:00 o'clock
// sell: < rangeLow && < hourly close price ema: 14
// buy: > rangeHigh && > hourly close price ema: 14
// takeprofit: 4.9* range
// stoploss: range
// tradeClose: 22:00 o'clock
Posted By: DMB

Re: Range Breakout - 01/24/14 21:02

There was someone trying to write code to do this sometime in the last couple months. I can't find the thread but I am pretty sure they got it sorted out. Sorry I couldn't be more help, but the thread is on the forum somewhere. Maybe someone else remembers. I think they were complicating things by using multiple time frames until someone suggested the cleaner HH / LL solution.
Posted By: DMB

Re: Range Breakout - 01/25/14 03:35

Found it! I hope this helps....
http://www.opserver.de/ubb7/ubbthreads.p...true#Post432888
Posted By: royal

Re: Range Breakout - 01/25/14 15:15

Thank you DMB. I will have a closer look at it next week laugh
© 2024 lite-C Forums