Hello Friends of Amibroker,
i have a Problem i´m not so good a coding. So please help me.
With hat scanner you can find stable trending stock in a correction. it searches for system quality number score over 2.5
this idead is from van tharp and the standard look back period is 100 weeks.
now i wanna detect more stocks, so i wanna search for stocks with a look back period from 100 weeks until 200 weeks in 4 weeks steps.
so when the sqn score is over 2.5 for 100 weeks or 104 weeks or 108 weeks or 112 weeks until 200 weeks i wanna get a hit in the explorer.
is thats possible?
this is the standard code for my 100 weeks scanner.
ProfitSer = ROC(Close,1);
//Bar = Barindex - 1
ProfitSMA = ma(ProfitSer,100);
sqn = sqrt(100) * ProfitSMA / StDev(ProfitSer,100);
Filter = RSI(2) < 10 AND sqn >= 2.5 AND MA(Close*Volume,52) > 3000000;
AddColumn(sqn, "sqn" );
AddColumn(rsi(2), "RSI");
and this is the code, which scearches from 100 weeks to 200 weeks in 4 week steps,
so i wrote i down 25 times and then i work with "OR" in condition3 (see below)
and then i work with condition4 = condition3 >= 2.5;
at least i but everything in the filter... but this code do not work 
i would be glad if you can help me one time in my amibroker life 
thank you
marcus
This Code here is my second try, that not work 
// sqn for a range over 100 weeks in 4 weeks steps until 200 weeks
ProfitSer = ROC(Close,1);
//Bar = Barindex - 1
ProfitSMA = ma(ProfitSer,100);
sqn = sqrt(100) * ProfitSMA / StDev(ProfitSer,100);
// sqn for a range over 104 weeks in 4 weeks steps until 200 weeks
ProfitSer1 = ROC(Close,1);
//Bar = Barindex - 1
ProfitSMA1 = ma(ProfitSer1,104);
sqn1 = sqrt(104) * ProfitSMA1 / StDev(ProfitSer1,104);
// sqn for a range over 108 weeks in 4 weeks steps until 200 weeks
ProfitSer2 = ROC(Close,1);
//Bar = Barindex - 1
ProfitSMA2 = ma(ProfitSer2,108);
sqn2 = sqrt(108) * ProfitSMA2 / StDev(ProfitSer2,108);
// sqn for a range over 112 weeks in 4 weeks steps until 200 weeks
ProfitSer3 = ROC(Close,1);
//Bar = Barindex - 1
ProfitSMA3 = ma(ProfitSer3,112);
sqn3 = sqrt(112) * ProfitSMA3 / StDev(ProfitSer3,112);
// sqn for a range over 116 weeks in 4 weeks steps until 200 weeks
ProfitSer4 = ROC(Close,1);
//Bar = Barindex - 1
ProfitSMA4 = ma(ProfitSer4,116);
sqn4 = sqrt(116) * ProfitSMA4 / StDev(ProfitSer4,116);
// sqn for a range over 120 weeks in 4 weeks steps until 200 weeks
ProfitSer5 = ROC(Close,1);
//Bar = Barindex - 1
ProfitSMA5 = ma(ProfitSer5,120);
sqn5 = sqrt(120) * ProfitSMA5 / StDev(ProfitSer5,120);
// sqn for a range over 124 weeks in 4 weeks steps until 200 weeks
ProfitSer6 = ROC(Close,1);
//Bar = Barindex - 1
ProfitSMA6 = ma(ProfitSer6,124);
sqn6 = sqrt(124) * ProfitSMA6 / StDev(ProfitSer6,124);
// sqn for a range over 128 weeks in 4 weeks steps until 200 weeks
ProfitSer7 = ROC(Close,1);
//Bar = Barindex - 1
ProfitSMA7 = ma(ProfitSer7,128);
sqn7 = sqrt(128) * ProfitSMA7 / StDev(ProfitSer7,128);
// sqn for a range over 132 weeks in 4 weeks steps until 200 weeks
ProfitSer8 = ROC(Close,1);
//Bar = Barindex - 1
ProfitSMA8 = ma(ProfitSer8,132);
sqn8 = sqrt(132) * ProfitSMA8 / StDev(ProfitSer8,132);
// sqn for a range over 136 weeks in 4 weeks steps until 200 weeks
ProfitSer9 = ROC(Close,1);
//Bar = Barindex - 1
ProfitSMA9 = ma(ProfitSer9,136);
sqn9 = sqrt(136) * ProfitSMA9 / StDev(ProfitSer9,136);
// sqn for a range over 140 weeks in 4 weeks steps until 200 weeks
ProfitSer10 = ROC(Close,1);
//Bar = Barindex - 1
ProfitSMA10 = ma(ProfitSer10,140);
sqn10 = sqrt(140) * ProfitSMA10 / StDev(ProfitSer10,140);
// sqn for a range over 144 weeks in 4 weeks steps until 200 weeks
ProfitSer11 = ROC(Close,1);
//Bar = Barindex - 1
ProfitSMA11 = ma(ProfitSer11,144);
sqn11 = sqrt(144) * ProfitSMA11 / StDev(ProfitSer11,144);
// sqn for a range over 148 weeks in 4 weeks steps until 200 weeks
ProfitSer12 = ROC(Close,1);
//Bar = Barindex - 1
ProfitSMA12 = ma(ProfitSer12,148);
sqn12 = sqrt(148) * ProfitSMA12 / StDev(ProfitSer12,144);
// sqn for a range over 152 weeks in 4 weeks steps until 200 weeks
ProfitSer13 = ROC(Close,1);
//Bar = Barindex - 1
ProfitSMA13 = ma(ProfitSer13,152);
sqn13 = sqrt(152) * ProfitSMA13 / StDev(ProfitSer13,152);
// sqn for a range over 156 weeks in 4 weeks steps until 200 weeks
ProfitSer14 = ROC(Close,1);
//Bar = Barindex - 1
ProfitSMA14 = ma(ProfitSer14,156);
sqn14 = sqrt(156) * ProfitSMA14/ StDev(ProfitSer14,156);
// sqn for a range over 160 weeks in 4 weeks steps until 200 weeks
ProfitSer15 = ROC(Close,1);
//Bar = Barindex - 1
ProfitSMA15 = ma(ProfitSer15,160);
sqn15 = sqrt(160) * ProfitSMA15 / StDev(ProfitSer15,160);
// sqn for a range over 164 weeks in 4 weeks steps until 200 weeks
ProfitSer16 = ROC(Close,1);
//Bar = Barindex - 1
ProfitSMA16 = ma(ProfitSer16,164);
sqn16 = sqrt(164) * ProfitSMA16 / StDev(ProfitSer16,164);
// sqn for a range over 168 weeks in 4 weeks steps until 200 weeks
ProfitSer17 = ROC(Close,1);
//Bar = Barindex - 1
ProfitSMA17 = ma(ProfitSer17,168);
sqn17 = sqrt(168) * ProfitSMA17 / StDev(ProfitSer17,168);
// sqn for a range over 172 weeks in 4 weeks steps until 200 weeks
ProfitSer18 = ROC(Close,1);
//Bar = Barindex - 1
ProfitSMA18 = ma(ProfitSer18,172);
sqn18 = sqrt(172) * ProfitSMA18 / StDev(ProfitSer18,172);
// sqn for a range over 176 weeks in 4 weeks steps until 200 weeks
ProfitSer19 = ROC(Close,1);
//Bar = Barindex - 1
ProfitSMA19 = ma(ProfitSer19,176);
sqn19 = sqrt(176) * ProfitSMA19 / StDev(ProfitSer19,176);
// sqn for a range over 180 weeks in 4 weeks steps until 200 weeks
ProfitSer20 = ROC(Close,1);
//Bar = Barindex - 1
ProfitSMA20 = ma(ProfitSer20,180);
sqn20 = sqrt(180) * ProfitSMA20 / StDev(ProfitSer20,180);
// sqn for a range over 184 weeks in 4 weeks steps until 200 weeks
ProfitSer21 = ROC(Close,1);
//Bar = Barindex - 1
ProfitSMA21 = ma(ProfitSer21,184);
sqn21 = sqrt(184) * ProfitSMA21 / StDev(ProfitSer21,184);
// sqn for a range over 188 weeks in 4 weeks steps until 200 weeks
ProfitSer22 = ROC(Close,1);
//Bar = Barindex - 1
ProfitSMA22 = ma(ProfitSer22,188);
sqn22 = sqrt(188) * ProfitSMA22 / StDev(ProfitSer22,188);
// sqn for a range over 192 weeks in 4 weeks steps until 200 weeks
ProfitSer23 = ROC(Close,1);
//Bar = Barindex - 1
ProfitSMA23 = ma(ProfitSer23,192);
sqn23 = sqrt(192) * ProfitSMA23 / StDev(ProfitSer23,192);
// sqn for a range over 196 weeks in 4 weeks steps until 200 weeks
ProfitSer24 = ROC(Close,1);
//Bar = Barindex - 1
ProfitSMA24 = ma(ProfitSer24,196);
sqn24 = sqrt(196) * ProfitSMA24 / StDev(ProfitSer24,196);
// sqn for a range over 200 weeks in 4 weeks steps until 200 weeks
ProfitSer25 = ROC(Close,1);
//Bar = Barindex - 1
ProfitSMA25 = ma(ProfitSer25,200);
sqn25 = sqrt(200) * ProfitSMA25 / StDev(ProfitSer25,200);
// Stock should be oversold in correction
condition1 = RSI(2) < 10 ;
// minum of 3 mio dollar average volume
condition2 = MA(Close*Volume,52) > 3000000;
// sqn 100 until 200 weeks in 4 week steps
condition3 = sqn OR sqn1 OR sqn2 OR sqn3 OR sqn4 OR sqn5 OR sqn5 or
sqn6 OR sqn7 OR sqn8 OR sqn9 OR sqn10 OR sqn11 OR sqn12 OR
sqn13 OR sqn14 OR sqn15 OR sqn16 OR sqn17 OR sqn18 OR sqn19 OR
sqn20 OR sqn21 OR sqn22 OR sqn23 OR sqn24 OR sqn5 OR sqn25;
// // sqn 100 until 200 weeks in 4 week steps should be over 2.5
condition4 = condition3 >= 2.5;
// summarize in filter
Filter= condition1 AND condition2 AND condition4;
AddColumn(sqn, "sqn" );
AddColumn(rsi(2), "RSI");