Indicator to record H, L, Swing, Range, ZigZag - NinjaTrader Programming | futures io social day trading
futures io futures trading


Indicator to record H, L, Swing, Range, ZigZag
Updated: Views / Replies:3,462 / 5
Created: by jungian 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
 

Indicator to record H, L, Swing, Range, ZigZag

  #1 (permalink)
Elite Member
Ontario
 
Futures Experience: Intermediate
Platform: NinjaTrader
Broker/Data: Mirus/ZF
Favorite Futures: ES, 6E, CL
 
jungian's Avatar
 
Posts: 99 since Aug 2009
Thanks: 89 given, 250 received

Indicator to record H, L, Swing, Range, ZigZag

Indicator to record H, L, Swing, Range, ZigZag

I am looking for some help with Ninja re: storing data as variables.

Here is a marked up chart with a legend:

Please register on futures.io to view futures trading content such as post attachment(s), image(s), and screenshot(s).


Red Square: Bar lows
Green Squares: Bar highs
Yellow Hash: ZigZag
Salmon Line: Swing High
Green Line: Swing Low
Blue Bars at bottom: Range Calculator.

I need a recorder that stores the information for "X" bars back that will record independently
the variables for all of these:

For example I have 32 bars of data shown in the screenshot.

So I need 32 bars of data with the following information:

For example at bar 3 the information so far recorded would be;

Bar 1: High 1.2381, Low 1.2373, Swing Low 1.2369, Swing High 1.2394, Range: 9
Bar 2: High 1.2383, Low 1.2378, Swing Low 1.2369, Swing High 1.2394, Range: 5
Bar 3: etc etc


So the simplified info
B1, H=1.2381, L=1.2373, SL=1.2369, SH=1.2394, R=9

Any help with this would be much appreciated.

I would like to set it for as many bars back as I need and be able to retreive the variables for calculating.

Any help is much appreciated


Thanks
Jungian

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)
Elite Member
Germany (Meck-Pomm)
 
Futures Experience: Advanced
Platform: NinjaTrader
 
Posts: 110 since Jun 2009
Thanks: 54 given, 994 received



jungian View Post
Indicator to record H, L, Swing, Range, ZigZag

I am looking for some help with Ninja re: storing data as variables.

I need a recorder that stores the information for "X" bars back that will record independently
the variables for all of these:

Bar 1: High 1.2381, Low 1.2373, Swing Low 1.2369, Swing High 1.2394, Range: 9
Bar 2: High 1.2383, Low 1.2378, Swing Low 1.2369, Swing High 1.2394, Range: 5
Bar 3: etc etc

Hey Jungian,

you can do this for example with a list (or any other data structure depends on the usage) of a struct object that holds all information.

 
Code
                            
private struct BarInformation

{
  public 
int barNumber;
  public 
double highPrice;
  ...

  public 
BarInformation(int numberdouble high, ...)
  {
    
barNumber number;
    
highPrice high;
    ...
  }
}

// A list that holds the BarInformation
private List<BarInformation>  information = new List<BarInformation>();

protected 
override void OnBarUpdate()
{
  
BarInformation info = new BarInformation(CurrentBarHigh[0],...);
  
information.Add(info);
  
// Get the high of a specific bar
  
double highValue information[8].high;

dorschden

Reply With Quote
The following 2 users say Thank You to dorschden for this post:
 
  #4 (permalink)
Elite Member
Ontario
 
Futures Experience: Intermediate
Platform: NinjaTrader
Broker/Data: Mirus/ZF
Favorite Futures: ES, 6E, CL
 
jungian's Avatar
 
Posts: 99 since Aug 2009
Thanks: 89 given, 250 received

Thanks dorschden

Dorschden....Thanks for your help....

What about storing the Range of each Bar? And the Swing High/Low variable?

How do I 'access' the Range and the Swing High/Low data?

My real question is how do I then go about 'calling' on these variables to be used in calculations?

Sorry but my programming experience is very very limited.

For example if I want to use the stored inputs of the last 'X' number of bars how do I invoke them?

In plain English programming

GET Bar 1 thru 8 lows, GET Swing Low, GET Range of bars 1 thru 8 etc.


Any help would be great.
Jungian

Reply With Quote
 
  #5 (permalink)
Site Administrator
Manta, Ecuador
 
Futures Experience: Advanced
Platform: My own custom solution
Favorite Futures: E-mini ES S&P 500
 
Big Mike's Avatar
 
Posts: 46,240 since Jun 2009
Thanks: 29,353 given, 83,234 received

Moderator Note
Thread moved from Traders Hideout to NinjaTrader Programming. -- Big Mike



Mike

Due to time constraints, please do not PM me if your question can be resolved or answered on the forum.

Need help?
1) Stop changing things. No new indicators, charts, or methods. Be consistent with what is in front of you first.
2) Start a journal and post to it daily with the trades you made to show your strengths and weaknesses.
3) Set goals for yourself to reach daily. Make them about how you trade, not how much money you make.
4) Accept responsibility for your actions. Stop looking elsewhere to explain away poor performance.
5) Where to start as a trader? Watch this webinar and read this thread for hundreds of questions and answers.
6)
Help using the forum? Watch this video to learn general tips on using the site.

