NexusFi: Find Your Edge


Home Menu

 





Dazed & Confused about bar numbrering.


Discussion in NinjaTrader

Updated
      Top Posters
    1. looks_one Brendan with 4 posts (0 thanks)
    2. looks_two iantg with 2 posts (0 thanks)
    3. looks_3 Quick Summary with 1 posts (0 thanks)
    4. looks_4 afoschini with 1 posts (0 thanks)
    1. trending_up 1,077 views
    2. thumb_up 0 thanks given
    3. group 2 followers
    1. forum 7 posts
    2. attach_file 0 attachments




 
Search this Thread

Dazed & Confused about bar numbrering.

  #1 (permalink)
Brendan
Chicago, Illinois/USA
 
Posts: 5 since Mar 2013
Thanks Given: 0
Thanks Received: 1

Hi,

I am trying to understand the way ninjatrader uses their bar numbering systems. Methods i.e. High[0] start from the right and move to the left increasing the array count as the bars move to left. However, the current 0 bar is all the way to the left and the current bar numbers increase as the bars move to the right. Please correct me if I have misstated anything so far.

How does that work?

I trade from right to left but the strategies seem to want you to trade from left to right. Let me see if I can explain that better. Trading decisions are made on the hard right side of the chart where new bars are forming or a new bar has just closed. Depending on what your strategy consists of, you may want to "look-back" at some previous time, price, or event to help make a decision on what is happening or has happened as the new bar has formed. I would program from the event that has occurred and look back to a previous price, time, or event and use the array numbering system to identify the event and have plenty of bars on the chart to find that event.

However, (and I may be misunderstanding how the strategies work) it appears to me that the strategies start out at the 0 current bar and there is no way to look past that 0 bar and that is why they require the test for current bars, i.e. there are enough previous current bars closed that your look-back logic doesn't cause an error and stop the script.

1. Is this correct and if not, how do these two numbering systems work and work together?

2. Is there a way to know the total number of bars on the chart so that you don't need to use an arbitrary number of bars in order to condition your look-back logic to not have an index out of range error and to not waste having an exaggerated number of bars just to insure you are safe from the index out of range error.

Looking forward to your help in understanding these concepts.

Thanks,

Brendan

Reply With Quote

Can you help answer these questions
from other members on NexusFi?
ZombieSqueeze
Platforms and Indicators
Futures True Range Report
The Elite Circle
Better Renko Gaps
The Elite Circle
Build trailing stop for micro index(s)
Psychology and Money Management
Are there any eval firms that allow you to sink to your …
Traders Hideout
 
  #3 (permalink)
 iantg 
charlotte nc
 
Experience: Advanced
Platform: My Own System
Broker: Optimus
Trading: Emini (ES, YM, NQ, ect.)
Posts: 408 since Jan 2015
Thanks Given: 90
Thanks Received: 1,147


Forget about the charting / visual component because this will confuse you.

For programming the way the indexing works is like this.

0 = Current Bar
1 = 1 Bar Ago
2 = 2 Bars Ago
etc.

If you try to access High[15] (15 bars ago) for example, and you run this script without first checking if there are at least 15 bars, then you will hit a very vague / unhelpful error message. So you can put some logic in your code to check the count of bars and make sure it is > x before you call x.

Make sense?

Ian

In the analytical world there is no such thing as art, there is only the science you know and the science you don't know. Characterizing the science you don't know as "art" is a fools game.
Visit my NexusFi Trade Journal Reply With Quote
  #4 (permalink)
Brendan
Chicago, Illinois/USA
 
Posts: 5 since Mar 2013
Thanks Given: 0
Thanks Received: 1

Hi Ian,

Thanks for your reply. Sounds good.

Let me ask you this. Is there a way to know how many bars are on the chart and not trade until the chart is fully populated by the bars?

Thanks

Brendan

Reply With Quote
  #5 (permalink)
 iantg 
charlotte nc
 
Experience: Advanced
Platform: My Own System
Broker: Optimus
Trading: Emini (ES, YM, NQ, ect.)
Posts: 408 since Jan 2015
Thanks Given: 90
Thanks Received: 1,147

Brendan,

Yes.

if( Bars.Count > 25)
{
// Do Something
}

Ian




Brendan View Post
Hi Ian,

Thanks for your reply. Sounds good.

Let me ask you this. Is there a way to know how many bars are on the chart and not trade until the chart is fully populated by the bars?

Thanks

Brendan


In the analytical world there is no such thing as art, there is only the science you know and the science you don't know. Characterizing the science you don't know as "art" is a fools game.
Visit my NexusFi Trade Journal Reply With Quote
  #6 (permalink)
Brendan
Chicago, Illinois/USA
 
Posts: 5 since Mar 2013
Thanks Given: 0
Thanks Received: 1

Ian,

Very much appreciated that you have taken the time to both answer my questions as well as reply. This helps.

Thanks again.

Brendan

Reply With Quote
  #7 (permalink)
 afoschini 
Roma Italy
 
Experience: Intermediate
Platform: ninjatrader
Broker: Webank
Trading: Emini, currency, Crude CL
Posts: 16 since Jan 2018
Thanks Given: 11
Thanks Received: 10


Brendan View Post
Hi Ian,

Thanks for your reply. Sounds good.

Let me ask you this. Is there a way to know how many bars are on the chart and not trade until the chart is fully populated by the bars?

Thanks

Brendan

Hi Brendan, there is the reserved word CurrentBar that returns you the number of the current bar from left to right.
Bye

Inviato dal mio SM-A310F utilizzando Tapatalk

Reply With Quote
  #8 (permalink)
Brendan
Chicago, Illinois/USA
 
Posts: 5 since Mar 2013
Thanks Given: 0
Thanks Received: 1

Hi Afoschini,

Thanks for letting me know sir. Exactly the word I was looking for.

Enjoy your morning.

Brendan

Reply With Quote




Last Updated on June 6, 2018


© 2024 NexusFi™, s.a., All Rights Reserved.
Av Ricardo J. Alfaro, Century Tower, Panama City, Panama, Ph: +507 833-9432 (Panama and Intl), +1 888-312-3001 (USA and Canada)
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.
About Us - Contact Us - Site Rules, Acceptable Use, and Terms and Conditions - Privacy Policy - Downloads - Top
no new posts