Total dollar volume divided by percent change


Category:
0
0

Hi Pete,

It’s been a while since I last checked your website. I hope you can help me in the coding I tried to compose from the previous codes you provided me before. I tried to combine them. But not getting what I want. I am using this for my scanner.

 

def prevDailyClose = close(period = AggregationPeriod.DAY)[1];
def volumeDollarsTotal = Round(volume * close, 0);
plot scan = close > open and ((volumeDollarsTotal/prevDailyClose) > 8000000);

 

I am using this in Day Chart. I want to get the Total Dollar Volume / Percent Change of today (real-time). And whatever the result for that, I want to appear in my scanner only above 8M.

 

Thanks in advance.

RESOLVED
Marked as spam
Posted by (Questions: 7, Answers: 16)
Asked on December 13, 2021 1:30 pm
105 views
0
Private answer

I moved your question out of the "Frequently Asked Questions" topic and into the "Stock Scanners" topic.

If I understand your request, you have everything completed except for the percent change.

The formula to compute percent change is as follows:

100 x (secondValue / firstValue - 1)

In your example code you would use the current close for the "secondValue" parameter and you would use previous daily close for the "firstValue" parameter.

def percentChange = 100 * (close / prevDailyClose - 1);

Here is how that would look after we fold that into your existing code:

def prevDailyClose = close[1];
def volumeDollarsTotal = Round(volume * close, 0);
def percentChange = 100 * (close / prevDailyClose - 1);
plot scan = close > open and ((volumeDollarsTotal / percentChange) > 8000000);

Note that I have removed the secondary aggregation reference from the first line. These are not permitted in the Study Filter of custom scans on Thinkorswim so its best not to include them. Since your Study Filter is set to daily time frame it will work just the same. While at the same time, it will not generate an error if you later decide to change the Study Filter to an intraday time frame.

Marked as spam
Posted by (Questions: 37, Answers: 4087)
Answered on December 13, 2021 3:07 pm
0
Thank you so much Pete! This helped me big time :-) I dropped a voluntary contribution for you. Advance Happy Holidays!
( at December 14, 2021 2:29 am)
0
Thank you! Glad I could help.
( at December 14, 2021 8:16 am)
0
Hi Pete, I wasn't sure if I should make a new Q&A for this since it's the same question but for a different program. Since I am not familiar with the code in TradingView, are you able to help me with the same code but to input it in Trading View? Since TOS and TradingView has a total sets of coding. Thanks in Advance.
( at December 23, 2021 9:54 am)
0
Yes, this will need to be posted as a new question in the forum. However in the current version of TradingView it is not possible to build custom scan criteria from code. The only solution available for TradingView would be a chart study.
( at December 23, 2021 2:57 pm)
0
Pete, it doesn't want to add my new question since my new question is similar to my previous question. This is the message I am getting. --- The same question has been already posted. Please use the "Search" option. I already changed the title to just basic "TradingView Code"
( at December 28, 2021 10:29 am)
0
Pete, I tried multiple times in changing the title and the body of the message and still is giving me the same error message. What should I do make my new question appear?
( at December 28, 2021 11:50 am)
0
Sorry that you are having issues with the Q&A Forum. I tested this myself and confirmed there is an issue preventing new questions from being added to the forum. I'm not sure how long it will take me to determine the cause and correct this issue. But I will post a new comment here when it is back up and running. Thanks for your patience while I try to work this out.
( at December 28, 2021 2:32 pm)