Highest bar between 20 and 40 bars ago - NinjaTrader Programming | futures io social day trading
futures io futures trading


Highest bar between 20 and 40 bars ago
Updated: Views / Replies:195 / 5
Created: by DavidBodhi Attachments:0

Welcome to futures io.

(If you already have an account, login at the top of the page)

futures io is the largest futures trading community on the planet, with over 90,000 members. At futures io, our goal has always been and always will be to create a friendly, positive, forward-thinking community where members can openly share and discuss everything the world of trading has to offer. The community is one of the friendliest you will find on any subject, with members going out of their way to help others. Some of the primary differences between futures io and other trading sites revolve around the standards of our community. Those standards include a code of conduct for our members, as well as extremely high standards that govern which partners we do business with, and which products or services we recommend to our members.

At futures io, our focus is on quality education. No hype, gimmicks, or secret sauce. The truth is: trading is hard. To succeed, you need to surround yourself with the right support system, educational content, and trading mentors Ė all of which you can find on futures io, utilizing our social trading environment.

With futures io, you can find honest trading reviews on brokers, trading rooms, indicator packages, trading strategies, and much more. Our trading review process is highly moderated to ensure that only genuine users are allowed, so you donít need to worry about fake reviews.

We are fundamentally different than most other trading sites:
  • We are here to help. Just let us know what you need.
  • We work extremely hard to keep things positive in our community.
  • We do not tolerate rude behavior, trolling, or vendors advertising in posts.
  • We firmly believe in and encourage sharing. The holy grail is within you, we can help you find it.
  • We expect our members to participate and become a part of the community. Help yourself by helping others.

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

Reply
 
Thread Tools Search this Thread
 

Highest bar between 20 and 40 bars ago

  #1 (permalink)
Elite Member
Milwaukee, WI, USA
 
Futures Experience: Beginner
Platform: NinjaTrader
Favorite Futures: TF
 
DavidBodhi's Avatar
 
Posts: 47 since Oct 2014
Thanks: 2 given, 5 received

Highest bar between 20 and 40 bars ago

Hi -

I am aware of how to get the highest high/lowest low within the last X number of bars AND how to determine how many bars back each of those is.

What I'd like to do is find the highest high within X number of bars PRIOR to the highest high within X number of bars.

Huh, you say?

So, let's say I use MAX(High, 20)[1].
That tells me what the highest high in the last 20 bars was.
Then I use HighestBar(High, 20) and that tells me the actual value of that highest high.

Now, I want to find the highest high within the 20 bars prior to the high I just found, above.

Can anyone suggest code to do this? Or point to someone else's solution?

Thanks, in advance.

(My intention is to home in on the high/low cycles within a trading range, figuring out the width of the range and how many bars apart the highs and lows are.)

Reply With Quote
 
  #2 (permalink)
Quick Summary
Quick Summary Post

Quick Summary is created and edited by users like you... Add FAQ's, Links and other Relevant Information by clicking the edit button in the lower right hand corner of this message.

 
  #3 (permalink)
Market Wizard
Hamburg Germany
 
Futures Experience: Advanced
Platform: Multicharts, Tradestation, Multicharts.NET, NinjaTrader, MetaTrader
Broker/Data: DTN IQ
Favorite Futures: ES
 
Posts: 1,527 since Apr 2013
Thanks: 229 given, 854 received
Forum Reputation: Legendary


DavidBodhi,

one approach would be to loop over the desired bars once you have the bar number of the highest high.
You could adjust the code in the first post here, to loop over the 20 bars to the left of the bar that returned the highest high:
https://futures.io/ninjatrader-programming/16159-efficient-code-finding-highest-high-lowest-lows-range-bars.html

As you are using Max in your code already, you should also be able to get the value using:
 
Code
int barsAgo = HighestBar(High, 20);
double HighestH2 = MAX(High, 20)[barsAgo+1];
Regards,

ABCTG

