foreach BarsInProgress? - NinjaTrader Programming | futures io social day trading
futures io futures trading


foreach BarsInProgress?
Updated: Views / Replies:1,797 / 11
Created: by ShruggedAtlas 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
 

foreach BarsInProgress?

  #11 (permalink)
Atlas
Bloomington
 
Futures Experience: Beginner
Platform: NinjaTrader
Broker/Data: Interactive Brokers
Favorite Futures: Stocks
 
ShruggedAtlas's Avatar
 
Posts: 191 since Apr 2011
Thanks: 78 given, 74 received


jeremytang View Post
Hi ShruggedAtlas,

In the code you've provided, the for loop is redundant... so you can get the exact same effect with it removed.

My question is do you:

1) Want to perform your code on ALL time frames all the time (ie: whenever ANY of the timeframes are updated)

or

2) Only perform your code for the timeframe that is currently being updated

If you fall into category 1, then you need a for loop, and you'll have to reference all the closing prices, highs and lows etc by: Closes[x][0], Highs[x][0] etc. (note the plural).

Otherwise, if you're category 2 you can omit the for loop and access your data using Close[0], High[0] (etc) <-- no plural.

OnBarUpdate is called for each BarsInProgress in turn, and the Close, High (etc) DataSeries are changed to reflect the current BarsInProgress.

I assume you're more likely category 2, because you are referencing SMA, EMA and regressionChannel on the main timeframe (BarsInProgres == 0), am I right? Or do you intend to check the regressionChannel on every timeframe?

Jeremy

Actually I need to reference the indicators for all time frames. What I ended up doing was getting rid of the for loop and accessing the other DataSeries only from within the primary bars update if(BarsInProgress == 0)

it works pretty well overall that way.

"I've missed more than 9,000 shots in my career. I've lost almost 300 games. 26 times, I've been trusted to take the game-winning shot and missed. I've failed over and over and over again in my life. And that is why I succeed."
- Michael Jordan, 5-Time NBA Most Valuable Player, 6-Time NBA Champion
Reply With Quote
 
  #12 (permalink)
Atlas
Bloomington
 
Futures Experience: Beginner
Platform: NinjaTrader
Broker/Data: Interactive Brokers
Favorite Futures: Stocks
 
ShruggedAtlas's Avatar
 
Posts: 191 since Apr 2011
Thanks: 78 given, 74 received

@Fat Tails

thanks FT - You've given me some new info that help a lot. I realize now that i was causing a lot more work for my cpu than necessary. I got rid of the for loop and it works fine. It is still updating on each tick for every conditions on all time frames so I need to spend some time optimizing the algorithm so it doesn't update the longer time frames needlessly. this will go a long way to increasing the performance...still working on that aspect of it.

"I've missed more than 9,000 shots in my career. I've lost almost 300 games. 26 times, I've been trusted to take the game-winning shot and missed. I've failed over and over and over again in my life. And that is why I succeed."
- Michael Jordan, 5-Time NBA Most Valuable Player, 6-Time NBA Champion
Reply With Quote
The following user says Thank You to ShruggedAtlas for this post:

Reply



futures io > > > > > foreach BarsInProgress?

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
foreach loop problem gomad NinjaTrader Programming 14 May 17th, 2011 08:40 PM


All times are GMT -4. The time now is 06:15 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-17 in 0.08 seconds with 19 queries on phoenix via your IP 54.82.81.154