Wow, I am running out of time here and have so much to say.
- You list condition one as the close being within a range. But nowhere in your code or in your specifications do you define exactly what that range is. The only thing your code attempts to do is to find when the close is less than or equal to the moving average times 0.01. So if the moving average is at 300 the close must be below 3. Impossible, right?
- You do not have any CCI code in this whatsoever. So the statement that checks if CCI is below -100 completely fails, but only because it does not compute the value of the CCI indicator anywhere in the code.
I am completely out of time here and I cobbled together a working code but I have no idea if it does what you expect because you did not provide sufficient details in your request:
input length = 30;
input cciLimit = -100;
def maOne = SimpleMovingAvg(close, length);
def maOneCondition = close <= maOne * 1.01;
def cciValue = CCI();
def cciCondition = cciValue < cciLimit;
plot scan = maOneCondition and cciCondition;
Line 4 has been updated to compute the moving average times 1.01, because that is a more reasonable value than 0.01. But again I have no way to know because you failed to describe this portion in sufficient detail. Line 5 is where the CCI value is captured from the built-in version that comes with Thinkorswim.
Otherwise, please take note of the variable names and the way things are organized. Notice how the variable names tell you exactly what each line is doing. This is a huge improvement over the readability and layout of the code you provided. Above all else, it is very important that folks learn the proper way to write code.
Ok, that's all I have. I am actually over my time limit for this request.