Highest High Lowest Low - futures io
futures io



Highest High Lowest Low


Discussion in ThinkOrSwim

Updated
      Top Posters
    1. looks_one johnnymustard with 4 posts (0 thanks)
    2. looks_two StockT8er with 2 posts (0 thanks)
    3. looks_3 JayC with 1 posts (0 thanks)
    4. looks_4 masterelf1 with 1 posts (0 thanks)
    1. trending_up 1,337 views
    2. thumb_up 0 thanks given
    3. group 4 followers
    1. forum 7 posts
    2. 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)

 
Search this Thread
 

Highest High Lowest Low

(login for full post details)
  #1 (permalink)
 johnnymustard 
Las Vegas, NV
 
Experience: Intermediate
Platform: NT 8
Broker: NT Brokerage, IQFeed
Trading: ES, 6E & CL
 
Posts: 26 since Aug 2013
Thanks: 2 given, 12 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

Started this thread Reply With Quote

Can you help answer these questions
from other members on futures io?
Color templates for MT5 40 items
Platforms and Indicators
Eurex Denali vs dxFeed
Sierra Chart
Time Segmented Volume
NinjaTrader
TradingView help in improving Anchored Vwap
Platforms and Indicators
TD Sequential for NT or MW?
Platforms and Indicators
 
 
(login for full post details)
  #2 (permalink)
 StockT8er 
ROY, Utah
 
Experience: Intermediate
Platform: TradeStation
 
Posts: 81 since Apr 2020
Thanks: 11 given, 6 received

Try ToS Study ZigZagPercent

Reply With Quote
 
(login for full post details)
  #3 (permalink)
 johnnymustard 
Las Vegas, NV
 
Experience: Intermediate
Platform: NT 8
Broker: NT Brokerage, IQFeed
Trading: ES, 6E & CL
 
Posts: 26 since Aug 2013
Thanks: 2 given, 12 received



StockT8er View Post
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

Started this thread Reply With Quote
 
(login for full post details)
  #4 (permalink)
 StockT8er 
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

Reply With Quote
 
(login for full post details)
  #5 (permalink)
masterelf1
Roanoke
 
 
Posts: 5 since Apr 2017
Thanks: 0 given, 10 received


johnnymustard View Post
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.

Reply With Quote
 
(login for full post details)
  #6 (permalink)
 johnnymustard 
Las Vegas, NV
 
Experience: Intermediate
Platform: NT 8
Broker: NT Brokerage, IQFeed
Trading: ES, 6E & CL
 
Posts: 26 since Aug 2013
Thanks: 2 given, 12 received


masterelf1 View Post
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

Started this thread Reply With Quote
 
(login for full post details)
  #7 (permalink)
 JayC 
San Diego, CA
 
Experience: Beginner
Platform: TOS, Sierra
Trading: Emini ES, Crude CL
 
Posts: 55 since Mar 2019
Thanks: 8 given, 43 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);

Reply With Quote
 
(login for full post details)
  #8 (permalink)
 johnnymustard 
Las Vegas, NV
 
Experience: Intermediate
Platform: NT 8
Broker: NT Brokerage, IQFeed
Trading: ES, 6E & CL
 
Posts: 26 since Aug 2013
Thanks: 2 given, 12 received


JayC View Post
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.

Started this thread Reply With Quote


futures io Trading Community Platforms and Indicators ThinkOrSwim > Highest High Lowest Low


Last Updated on January 19, 2021


Upcoming Webinars and Events
 

NinjaTrader Indicator Challenge!

Ongoing

Your Charts Should Speak To You w/Bob Cometta

Elite only
 

Our 12-year anniversary w/ $$,$$$ prizes (check soon)

August
     



Copyright © 2021 by futures io, s.a., Av Ricardo J. Alfaro, Century Tower, Panama, Ph: +507 833-9432 (Panama and Intl), +1 888-312-3001 (USA and Canada), info@futures.io
All information is for educational use only and is not investment advice.
There is a substantial risk of loss in trading commodity futures, stocks, options and foreign exchange products. Past performance is not indicative of future results.
no new posts