How to get the highest of all the bars BUT the first one. - futures io
futures io

How to get the highest of all the bars BUT the first one.

Discussion in ThinkOrSwim

    1. trending_up 1,700 views
    2. thumb_up 0 thanks given
    3. group 2 followers
    1. forum 1 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

How to get the highest of all the bars BUT the first one.

(login for full post details)
  #1 (permalink)
Experience: Intermediate
Platform: ThinkOrSwim
jorshhh's Avatar
Posts: 1 since Apr 2019
Thanks: 0 given, 0 received

I want to get the highest of the last n bars; n is a variable. Unfortunately, thinkscript won't let me do Highest(high[1],n) because n should be a constant. Do you know a workaround or a different way to accomplish the same thing? Essentially, I just want to get the highestAll minus the first bar, so i figured highest(high[1],BarNumber()-1) would do, but it doesn't...

Started this thread Reply With Quote

Journal Challenge April 2021 results (now extended!):
Competing for $1800 in prizes from Jigsaw
looks_oneMaking a Living with the Microsby sstheo
(96 thanks from 15 posts)
looks_twoSalao's Journalby Salao
(32 thanks from 7 posts)
looks_3Deetee’s DAX Trading Journal (time based)by Deetee
(26 thanks from 11 posts)
looks_4Learning to Profit - A journey in algorithms and optionsby Syntax
(13 thanks from 8 posts)
looks_5Maybe a little bit different journalby Malykubo
(9 thanks from 8 posts)
Best Threads (Most Thanked)
in the last 7 days on futures io
Would You Sell Your System?
73 thanks
The Crude Dude Oil Trading System
40 thanks
Big Mike in Ecuador
39 thanks
The New Micro Contract - MICRO BITCOIN coming May 2021
24 thanks
futures io site changelog and issues/problem reporting
24 thanks
(login for full post details)
  #2 (permalink)
San Diego, CA
Experience: Beginner
Platform: TOS, Sierra
Trading: Emini ES, Crude CL
Posts: 49 since Mar 2019
Thanks: 5 given, 36 received

You are probably looking for something like this. Its evaluating each bar based on the previous high and keeps increasing the result if it finds a new high value. It avoids the last bar by referencing high[1] rather than the current high. This will operate on all chart data, but if you want to only go back to a certain point you'll need to add more conditions.

def highest = if high[1] > highest[1] then high[1] else highest[1];
plot b = highest;

If you want more examples of this and many other helpful tips, check out this link. I found it very helpful in learning thinkscript. TOS and Thinkscript Snippet Collection

Reply With Quote

futures io Trading Community Platforms and Indicators ThinkOrSwim > How to get the highest of all the bars BUT the first one.

Last Updated on May 2, 2019

Upcoming Webinars and Events

NinjaTrader Indicator Challenge!


Journal Challenge w/$1,800 in prizes!


Seven Trading Mistakes Solved With Smart Trading Tools w/Brannigan Barrett

Elite only

Copyright © 2021 by futures io, s.a., Av Ricardo J. Alfaro, Century Tower, Panama, +507 833-9432,
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