nasdaqtrader wrote:I think its not working properly.
The code works perfectly. The values returned are exactly in accordance with what is coded. I think you mean to say, "I had expected different results, so what is coded is not in accordance with my aspirations." Please try to understand the difference.
Exactly, what are you looking for?
What did you think the code should be returning?
If the code is not returning the expected result, does it never return the expected result or does it sometimes not return the expected result?
(To the programmer, the difference between sometimes getting it wrong and always getting it wrong is massive!)
Who wrote the code?
What were the intentions of the original author?
Were these intentions ever written down in plain language or pseudo-code before being programmed?
How can we tell if the intentions have been accurately programmed?
What system is this part of?
Is there more to the system than just the code presented?
Did you have the right number of bars of data loaded? or is this another "Load Minumum Bars" issue?
Can you give us any more details other than, "it not working"?
nasdaqtrader wrote:It looks confusing to me
To start with: get rid of the fluffy chaff that is in the exploraton return to see the core code. Columns A, D and E are just data and are not evaluated by the filter condition. I believe you are having issues with the stocks returned by the exploration, which is based on the filter conditions that is columns B and C
Expansion Pivots long
B:{Breakout}(H-L)>ATR(9)
C:{Signal}Ref(C,-2)<=Mov(C,50,S) and Ref(C,-1)>Mov(C,50,S) OR Ref(C,-1)<=Mov(C,50,S) and C>Mov(C,50,S)
Filter:ColB and ColC
Now this is a little cleaner, lets look at the code and perhaps rewirite the columns into the filter condition i.e.
(H-L)>ATR(9) AND
(
Ref(C,-2)<=Mov(C,50,S) AND Ref(C,-1)>Mov(C,50,S)
OR
Ref(C,-1)<=Mov(C,50,S) AND C>Mov(C,50,S)
)
(Operator precedence is important, AND is evaluated before OR)
Looking now at the second part of the criteria (the stuff that used to be in column C) I see some crude attempt at a moving average cross? This is very abstract as the value of the MA is only computed on the last bar and is being compared to the close price over a few bars? Maybe this code is right? It makes no sense but then...
I think the essence of the code is to find a stock which has some volatility criteria and has a close crossing the MA within the last two bars? which is more easily coded as:
{for those people who like the Cross() function, I don't}
(H-L)>ATR(9) AND Alert(Cross(C,Mov(C,50,S),3)
{I prefer}
x:= C>Mov(C,50,S);
(H-L)>ATR(9) AND x AND Alert(x=0,3)
Hope this helps.
wabbit [:D]