|
Duxx
 Elite
       Posts: 881
Joined: 2/18/2009
User Profile |
How can I write a scan that looks for a condition in the last x days?
Here is a simple example
Loock for stocks that had volume of X in the last 126 days and C>O at the same time
Thank you
|
|
Jim Dean
 Sage
       Posts: 3433
Joined: 3/13/2006
Location: L'ville, GA
User Profile |
Sum(-(V>100000 and C>O), 126) = 126
But that will never happen. No stock has 126 green bars in a row, that I know of.
[Edited by Jim Dean on 1/2/2021 8:39 PM]
|
|
Duxx
 Elite
       Posts: 881
Joined: 2/18/2009
User Profile |
Jim
Thank you
Maybe my description was incorrect.
1) Look for the past 126 days for any stock with volume greater than X
The scan should give me only stocks that had that volume condition in the past 126 days
2) The second condition was that on the specific days the volume was met on condition 1.... the price ended higher
Maybe the second condition cannot be done in omniscan... but the first should be doable? I took out the C>O and still did not get what I was looking for.
Thanks
|
|
Jim Dean
 Sage
       Posts: 3433
Joined: 3/13/2006
Location: L'ville, GA
User Profile |
Sum(-(V>100000 and C>O), 126) >= 1
The and-condition being true results in (-1), otherwise it’s zero. Negative sign converts it to positive one. Sum function processes that rule for 126 days and adds the results. If it was true for one or more of those days, the sum will report the number of days it was true for.
[Edited by Jim Dean on 1/2/2021 8:43 PM]
|
|
Duxx
 Elite
       Posts: 881
Joined: 2/18/2009
User Profile |
This worked. Thank you Jim and Happy New Year
|
|
Jim Dean
 Sage
       Posts: 3433
Joined: 3/13/2006
Location: L'ville, GA
User Profile |
Always happy to help.
Keep that Sum( -( boolean ), periods ) trick in mind. It can be very useful for a lot of situations.
|