If you want
to support our community, become an Elite Member.

Reply With Quote
 
  #6 (permalink)
Elite Member
Germany (Meck-Pomm)
 
Futures Experience: Advanced
Platform: NinjaTrader
 
Posts: 110 since Jun 2009
Thanks: 54 given, 994 received

Answer
This post has been selected as an answer to the original posters question Answer


jungian View Post
What about storing the Range of each Bar? And the Swing High/Low variable?

How do I 'access' the Range and the Swing High/Low data?

My real question is how do I then go about 'calling' on these variables to be used in calculations?

Sorry but my programming experience is very very limited.

For example if I want to use the stored inputs of the last 'X' number of bars how do I invoke them?

In plain English programming

GET Bar 1 thru 8 lows, GET Swing Low, GET Range of bars 1 thru 8 etc.


Any help would be great.
Jungian

You have to calculate all values you want to store and then create an information object with all this values and add this to your list.

 
Code
                            
protected override void OnBarUpdate() 


  
// Calculate all values
  // Bar number
  
number CurrentBar;
  
// High and low
  
high High[0];
  
low Low[0];
  
// Range of the bar
  
range High[0] - Low[0];

  ... 
For swing values you need another indicator to calculate the swing values (e.g. NT standard swing indicator). I don't know what swing values you want store for each bar, but I think the swing price and the number of bars the swing is ago make sense.

 
Code
                            
// Calculates how many bars back the last swing high occurred

// if -1 no swing high is in this period(=20 bars for example)
int swingHighBarsBack Swing(strength).SwingHighBar(01period);

// No swing high
if (swingHighBarsBack == -1)
  
swingHigh = -1;
// Swing high
else
  
swingHigh Swing(strength).SwingHigh[swingHighBarsBack];

// for swing low vice versa

// Now you have all your calculated values and can store them

// Create a BarInformation object
BarInformation info = new BarInformation(numberhighlowrange,
  
swingHighBarsBackswingHighswingLowBarsBackswingLow); 
// Add this to your list
information.Add(info); 
// Now all your values are stored and you can use them for calculations

// Get the bar range 8 bars ago
double rangeValue information[CurrentBar 8].range;
// Get the swingLow 21 bars ago
double swingLowValue information[CurrentBar 21].swingLow;
// Now you can use rangeValue and swingLowValue in your calculations


// if you want invoke a period of data you can use a loop
// e.g. average of the last 5 bar ranges
// Create a variable that stores the sum of the last 5 ranges
double rangeAverage 0.0;
// a loop
for (int i 15i++)
{
  
// Sum of the values
  
rangeAverage rangeAverage information[CurrentBar i].range;
}
// Range average is the sum divided by 5
rangeAverage rangeAverage 5
The standard call to get your stored information is

information[barsAgo the value you want access for].VALUE is the value you want access for

Hope this helps.

dorschden

Reply With Quote
The following 3 users say Thank You to dorschden for this post:

Reply



futures io > > > > > Indicator to record H, L, Swing, Range, ZigZag

Thread Tools Search this Thread
Search this Thread:

Advanced Search



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

Jigsaw Trading: TBA

Elite only

FuturesTrader71: TBA

Elite only

NinjaTrader: TBA

Jan 18

RandBots: TBA

Jan 23

GFF Brokers & CME Group: Futures & Bitcoin

Elite only

Adam Grimes: TBA

Elite only

Ran Aroussi: TBA

Elite only
     

Similar Threads
Thread Thread Starter Forum Replies Last Post
How to get the High/Low from the ZigZag indicator in my strategy? NinjaStrategies NinjaTrader Programming 12 July 30th, 2011 12:45 PM
DrawRegion with Swing indicator Azzzz NinjaTrader Programming 2 June 7th, 2011 05:24 PM
Accessing Zigzag swing highs/lows buylosellhi NinjaTrader Programming 3 April 27th, 2011 05:56 PM
ZigZag indicator but with tick difference shown at the pivot points wuolong NinjaTrader 3 April 6th, 2010 09:59 AM
Pivots, ZigZag, Swing Issues hondo69 The Elite Circle 4 November 21st, 2009 12:30 AM


All times are GMT -4. The time now is 03:34 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-16 in 0.12 seconds with 29 queries on phoenix via your IP 54.196.201.241