♥ 0 |
Good evening Pete, I’ve been getting noise from the previous day’s final volume bars (and sometimes after market too) in the volume scan I’ve been running. So now I’m trying to create a scan that only starts aggregating data at 0700 each day, ignoring the previous day’s bars. I think I’m on the right track now but am having problems trying to figure out how to fit in the boolean portion. The def isopen line is the new stuff. Any help would be much appreciated. # Unusual Volume Scan def agg = aggregationperiod.five_min; def isopen = if secondsFromTime(0700)>= 0 and secondstillTime(1600)>= 0 then 1 else 0; def percent1 = 300; def bullsignal = chg between percent1 and percent2; #plot bullscan = bullsignal; Sincerely, CW
Marked as spam
|
Private answer
Your code uses a secondary aggregation. These are not supported for scans so they code will fail you try to use this on anything but a five min time frame. The variable you created to define the time span is not used anywhere in the code. So we have many problems to address long before we get down to the part you are asking to solve. Which is a boolean condition to create the scan filter. However you did not explain what that condition SHOULD be and your code provides zero hints as to what that true/false condition should be. Dead in the water here.
https://www.hahn-tech.com/ans/scan-within-a-specific-hour-time-range/ If you had searched for this solution before posting this question you should have run across that post. That code will only impact the times in which a scan is able to produce results. The code is meant to be added as a separate Study Filter of your scan. It does NOT control the time span during which the signal is computed. So if you have some computation that needs to be restricted to a specific span of time, the code from that link will not impact that at all. If your scan includes some metric that needs to be computed only within a specified period of time, this code can be incorporated into existing code. The variable named scanPeriod can be converted from a plot to a def. After this you can use that scanPeriod variable to restrict the time span for which various metrics are computed. Since your example code did not include such metrics I do not have a specific solution for you. From your question:
You seem to indicate that you have such a metric you would like to restrict in this way, however I did not find anything of that kind in your code. Marked as spam
|
Please log in to post questions.