Trading Articles
Article Categories
Article Tools
Highest High Lowest Low
Updated January 19, 2021
Top Posters
looks_one
johnnymustard
with 4 posts (0 thanks)
looks_two
StockT8er
with 2 posts (0 thanks)
looks_3
masterelf1
with 1 posts (0 thanks)
looks_4
JayC
with 1 posts (0 thanks)
trending_up
1,044 views
thumb_up
0 thanks given
group
4 followers
forum
7 posts
attach_file
0 attachments
Welcome to futures io: the largest futures trading community on the planet, with well over 125,000 members
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 and simple.
-- Big Mike, Site Administrator
(If you already have an account, login at the top of the page)
(login for full post details)
#1 (permalink )
Las Vegas, NV
Experience: Intermediate
Platform: NT 8
Broker: NT Brokerage, IQFeed
Trading: ES, 6E & CL
Posts: 24 since Aug 2013
Thanks: 2 given,
10
received
Hello,
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 futures io?
Best Threads (Most Thanked) in the last 7 days on futures io
(login for full post details)
#2 (permalink )
ROY, Utah
Experience: Intermediate
Platform: TradeStation
Posts: 81 since Apr 2020
Thanks: 11 given,
6
received
Try ToS Study ZigZagPercent
(login for full post details)
#3 (permalink )
Las Vegas, NV
Experience: Intermediate
Platform: NT 8
Broker: NT Brokerage, IQFeed
Trading: ES, 6E & CL
Posts: 24 since Aug 2013
Thanks: 2 given,
10
received
StockT8er
Try
ToS Study ZigZagPercent
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
(login for full post details)
#4 (permalink )
ROY, Utah
Experience: Intermediate
Platform: TradeStation
Posts: 81 since Apr 2020
Thanks: 11 given,
6
received
I'm not that great myself. I'm mostly self taught. Just study the code and experiment with different setting until you like the results
(login for full post details)
#5 (permalink )
Roanoke
Posts: 5 since Apr 2017
Thanks: 0 given,
10
received
johnnymustard
Hello,
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
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.
(login for full post details)
#6 (permalink )
Las Vegas, NV
Experience: Intermediate
Platform: NT 8
Broker: NT Brokerage, IQFeed
Trading: ES, 6E & CL
Posts: 24 since Aug 2013
Thanks: 2 given,
10
received
masterelf1
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.
The search goes on, thanks, JM
(login for full post details)
#7 (permalink )
San Diego, CA
Experience: Beginner
Platform: TOS, Sierra
Trading: Emini ES, Crude CL
Posts: 31 since Mar 2019
Thanks: 4 given,
19
received
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.
Let me know if you have questions,
Jay
Code
input period1 = 20;
input period2 = 10;
def barNum = if IsNaN(close) then Double.NaN else barNumber();
def lastBar = HighestAll(barNum);
def barPeriod1 = if lastBar <= period1 then 1 else lastBar - period1 + 1;
def barPeriod2 = if lastBar <= period2 then 1 else lastBar - period2 + 1;
AddChartBubble(lastBar == BarNumber(), "price location" = HIGH, "Last: " + lastBar, Color.CYAN);
AddChartBubble(barPeriod1 == BarNumber(), "price location" = HIGH, "P1: " + barPeriod1, Color.CYAN);
AddChartBubble(barPeriod2 == BarNumber(), "price location" = HIGH, "P2: " + barPeriod2, Color.CYAN);
AddVerticalLine(barPeriod1 == BarNumber(), "Period1: " + BarNumber(), Color.CYAN);
AddVerticalLine(barPeriod2 == BarNumber(), "Period2: " + BarNumber(), Color.CYAN);
def period1Length = period1 - period2;
assert(period1Length > 0, "Period 1 needs to be greater than period 2");
def period1H = if barPeriod2 - 1 == BarNumber() then Highest(high, period1Length) else 0;
def period1L = if barPeriod2 - 1 == BarNumber() then Lowest(low, period1Length) else Double.POSITIVE_INFINITY;
plot period1High = HighestAll(period1H);
plot period1Low = LowestAll(period1L);
def period2H = if lastBar == BarNumber() then Highest(high, period2) else Double.NaN;
def period2L = if lastBar == BarNumber() then Lowest(low, period2) else Double.NaN;
plot period2High = HighestAll(period2H);
plot period2Low = LowestAll(period2L);
def overallH = if lastBar == BarNumber() then Highest(high, period1) else Double.NaN;
def overallL = if lastBar == BarNumber() then Lowest(low, period1) else Double.NaN;
plot overallHigh = HighestAll(overallH);
plot overallLow = LowestAll(overallL);
(login for full post details)
#8 (permalink )
Las Vegas, NV
Experience: Intermediate
Platform: NT 8
Broker: NT Brokerage, IQFeed
Trading: ES, 6E & CL
Posts: 24 since Aug 2013
Thanks: 2 given,
10
received
JayC
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.
Let me know if you have questions,
Jay
Code
input period1 = 20;
input period2 = 10;
def barNum = if IsNaN(close) then Double.NaN else barNumber();
def lastBar = HighestAll(barNum);
def barPeriod1 = if lastBar <= period1 then 1 else lastBar - period1 + 1;
def barPeriod2 = if lastBar <= period2 then 1 else lastBar - period2 + 1;
AddChartBubble(lastBar == BarNumber(), "price location" = HIGH, "Last: " + lastBar, Color.CYAN);
AddChartBubble(barPeriod1 == BarNumber(), "price location" = HIGH, "P1: " + barPeriod1, Color.CYAN);
AddChartBubble(barPeriod2 == BarNumber(), "price location" = HIGH, "P2: " + barPeriod2, Color.CYAN);
AddVerticalLine(barPeriod1 == BarNumber(), "Period1: " + BarNumber(), Color.CYAN);
AddVerticalLine(barPeriod2 == BarNumber(), "Period2: " + BarNumber(), Color.CYAN);
def period1Length = period1 - period2;
assert(period1Length > 0, "Period 1 needs to be greater than period 2");
def period1H = if barPeriod2 - 1 == BarNumber() then Highest(high, period1Length) else 0;
def period1L = if barPeriod2 - 1 == BarNumber() then Lowest(low, period1Length) else Double.POSITIVE_INFINITY;
plot period1High = HighestAll(period1H);
plot period1Low = LowestAll(period1L);
def period2H = if lastBar == BarNumber() then Highest(high, period2) else Double.NaN;
def period2L = if lastBar == BarNumber() then Lowest(low, period2) else Double.NaN;
plot period2High = HighestAll(period2H);
plot period2Low = LowestAll(period2L);
def overallH = if lastBar == BarNumber() then Highest(high, period1) else Double.NaN;
def overallL = if lastBar == BarNumber() then Lowest(low, period1) else Double.NaN;
plot overallHigh = HighestAll(overallH);
plot overallLow = LowestAll(overallL);
Jay, WOW!!
I thank you very much. It certainly does appear to do what I'm looking for.
I really appreciate it.
Cheers & a Happy 2021 to you and yours.
Last Updated on January 19, 2021
Right now
Ongoing
Right now
March
Register to Attend
Elite only
Coming soon
April