Reply With Quote
The following user says Thank You to ABCTG for this post:
 
  #4 (permalink)
Elite Member
Milwaukee, WI, USA
 
Futures Experience: Beginner
Platform: NinjaTrader
Favorite Futures: TF
 
DavidBodhi's Avatar
 
Posts: 47 since Oct 2014
Thanks: 2 given, 5 received


ABCTG View Post
DavidBodhi,

one approach would be to loop over the desired bars once you have the bar number of the highest high.
You could adjust the code in the first post here, to loop over the 20 bars to the left of the bar that returned the highest high:
https://futures.io/ninjatrader-programming/16159-efficient-code-finding-highest-high-lowest-lows-range-bars.html

As you are using Max in your code already, you should also be able to get the value using:
 
Code
int barsAgo = HighestBar(High, 20);
double HighestH2 = MAX(High, 20)[barsAgo+1];
Regards,

ABCTG

Thanks, ABCTG. That will work well for the value of the previous high.

I'll also need the number of bars back that previous high occurred. I'm not much of a programmer, or I'm sure I'd see immediately how to look at all the prior closes from [1] to [barsAgo+1], but that code isn't clear to me. I'll do some research on that, unless you can offer another concise method.

Thanks, again.

Reply With Quote
 
  #5 (permalink)
Market Wizard
Hamburg Germany
 
Futures Experience: Advanced
Platform: Multicharts, Tradestation, Multicharts.NET, NinjaTrader, MetaTrader
Broker/Data: DTN IQ
Favorite Futures: ES
 
Posts: 1,527 since Apr 2013
Thanks: 229 given, 854 received
Forum Reputation: Legendary

DavidBodhi,

you are welcome. This would be something you can accomplish with the loop from the link, too. While you loop over the bars, save the high into your variable in case it's higher than the currently found highest high and save the number of bars this high is back in another variable.

Regards,

ABCTG

Reply With Quote
 
  #6 (permalink)
Elite Member
Milwaukee, WI, USA
 
Futures Experience: Beginner
Platform: NinjaTrader
Favorite Futures: TF
 
DavidBodhi's Avatar
 
Posts: 47 since Oct 2014
Thanks: 2 given, 5 received


ABCTG View Post
DavidBodhi,

you are welcome. This would be something you can accomplish with the loop from the link, too. While you loop over the bars, save the high into your variable in case it's higher than the currently found highest high and save the number of bars this high is back in another variable.

Regards,

ABCTG

Thanks, again.

I'll look into that.

Reply With Quote

Reply



futures io > > > > > Highest bar between 20 and 40 bars ago

Thread Tools Search this Thread
Search this Thread:

Advanced Search



Upcoming Webinars and Events (4:30PM ET unless noted)

Linda Bradford Raschke: Reading The Tape

Elite only

Adam Grimes: TBA

Elite only

NinjaTrader: TBA

January

Ran Aroussi: TBA

Elite only
     

Similar Threads
Thread Thread Starter Forum Replies Last Post
Efficient Code for finding highest high and lowest lows of a range of bars. xigreek NinjaTrader Programming 18 July 31st, 2015 03:54 PM
How to show bars ago cross for MACD pollux321 ThinkOrSwim 3 April 29th, 2015 01:56 PM
highest bar close occuring within the last X number of bars . . . . jmejedi NinjaTrader Programming 37 October 6th, 2014 01:52 AM
Bars Ago in an indicator patbateman NinjaTrader Programming 22 January 13th, 2014 11:17 AM
Scan for Gap Up N Bars Ago idenr ThinkOrSwim Programming 1 April 10th, 2013 10:17 PM


All times are GMT -4. The time now is 07:19 AM.

Copyright © 2017 by futures io, s.a., Av Ricardo J. Alfaro, Century Tower, Panama, +507 833-9432, 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
Page generated 2017-12-13 in 0.10 seconds with 19 queries on phoenix via your IP 54.196.182.102