High Low average for 21 daily candles


Category:
0
0

I am once again struggling with the TOS script language. Am used to VB.net. Thus, this dilemma.

In VB.net I would write the average of the 21 days of High/Low candles to a text file or simply show it on the program form. I do not see a way to do that in TOS. It is only a temporary thing and does not need to be saved to a file as long as the 21 day average can be painted to a chart or any other place that is quick to see.

BTW… You coded me a thing that finds symbols that are 5% from a new 52 week high. For how I use it it so far is working great! 🙂

Marked as spam
Posted by (Questions: 1, Answers: 1)
Asked on August 9, 2017 6:41 pm
167 views
0
Private answer

Standard, built-in functionality. No code required. See attached screenshot for how to set this up using the SimpleMovingAvg study that comes with Thinkorsiwm.

Attachments:
Marked as spam
Posted by (Questions: 37, Answers: 4089)
Answered on August 9, 2017 7:51 pm
0
Private answer

Once again I apologize for not explaining this clearly.

What you shared plots a line on a chart of the 21 day High/Low moving average.

I currently go to Yahoo.com and get historical prices on symbols by copying them into the clipboard and pasting the data into a spreadsheet.

Each of the 21 days (rows) of the spreadsheet has a cell with the formula (high – low)/low

In the 21st cell next to this data the spreadsheet sums up the (high – low)/low results from the 21 days of data and divides that by 21. It is the average daily movement a stock moves in one day over a 21 day period. Thus the percentage number I am after using a TOS script, if it is possible.

 

Thank you! :0)

Marked as spam
Posted by (Questions: 1, Answers: 1)
Answered on August 10, 2017 1:40 pm
0
Private answer

Try this:

def calculation = (high - low) / low;
plot customMA = Average(calculation, 21);

Marked as spam
Posted by (Questions: 37, Answers: 4089)
Answered on August 10, 2017 3:51 pm
0
Hi Pete, Thank you for the reply and code. I ran what you shared in TOS / Study / Custom. I had the results list set at 50. All returns totaled to well into the 2k area. However, only the first half dozen or so symbols that I checked had a monthly average of at least 4%. Ya, I know. I suck at explaining this stuff to other coders… Do you know what is missing as I only want returns that have a daily average of at least 4% in the past 21 trading days? I developed a VB.Net program that does this. However, my program checks one symbol at a time and only those I tell it to search. I want to find new symbols that meet this criteria. Thank you in advance! :0)
( at September 5, 2017 5:30 pm)
0

Yeah, I’m completely lost. “I ran what you shared in TOS / Study / Custom”…. what exactly is that? Does it have anything to do with this post? I could not find anything in this post that seemed to fit that description. I have not provided any code in this post pertaining to a scan. I have no idea where the 4% is coming from.

( at September 5, 2017 6:33 pm)