Accessing another indicator from within an indicator? - NinjaTrader Programming | futures io social day trading
futures io futures trading


Accessing another indicator from within an indicator?
Updated: Views / Replies:4,014 / 7
Created: by RambleDog Attachments:1

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
 

Accessing another indicator from within an indicator?

  #1 (permalink)
Elite Member
Nampa, ID
 
Futures Experience: Intermediate
Platform: TradeStation and Ninja
Broker/Data: AMP - Zenfire
Favorite Futures: ES
 
Posts: 39 since Jan 2011
Thanks: 22 given, 29 received

Accessing another indicator from within an indicator?

I have an indicator that I use that plots a 20 period moving average from a 5min chart on a 1 min chart. I like it better than using a "proxy", but I would like to be able to access its value from with in another indicator that I wrote. Not sure what I need to do to be able to access an indicator from with in an indicator? Anyone have some sample code they could share? Not the regular indicators either like a built in Ninja EMA, I got that. Thanks for any advice.

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,653 since Mar 2010
Thanks: 4,226 given, 25,602 received
Forum Reputation: Legendary



RambleDog View Post
I have an indicator that I use that plots a 20 period moving average from a 5min chart on a 1 min chart. I like it better than using a "proxy", but I would like to be able to access its value from with in another indicator that I wrote. Not sure what I need to do to be able to access an indicator from with in an indicator? Anyone have some sample code they could share? Not the regular indicators either like a built in Ninja EMA, I got that. Thanks for any advice.

If you want to access a first indicator from within a second indicator, this is possible, if the following conditions are met.:

(1) The first indicator must have the values that you want to access exposed in the properties. You cannot access values that are not exposed

(2) Some further restrictions apply for the first indicator. For example the access will not work if the first indicator loads daily bars asynchronously or if it calls ChartControl without checking for null.

(3) The second indicator now can access the first one.


Example

Let us have a look at a simple example. I will take the EMA.

The EMA has only one parameter, which is the period. So you would need to define a variable periodEMA to collect that value from the user.
Put PeriodEMA in the properties section accordingly.

Now that periodEMA exists and contains a value, you can access the indicator by calling it in OnBarUpdate():

 
Code
protected override void OnBarUpdate()
{
       double myDouble;            
       if(EMA(periodEMA).Value.ContainsValue(0)) // checks whether the DataSeries contains a value
            myDouble = EMA(periodEMA).Value.Get(CurrentBar);
       else
            myDouble = 0.0;
      .............................
}

Reply With Quote
The following 9 users say Thank You to Fat Tails for this post:
 
  #4 (permalink)
Elite Member
Nampa, ID
 
Futures Experience: Intermediate
Platform: TradeStation and Ninja
Broker/Data: AMP - Zenfire
Favorite Futures: ES
 
Posts: 39 since Jan 2011
Thanks: 22 given, 29 received

Thanks!

Just sitting down for the evening and it is too late to try to code my indicator this evening, but I can tell from your sample that it is pretty straight forward. I'll give it a try tomorrow morning. Thanks MUCH!

Reply With Quote
 
  #5 (permalink)
Market Wizard
Bangkok
 
Futures Experience: Intermediate
Platform: MultiCharts.NET, S5, Ninj
Broker/Data: AMP, S5, IB
Favorite Futures: ES
 
DionysusToast's Avatar
 
Posts: 2,674 since Nov 2010
Thanks: 777 given, 8,743 received
Forum Reputation: Legendary

You can do this without programming... Might not be what you want...

When you add an indicator to a chart you can enter an input series and that can be an indicator.

See attached pic...

Attached Thumbnails
Accessing another indicator from within an indicator?-7-1-2011-1-57-53-am.png  
Reply With Quote
 
  #6 (permalink)
Elite Member
boston, MA
 
Futures Experience: Intermediate
Platform: NinjaTrader, T4
Favorite Futures: 6E, ES
 
Posts: 51 since Nov 2011
Thanks: 33 given, 183 received

Accessing a proprietary indicator's drawings?

Hey guys,

I purchased a system online and thankfully it was not a scam . That being said, I was interested in backtesting it using the strategy analyzer. The indicator that sets up the signals comes as a downloadable installer and I can't seem to be able to access it anywhere using the ninjascript editor. This may be the whole exposing attributes publicly issue pointed out previously.

It does however plot signals as it goes, so I was hoping to access the attributes of previous bars (ie. color), or the drawings (see the purple hashes in the attached img). Is this possible? This ninja forum says not, but I'd figure I should ask the good people here for some enlightenment.

Test colour Bar - NinjaTrader Support Forum

Thanks!

Reply With Quote
 
  #7 (permalink)
Elite Member
Berlin, Europe
 
Futures Experience: Advanced
Platform: NinjaTrader, MultiCharts
Broker/Data: Interactive Brokers
Favorite Futures: Keyboard
 
Fat Tails's Avatar
 
Posts: 9,653 since Mar 2010
Thanks: 4,226 given, 25,602 received
Forum Reputation: Legendary


mmarco View Post
Hey guys,

