Bars Object as input to Indicator - NinjaTrader Programming | futures io social day trading
futures io futures trading

Bars Object as input to Indicator
Updated: Views / Replies:1,840 / 3
Created: by NJAMC 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 100,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

Thread Tools Search this Thread

Bars Object as input to Indicator

  #1 (permalink)
Elite Member
Atkinson, NH USA
Futures Experience: Intermediate
Platform: NinjaTrader 8/TensorFlow
Broker/Data: NinjaTrader Brokerage
Favorite Futures: Futures, CL, ES, ZB
NJAMC's Avatar
Posts: 1,938 since Dec 2010
Thanks: 2,987 given, 2,317 received

Bars Object as input to Indicator

I am looking at creating an Indicator which passes a new Input series for processing.

I have been playing with the Bars object:

private Bars newbars;
In the OnBarUpdate:
            if (CurrentBar==0)
                newbars = new Bars(Instrument,BarsPeriod,BarsPeriod.Time[0],Time[0],false,false);

I would then like to be able to pass this new object after modification or addition of more data to an indicator such as:

EMA(newbars, 6);
then plot, etc....

For some reason, this doesn't seem to work. This should pretty much pass the current data into a new Bars object and be processed as such through EMA, but it doesn't seem like the newbars object is being updated.

Has anyone worked with the Bars Object like this before?

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
Berlin, Europe
Futures Experience: Advanced
Platform: NinjaTrader, MultiCharts
Broker/Data: Interactive Brokers
Favorite Futures: Keyboard
Fat Tails's Avatar
Posts: 9,693 since Mar 2010
Thanks: 4,228 given, 25,791 received
Forum Reputation: Legendary

I think your idea is not compatible with the architecture of NinjaTrader. I guess what you want to achieve is use a second bar series and then pass values calculated from that bar series to an indicator.

This can only be achieved, if your new bars are called by OnBarUpdate(). They should also be called in a synchronized way with the first bar series. NInjaTrader will do you this favor, if the secondary bar series needs to be added in the Initialize() section of your indicator:

Add(string instrumentName,  PeriodType periodType,  int  period, MarketDataType marketDataType);
Once you have added the bars you can call them from within an indicator, but you cannot apply an EMA to a bars object, but only to a DataSeries object, so you the expression would be
where Closes[1] is the DataSeries construed from the first secondary bars object added.

Now every incoming tick of real-time data will first trigger an update of the main bar series and then an update the secondary bar series.

Reply With Quote
The following user says Thank You to Fat Tails for this post:
  #4 (permalink)
Elite Member
Atkinson, NH USA
Futures Experience: Intermediate
Platform: NinjaTrader 8/TensorFlow
Broker/Data: NinjaTrader Brokerage
Favorite Futures: Futures, CL, ES, ZB
NJAMC's Avatar
Posts: 1,938 since Dec 2010
Thanks: 2,987 given, 2,317 received

Thanks Fat Tails,

I was hoping that may not be the case, but feel you may be correct. There is one setting at the end of the Add function which is a bool for RealTime. I was hoping that would signal somehow to use the passed series... There are several Indicators that use more than a simple DataStream, they us the Bar data Open,Close,High,Low. It would be nice to figure out how to wrap the data such that it can be feed back into these indicators. It would allow fabrication of future data as well as correcting outliers in back data. This might help predict when action needs to take pace a little sooner than when the event has already passed by and you can't get in fast enough (setting market stop limits for example).

I might contact NinjaTrader support to see if they can shed light on if this is possible. I would really like to try a few ideas...

Thanks again,

Reply With Quote


futures io > > > > > Bars Object as input to Indicator

Thread Tools Search this Thread
Search this Thread:

Advanced Search

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

July Journal Challenge - $500 in Amazon Gift Cards!


AXESS Trader: Powerful Cloud Based Trading Platform w/GFF Brokers

Jul 17

TBA: FuturesTrader71 w/Morad Askar

Elite only

Similar Threads
Thread Thread Starter Forum Replies Last Post
Need NT indicator help to print highlight bars jwhtrades NinjaTrader 35 April 15th, 2015 03:43 PM
Error: Object reference not set to an instance of an object. gomad NinjaTrader Programming 11 December 22nd, 2014 08:09 AM
color bars indicator esam_jir NinjaTrader Programming 3 November 16th, 2010 03:06 AM
need help :: cant fix :: Object reference not set to an instance of an object Trader.Jon NinjaTrader Programming 9 November 3rd, 2010 10:55 AM
i am looking for median renko bars indicator dellcnu Traders Hideout 6 August 5th, 2010 07:38 PM

All times are GMT -4. The time now is 03:43 AM. (this page content is cached, log in for real-time version)

Copyright © 2018 by futures io, s.a., Av Ricardo J. Alfaro, Century Tower, Panama, +507 833-9432,
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 2018-07-17 in 0.10 seconds with 14 queries on phoenix