plot scan = average(volume,30) > 1000000;
There are 252 trading days in a year, so if you are looking for a true month's worth of average time, you might want to change the length of bars to 21. Make sure you choose a daily agg as the scan timeframe.Join useThinkScript to post your question to a community of 21,000+ developers and traders.
YO! thank you so much!@dmillz This should scan for the average volume of the last 30 bars to be greater than 1M.plot scan = average(volume,30) > 1000000;
There are 252 trading days in a year, so if you are looking for a true month's worth of average time, you might want to change the length of bars to 21. Make sure you choose a daily agg as the scan timeframe.
def volLast30DayAvg = (volume(period = "DAY")[1] + volume(period = "DAY")[2] + volume(period = "DAY")[3] + volume(period = "DAY")[4] + volume(period = "DAY")[5] + volume(period = "DAY")[6] + volume(period = "DAY")[7] + volume(period = "DAY")[8] + volume(period = "DAY")[9] + volume(period = "DAY")[10] + volume(period = "DAY")[11] + volume(period = "DAY")[12] + volume(period = "DAY")[13] + volume(period = "DAY")[14] + volume(period = "DAY")[15] + volume(period = "DAY")[16] + volume(period = "DAY")[17] + volume(period = "DAY")[18] + volume(period = "DAY")[19] + volume(period = "DAY")[20] + volume(period = "DAY")[21] + volume(period = "DAY")[22] + volume(period = "DAY")[23] + volume(period = "DAY")[24] + volume(period = "DAY")[25] + volume(period = "DAY")[26] + volume(period = "DAY")[27] + volume(period = "DAY")[28] + volume(period = "DAY")[29] + volume(period = "DAY")[30]) / 30;
def today = volume(period = "DAY");
you can do this with the condition wizard:Hope everyone is doing well. Probably a pretty simple problem to solve but I am at a loss. I am trying to have a scanner return results if volume >= volLast30DayAvg but I am not sure of the syntax to achieve this.
Code:def volLast30DayAvg = (volume(period = "DAY")[1] + volume(period = "DAY")[2] + volume(period = "DAY")[3] + volume(period = "DAY")[4] + volume(period = "DAY")[5] + volume(period = "DAY")[6] + volume(period = "DAY")[7] + volume(period = "DAY")[8] + volume(period = "DAY")[9] + volume(period = "DAY")[10] + volume(period = "DAY")[11] + volume(period = "DAY")[12] + volume(period = "DAY")[13] + volume(period = "DAY")[14] + volume(period = "DAY")[15] + volume(period = "DAY")[16] + volume(period = "DAY")[17] + volume(period = "DAY")[18] + volume(period = "DAY")[19] + volume(period = "DAY")[20] + volume(period = "DAY")[21] + volume(period = "DAY")[22] + volume(period = "DAY")[23] + volume(period = "DAY")[24] + volume(period = "DAY")[25] + volume(period = "DAY")[26] + volume(period = "DAY")[27] + volume(period = "DAY")[28] + volume(period = "DAY")[29] + volume(period = "DAY")[30]) / 30; def today = volume(period = "DAY");
????
Xenox, thank you for the help. Great video. Sounds like a dynamic alert is what I need. Trying to find how to create one. Right now I just see Study Alert within my TOS platform.you can do this with the condition wizard:
you can learn how to use the condition wizard via
hint: choose volume on one side and volumeavg on the other side with greater than or equal to in the middle
Digging into this it seems a little complex. Since I already have two studies coded it would probably be much easier for me to just figure out the line/lines of code that I need instead of reinventing the wheel.Xenox, thank you for the help. Great video. Sounds like a dynamic alert is what I need. Trying to find how to create one. Right now I just see Study Alert within my TOS platform.
Start a new thread and receive assistance from our community.
useThinkScript is the #1 community of stock market investors using indicators and other tools to power their trading strategies. Traders of all skill levels use our forums to learn about scripting and indicators, help each other, and discover new ways to gain an edge in the markets.
We get it. Our forum can be intimidating, if not overwhelming. With thousands of topics, tens of thousands of posts, our community has created an incredibly deep knowledge base for stock traders. No one can ever exhaust every resource provided on our site.
If you are new, or just looking for guidance, here are some helpful links to get you started.