how to count in nt7 the number of bars that have closed? - futures io
futures io futures trading



how to count in nt7 the number of bars that have closed?


Discussion in NinjaTrader

Updated
      Top Posters
    1. looks_one anniebee321 with 5 posts (0 thanks)
    2. looks_two Big Mike with 1 posts (1 thanks)
    3. looks_3 redratsal with 1 posts (0 thanks)
    4. looks_4 trader1512 with 1 posts (0 thanks)
    1. trending_up 4,327 views
    2. thumb_up 1 thanks given
    3. group 4 followers
    1. forum 9 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 count in nt7 the number of bars that have closed?

(login for full post details)
  #1 (permalink)
london
 
Experience: Beginner
Platform: ninja
Trading: fgbl
 
Posts: 152 since Nov 2009
Thanks: 64 given, 44 received

i would like my indicator to start recalculating after every 180 bars -- any ideas how i would count the number of bars? many thanks in advance

i had it coded to reset and restart calculating at 7am each day using
if (ResetDaily && ToTime(Time[0]) >= ResetTime*100 && ToTime(Time[1]) < ResetTime*100)

but it does not work :-)

Started this thread Reply With Quote

Journal Challenge February 2021 results (so far):
Competing for $1500 in prizes from Topstep
looks_oneSBtrader82 's Trading Journalby SBtrader82
(154 thanks from 29 posts)
looks_twoJust BEING a Trader: Letting Go!!by iqgod
(111 thanks from 32 posts)
looks_3Wisdom is Emptinessby Mtype
(68 thanks from 25 posts)
looks_4Deetee’s DAX Trading Journal (time based)by Deetee
(31 thanks from 16 posts)
looks_5Journal for peanuts1956by peanuts1956
(23 thanks from 13 posts)
 
 
(login for full post details)
  #3 (permalink)
UK
 
Experience: Intermediate
Platform: Ninja
Broker: Mirus/Zen
Trading: Futures - bonds, currencies, index
 
Posts: 288 since Oct 2010
Thanks: 70 given, 270 received


The variable CurrentBar tells you the number of the current bar. It either starts from the start of a strategy, or from the start of the session (can't remember which). In any case,

CurrentBar % 180 == 0

will be true every 180 bars.

Reply With Quote
 
(login for full post details)
  #4 (permalink)
london
 
Experience: Beginner
Platform: ninja
Trading: fgbl
 
Posts: 152 since Nov 2009
Thanks: 64 given, 44 received

thanks xeno

will try and give that - a bash it was written for me so i hope i can amend it - will try today

Started this thread Reply With Quote
 
(login for full post details)
  #5 (permalink)
london
 
Experience: Beginner
Platform: ninja
Trading: fgbl
 
Posts: 152 since Nov 2009
Thanks: 64 given, 44 received

hi xeno,

it doesn't quite work perhaps because i have missing bars during some hours of some days it overlaps days
but thanks for your help on this

Started this thread Reply With Quote
 
(login for full post details)
  #6 (permalink)
Site Administrator
Swing Trader
Data Scientist & DevOps
Manta, Ecuador
 
Experience: Advanced
Platform: My own custom solution
Trading: Emini Futures
 
Big Mike's Avatar
 
Posts: 49,744 since Jun 2009
Thanks: 32,292 given, 97,488 received

I am rusty, but try Bars.FirstBarOfSession to get that bar number, then compare to CurrentBar.

Something like

 
Code
                            
bool mySignal = ((CurrentBar Bars.FirstBarOfSession) >= 180
If you don't need to start at zero with each new session, then just set a flag every 180 bars (like Xeno showed).

Mike

We're here to help -- just ask

For the best trading education, watch our webinars
Searching for trading reviews? Review this list

Follow us on Twitter, YouTube, and Facebook

Support our community as an Elite Member:
https://futures.io/elite/
Follow me on Twitter Visit my futures io Trade Journal Reply With Quote
The following user says Thank You to Big Mike for this post:
 
(login for full post details)
  #7 (permalink)
london
 
Experience: Beginner
Platform: ninja
Trading: fgbl
 
Posts: 152 since Nov 2009
Thanks: 64 given, 44 received

thanks very much mike - that might be it, it looks logical - though my programming is limited
will give it a try

Started this thread Reply With Quote
 
(login for full post details)
  #8 (permalink)
london
 
Experience: Beginner
Platform: ninja
Trading: fgbl
 
Posts: 152 since Nov 2009
Thanks: 64 given, 44 received

woohoo! that works thanks mike

Started this thread Reply With Quote
 
(login for full post details)
  #9 (permalink)
west chester
 
Experience: Intermediate
Platform: NT
 
Posts: 48 since Oct 2009
Thanks: 1 given, 55 received

is there an indicator that will number bars in nt7. the bar numbering indicator that i downloaded starts the first bar at zero and i have not been able to fix it.

thanks

Visit my futures io Trade Journal Reply With Quote
 
(login for full post details)
  #10 (permalink)
Milan (I)
 
Experience: Advanced
Platform: Ninjatrader
Broker: Kinetick
Trading: FDAX,6E,CL,YM,NQ,ES
 
redratsal's Avatar
 
Posts: 1,653 since Oct 2010
Thanks: 1,215 given, 2,082 received



trader1512 View Post
is there an indicator that will number bars in nt7. the bar numbering indicator that i downloaded starts the first bar at zero and i have not been able to fix it.

thanks

Hi,

Try this one you will get OHLCV as well

Visit my futures io Trade Journal Reply With Quote


futures io Trading Community Platforms and Indicators NinjaTrader > how to count in nt7 the number of bars that have closed?


Last Updated on April 26, 2011


Upcoming Webinars and Events
 

NinjaTrader Indicator Challenge!

Ongoing
 

Journal Challenge w/$1500 prizes from Topstep!

February
 

Identifying Setups & Targets Using Profile Charts w/Trevor & Tradovate

Feb 25
 

Battlestations! Show us your trading desk - $1,500 in prizes!

March
     



Copyright © 2021 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