Announcement

Collapse

Looking for a User App or Add-On built by the NinjaTrader community?

Visit NinjaTrader EcoSystem and our free User App Share!

Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
See more
See less

Partner 728x90

Collapse

What does the ADX indicator in the original @Strategy.cs

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    What does the ADX indicator in the original @Strategy.cs

    When I look at the original file @Strategy.cs,
    there is strange code related to ADX indicator like:

    Code:
    [FONT="Courier New"][SIZE="2"]public partial [COLOR="blue"][B]class Strategy[/B][/COLOR] : StrategyBase
    {
    	private NinjaTrader.Indicator.[COLOR="Red"]ADX _indicator[/COLOR] = [COLOR="red"]new NinjaTrader.Indicator.ADX()[/COLOR];
    
            public override bool CalculateOnBarClose
    	{
    		get { return base.CalculateOnBarClose; }
    		set { base.CalculateOnBarClose = [COLOR="red"]_indicator.CalculateOnBarClos[/COLOR]e = value; 
    	}
    
    
            public override int BarsRequired
    	{
    		get { return base.BarsRequired; }
    		set { base.BarsRequired = [COLOR="red"]_indicator.BarsRequired[/COLOR] = value;
    	}
    
    }[/SIZE][/FONT]

    It looks like this specific indicator needs some special handling.
    Why only this one indicator is handled this way?
    For any other indicator I have never seen anything similar...

    #2
    Originally posted by misova View Post
    When I look at the original file @Strategy.cs,
    there is strange code related to ADX indicator like:

    Code:
    [FONT=Courier New][SIZE=2]public partial [COLOR=blue][B]class Strategy[/B][/COLOR] : StrategyBase
    {
        private NinjaTrader.Indicator.[COLOR=Red]ADX _indicator[/COLOR] = [COLOR=red]new NinjaTrader.Indicator.ADX()[/COLOR];
    
            public override bool CalculateOnBarClose
        {
            get { return base.CalculateOnBarClose; }
            set { base.CalculateOnBarClose = [COLOR=red]_indicator.CalculateOnBarClos[/COLOR]e = value; 
        }
    
    
            public override int BarsRequired
        {
            get { return base.BarsRequired; }
            set { base.BarsRequired = [COLOR=red]_indicator.BarsRequired[/COLOR] = value;
        }
    
    }[/SIZE][/FONT]
    It looks like this specific indicator needs some special handling.
    Why only this one indicator is handled this way?
    For any other indicator I have never seen anything similar...
    It is being used as a synchronizer.

    Comment


      #3
      Hello misova,

      Koganam is correct here.

      This is being used as a synchronization for the strategy base class
      Cal H.NinjaTrader Customer Service

      Comment


        #4
        Thanks for answer.

        Do you mean, that it is used to synchronize concurrent execution of some specific parts of code/or maybe between threads.?

        I can't see there any lock / synchronized code in the file @Strategy.cs,
        so it is not clear to me, what needs to be synchronized.

        Best regards
        Misova

        Comment


          #5
          Originally posted by misova View Post
          Thanks for answer.

          Do you mean, that it is used to synchronize concurrent execution of some specific parts of code/or maybe between threads.?

          I can't see there any lock / synchronized code in the file @Strategy.cs,
          so it is not clear to me, what needs to be synchronized.

          Best regards
          Misova
          Those are internal NT files that you cannot modify anyway, so really, what is the point? @Strategy.cs is just the base class for all other strategies, and is itself derived from StrategyBase. It is not an indicator.

          Also, by creating an ADX object, it works as a kind of weak integrity check for the NT installation, viz, that there is at least one indicator (the ADX) in the installation.

          Unfortunately, the arrangement has the unfortunate side effect that is the subject of this thread, where an attempt to Add an indicator of an internally defined DataSeries to a strategy, results in Adding the ADX with default properties instead.

          ref: http://www.ninjatrader.com/support/f...d.php?p=381921

          Synchrony does not necessarily require a lock: whether or not a lock is needed depends on what the code is doing.
          Last edited by koganam; 08-24-2014, 09:03 AM.

          Comment

          Latest Posts

          Collapse

          Topics Statistics Last Post
          Started by ETFVoyageur, Today, 02:04 PM
          2 responses
          15 views
          0 likes
          Last Post ETFVoyageur  
          Started by mjbatts91, Today, 04:48 PM
          0 responses
          2 views
          0 likes
          Last Post mjbatts91  
          Started by 1001111, Today, 09:45 AM
          2 responses
          21 views
          0 likes
          Last Post 1001111
          by 1001111
           
          Started by cre8able, Today, 04:31 PM
          0 responses
          4 views
          0 likes
          Last Post cre8able  
          Started by leojimenezp, Today, 04:04 PM
          0 responses
          7 views
          0 likes
          Last Post leojimenezp  
          Working...
          X