Announcement

Collapse
No announcement yet.

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 Geovanny Suaza, 02-11-2026, 06:32 PM
          0 responses
          647 views
          0 likes
          Last Post Geovanny Suaza  
          Started by Geovanny Suaza, 02-11-2026, 05:51 PM
          0 responses
          368 views
          1 like
          Last Post Geovanny Suaza  
          Started by Mindset, 02-09-2026, 11:44 AM
          0 responses
          108 views
          0 likes
          Last Post Mindset
          by Mindset
           
          Started by Geovanny Suaza, 02-02-2026, 12:30 PM
          0 responses
          571 views
          1 like
          Last Post Geovanny Suaza  
          Started by RFrosty, 01-28-2026, 06:49 PM
          0 responses
          573 views
          1 like
          Last Post RFrosty
          by RFrosty
           
          Working...
          X