How to reference and plot same indicator 2x on different data series - NinjaTrader Programming | futures io social day trading
futures io futures trading


How to reference and plot same indicator 2x on different data series
Updated: Views / Replies:1,557 / 3
Created: by GridKing 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
 

How to reference and plot same indicator 2x on different data series

  #1 (permalink)
Elite Member
San Diego, CA USA
 
Futures Experience: Intermediate
Platform: NinjaTrader
Favorite Futures: ES
 
GridKing's Avatar
 
Posts: 3,650 since May 2011
Thanks: 588 given, 877 received

How to reference and plot same indicator 2x on different data series

I have added 2 data series and second works and plots fine

I have > bars in progress and bars required

now I would like to add another plot of same

Add(new Plot(Color.Orange, "SMA"));


Add(new Plot(Color.Orange, "SMA")); <<<<<<


and then be able to reference it


if (BarsInProgress == 1)




Value.Set

if (BarsInProgress == 2)

Value.Set <<<<<<<<<<

Could someone please tell me how to do that when you have the time ...

or should I make another indicator all together? Thanks

"Successful trading is one long journey, not a destination" Peter Borish Former Head of Research for Paul Tudor Jones speaking on conversations with John F. Carter

Last edited by GridKing; July 8th, 2012 at 06:44 PM.
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,652 since Mar 2010
Thanks: 4,226 given, 25,601 received
Forum Reputation: Legendary



GridKing View Post
I have added 2 data series and second works and plots fine

I have > bars in progress and bars required

now I would like to add another plot of same

Add(new Plot(Color.Orange, "SMA"));


Add(new Plot(Color.Orange, "SMA")); <<<<<<


and then be able to reference it


if (BarsInProgress == 1)




Value.Set

if (BarsInProgress == 2)

Value.Set <<<<<<<<<<

Could someone please tell me how to do that when you have the time ...

or should I make another indicator all together? Thanks


You can use one indicator. Here are some hints:

(1) please pay attention that the first bar series is BarsInProgress == 0, the second one is BarsInProgress == 1

(2) you need to add two SMAs in the variables section, for example

 
Code
private double firstPeriod // period for first SMA
private double secondPeriod // period for second SMA
private SMA myFirstSMA;
private SMA mySecondSMA;


(3) you also need to add a second bar series in the Initialize() section

(4) in a third step you would define those SMAs in the OnStartUp() section of the indicator

 
Code
myFirstSMA = SMA(Inputs[0], firstPeriod);
mySecondSMA = SMA(Inputs[1], secondPeriod);


Now myFirstSMA will be calculated from the first BarSeries, mySecondSMA from the second Bar Series. You can simply call them in OnBarUpdate(), whenever you like. If you have two PlotSeries, then you can affect values to your PlotSeries, for example

 
Code
if (BarsInProgress == 0)
      Values[0].Set(myFirstSMA[0]);

if (BarsInProgress == 1)
      Values[1].Set(mySecondSMA[0]);


Last edited by Fat Tails; July 9th, 2012 at 04:54 AM.
Reply With Quote
The following user says Thank You to Fat Tails for this post:
 
  #4 (permalink)
Elite Member
San Diego, CA USA
 
Futures Experience: Intermediate
Platform: NinjaTrader
Favorite Futures: ES
 
GridKing's Avatar
 
Posts: 3,650 since May 2011
Thanks: 588 given, 877 received


Fat Tails View Post
You can use one indicator. Here are some hints:

(1) please pay attention that the first bar series is BarsInProgress == 0, the second one is BarsInProgress == 1

(2) you need to add two SMAs in the variables section, for example

 
Code
private double firstPeriod // period for first SMA
private double secondPeriod // period for second SMA
private SMA myFirstSMA;
private SMA mySecondSMA;


(3) you also need to add a second bar series in the Initialize() section

(4) in a third step you would define those SMAs in the OnStartUp() section of the indicator

 
Code
myFirstSMA = SMA(Inputs[0], firstPeriod);
mySecondSMA = SMA(Inputs[1], secondPeriod);


Now myFirstSMA will be calculated from the first BarSeries, mySecondSMA from the second Bar Series. You can simply call them in OnBarUpdate(), whenever you like.

Thanks a bunch , the only thing I am a bit confused about is that when the indicator is already named and uses the value as seems to be already coded ... but I copied from the ninja trader example so I guess the calculation in the bottom is the actual code and I can rename it?... Thank You

"Successful trading is one long journey, not a destination" Peter Borish Former Head of Research for Paul Tudor Jones speaking on conversations with John F. Carter
Reply With Quote

Reply



futures io > > > > > How to reference and plot same indicator 2x on different data series

Thread Tools Search this Thread
Search this Thread:

Advanced Search



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

Linda Bradford Raschke: Reading The Tape

Elite only

Adam Grimes: TBA

Elite only

NinjaTrader: TBA

January

Ran Aroussi: TBA

Elite only
     

Similar Threads
Thread Thread Starter Forum Replies Last Post
CTA - Series 3, Series 7, Series 9, Series 10, Series 56 NASD exams certifications Big Mike Traders Hideout 41 January 15th, 2015 10:27 AM
NinjaTrader custom indicator problem with multiple data series - freezing TraderOfFortune NinjaTrader Programming 17 December 22nd, 2011 07:29 PM
NT Indicator to plot Floor Trader Pivots historically on Intraday data? drmartell The Elite Circle 2 December 5th, 2010 04:21 PM
plot axis reference for bar style SARdynamite NinjaTrader Programming 1 July 17th, 2010 07:02 AM
plot reference axis SARdynamite NinjaTrader Programming 1 July 8th, 2010 08:50 AM


All times are GMT -4. The time now is 07:31 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-13 in 0.09 seconds with 19 queries on phoenix via your IP 54.196.182.102