Welcome to NexusFi: the best trading community on the planet, with over 150,000 members Sign Up Now for Free
Genuine reviews from real traders, not fake reviews from stealth vendors
Quality education from leading professional traders
We are a friendly, helpful, and positive community
We do not tolerate rude behavior, trolling, or vendors advertising in posts
We are here to help, just let us know what you need
You'll need to register in order to view the content of the threads and start contributing to our community. It's free for basic access, or support us by becoming an Elite Member -- see if you qualify for a discount below.
-- Big Mike, Site Administrator
(If you already have an account, login at the top of the page)
Can anyone help me out with a ToS coding question?
I'm looking at the past 20 periods in total but it could be any number.
I'm trying to find the Highest High Value (HHV) and Lowest Low Value (LLV).
Starting with those 20 periods, I need a way to separate the first 10 periods
from the second 10 periods.
To keep things as simple as possible, let's ignore dates, weekends, holidays etc...
So if my 20 periods in total are December 1st to December 20th, then I'm trying to find
the HHV & LLV for Dec 1st thru the 10th.
And then find the HHV & LLV for Dec 11th thru the 20th. And finally find HHV & LLV for
Dec 1st thru the 20th. Without getting overly complicated here, I will then compare these
values for the indicator I'm writing.
I understand how to use displace (or at least I believe so). I can reference data from X periods
ago using something like "Close[10]" to get the closing price from 10 periods ago. I don't think
that's the problem I'm having.
I don't know how to get the HHV & LLV from between Dec 1st to Dec 10th. I do know how to find
HHV & LLV for Dec 11th to Dec 20th, HHV[10] will do it. And I know how to find HHV & LLV
for the entire 20 bars, LLV[20]. It's just that first 10 bars that I can't figure.
Using a start/stop date/time setup won't work because I use Range bars.
I tried to keep it simple but if there is any confusion, please let me know.
I certainly do appreciate any guidance on the topic.
I thank you and stay healthy,
JM
Can you help answer these questions from other members on NexusFi?
Thank you but apparently I don't know ToS code as well I was thought.
I don't see what I'm looking for in the 'ZigZagPercent'. I'll figure it out sooner or later.
Thanks again, JM
I imagine you will have to just code explicitly from 20th bar to 10th bar and save the HHV and LLV found.
Then repeat from 10 bars out to current bar and do your compares. Not sure the is a premade indi that will give you what you are looking for.
I didn't figure I'd get lucky enough to find something already written. I'm happy to write my own, just not sure how to.
Going from Dec 1st to Dec 20th from the original post, HHV[20-10] just uses last 10 bars in the calculation.
I was hoping that would use the 10 bars from Dec 1st to Dec 10th.
Unfortunately, all it does is use the last 10 bars, Dec 11th to Dec 20th.
The rub is that I'm only doing this on ToS because I can't write code in NT8 at all.
If it performs as expected, I'll pay to have it written for NT8.
This solution is a bit involved, but I couldn't think of an easier way to achieve your request. I used the BarNumber() function to create conditions to call highest or lowest at the correct time. Highest and Lowest already can lookback a specific number of bars.