I purchased a system online and thankfully it was not a scam . That being said, I was interested in backtesting it using the strategy analyzer. The indicator that sets up the signals comes as a downloadable installer and I can't seem to be able to access it anywhere using the ninjascript editor. This may be the whole exposing attributes publicly issue pointed out previously.

It does however plot signals as it goes, so I was hoping to access the attributes of previous bars (ie. color), or the drawings (see the purple hashes in the attached img). Is this possible? This ninja forum says not, but I'd figure I should ask the good people here for some enlightenment.

Test colour Bar - NinjaTrader Support Forum

Thanks!

You cannot edit a commercial indicator, but you can access the exposed values. To find out which are the exposed values, open the NinjaTrader editor, type the name of the indicator followed by a dot. For example for the SMA, you would type

 
Code
SMA.


You should then see the exposed DataSeries that you can access (and a lot of other junk as well). Or you ask the supplier of your commercial indicator, which of the values are exposed.

Reply With Quote
 
  #8 (permalink)
Market Wizard
Houston, TX
 
Futures Experience: Intermediate
Platform: NinjaTrader
Broker/Data: Optimus Futures
Favorite Futures: 6E
 
TheWizard's Avatar
 
Posts: 1,711 since Jun 2009
Thanks: 509 given, 4,072 received


RambleDog View Post
I have an indicator that I use that plots a 20 period moving average from a 5min chart on a 1 min chart. I like it better than using a "proxy", but I would like to be able to access its value from with in another indicator that I wrote. Not sure what I need to do to be able to access an indicator from with in an indicator? Anyone have some sample code they could share? Not the regular indicators either like a built in Ninja EMA, I got that. Thanks for any advice.

Don't know if this helps, but it's a little ditty I wrote a long time ago, creating a new indicator in which d9ParticleOscillator is referenced twice (14 period and 34 perod). Simple. It compares the 14 period raw trend to the 34 period raw trend and draws an arrow.

{
#region Variables
private bool showarrows = true;
private double arrowoffset = 1;
private Color uparrow = Color.Lime;
private Color downarrow = Color.Red;
#endregion
protected override void Initialize()
{
CalculateOnBarClose = true;
}

protected override void OnBarUpdate()
{
// Condition set 1
if (CrossAbove(d9ParticleOscillator_V2(14, 0).RawTrend, d9ParticleOscillator_V2(34, 0).Prediction, 1))
{
if(showarrows) DrawArrowUp("Up arrow" + CurrentBar, false, 0, Low[0]-arrowoffset*TickSize, Uparrow);
}

// Condition set 2
if (CrossBelow(d9ParticleOscillator_V2(14, 0).RawTrend, d9ParticleOscillator_V2(34, 0).Prediction, 1))
{
if(showarrows) DrawArrowDown("Down arrow" + CurrentBar, false, 0, High[0]+arrowoffset*TickSize, Downarrow);
}
}



#region Properties
[Description("Show Arrow Signals?")]
[Category("Visual")]
public bool ShowArrows
{
get { return showarrows; }
set { showarrows = value; }
}
[Description("Arrow Signal Offset")]
[Category("Visual")]
public double Arrowoffset
{
get { return arrowoffset; }
set { arrowoffset = value; }
}
[Description("Up Arrow")]
[Category("Visual")]
[Gui.Design.DisplayNameAttribute("Up Arrow")]
public Color Uparrow
{
get { return uparrow; }
set { uparrow = value; }
}

/// <summary>
/// </summary>
[Browsable(false)]
public string uparrowSerialize
{
get { return NinjaTrader.Gui.Design.SerializableColor.ToString(uparrow); }
set { uparrow = NinjaTrader.Gui.Design.SerializableColor.FromString(value); }
}
/// <summary>
/// </summary>
[XmlIgnore()]
[Description("Down Arrow")]
[Category("Visual")]
[Gui.Design.DisplayNameAttribute("Down Arrow")]
public Color Downarrow
{
get { return downarrow; }
set { downarrow = value; }
}
/// <summary>
/// </summary>
[Browsable(false)]
public string downarrowSerialize
{
get { return NinjaTrader.Gui.Design.SerializableColor.ToString(downarrow); }
set { downarrow = NinjaTrader.Gui.Design.SerializableColor.FromString(value); }
}
#endregion
}

After all, it's what you learn AFTER you know it all, that counts!
Reply With Quote

Reply



futures io > > > > > Accessing another indicator from within an indicator?

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
Accessing Zigzag swing highs/lows buylosellhi NinjaTrader Programming 3 April 27th, 2011 05:56 PM
Indicator sunny135 NinjaTrader 4 February 27th, 2011 08:21 PM
Accessing the clipboard from within an indicator Tempo NinjaTrader Programming 4 February 7th, 2011 05:23 PM
Accessing a chart from a strategy richtobey NinjaTrader Programming 3 December 31st, 2010 05:07 AM
Accessing Hidden Indicator Conditions KenB NinjaTrader Programming 20 September 29th, 2010 12:57 PM


All times are GMT -4. The time now is 07:17 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-18 in 0.14 seconds with 20 queries on phoenix via your IP 54.163.209.109