Hi Guys,
Is there an easier way to code the below?
and is it possible to define a search criteria for REF or timeframegetprice?
IE i would like to be able to return the last 20 highs when the stochastics above 50?
Code://get last 20 highs wh1 = Ref( H, -1 ); wh2 = Ref( H, -2 ); wh3 = Ref( H, -3 ); wh4 = Ref( H, -4 ); wh5 = Ref( H, -5 ); wh6 = Ref( H, -6 ); wh7 = Ref( H, -7 ); wh8 = Ref( H, -8 ); wh9 = Ref( H, -9 ); wh10 = Ref( H, -10 ); wh11 = Ref( H, -11 ); wh12 = Ref( H, -12 ); wh13 = Ref( H, -13 ); wh14 = Ref( H, -14 ); wh15 = Ref( H, -15 ); wh16 = Ref( H, -16 ); wh17 = Ref( H, -17 ); wh18 = Ref( H, -18 ); wh19 = Ref( H, -19 ); wh20 = Ref( H, -20 ); //get last 20 lows wl1 = Ref( L, -1 ); wl2 = Ref( L, -2 ); wl3 = Ref( L, -3 ); wl4 = Ref( L, -4 ); wl5 = Ref( L, -5 ); wl6 = Ref( L, -6 ); wl7 = Ref( L, -7 ); wl8 = Ref( L, -8 ); wl9 = Ref( L, -9 ); wl10 = Ref( L, -10 ); wl11 = Ref( L, -11 ); wl12 = Ref( L, -12 ); wl13 = Ref( L, -13 ); wl14 = Ref( L, -14 ); wl15 = Ref( L, -15 ); wl16 = Ref( L, -16 ); wl17 = Ref( L, -17 ); wl18 = Ref( L, -18 ); wl19 = Ref( L, -19 ); wl20 = Ref( L, -20 ); adr1 = (wh1+wh2+wh3+wh4+wh5+wh6+wh7+wh8+wh9+wh10+wh11+wh12+wh13+wh14+wh15+wh16+wh17+wh18+wh19+wh20)-(wl1+wl2+wl3+wl4+wl5+wl6+wl7+wl8+wl9+wl10+wl11+wl12+wl13+wl14+wl15+wl16+wl17+wl18+wl19+wl20); //20 period average tadr = ((adr1)/20);
tadr = (Sum(H,20) - Sum(L,20)) / 20;
or
tadr = MA(H-L,20);
Some more info in relation to the search criteria would be helpful.