Optuma Forums › Optuma Scripting › Thin out scan list where a stocks Technical Indicator does not score >=4 › Reply To: Thin out scan list where a stocks Technical Indicator does not score >=4
- Topics: 4
- Replies: 89
- Posts: 93
In your script the individual items are using a static value whether they are passing or not. To setup a rank system you need to only have the values when the criteria passes using an IF() function.
Here is an example with your first criteria…
// Set RG1 to 30% of the last day range
RG1 = ATR(Day(PERIODAMOUNT=1), BARS=1) * 30/100;
// Set MA1 and MA2 ranges to plus/minus RG1
MA1 = MA(BARS=12, STYLE=Exponential, CALC=HL Average) + RG1 ;
MA2 = MA(BARS=12, STYLE=Exponential, CALC=HL Average) - RG1;
// Check if the High or Low falls within these ranges
H1 = (HIGH() <= MA1 and HIGH() >= MA2);
L1 = (LOW() <= MA1 and LOW() >= MA2);
// Check if any of these conditions are true
Z1 = H1 or L1;
// Set this Technical Indicator to 2 points
V1 = IF(Z1 == 1,2,0) ;
With this adjustment, the criteria will have a value of 2 when it passes and a value of 0 when it does not.
If you make this adjustment to all of your criteria, and adjust the final line to:
TECH >= 4
The scan should work.