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 charlesugo_1, 05-26-2026, 05:03 PM
          0 responses
          55 views
          0 likes
          Last Post charlesugo_1  
          Started by DannyP96, 05-18-2026, 02:38 PM
          1 response
          142 views
          0 likes
          Last Post NinjaTrader_ChelseaB  
          Started by CarlTrading, 05-11-2026, 05:56 AM
          0 responses
          160 views
          0 likes
          Last Post CarlTrading  
          Started by CarlTrading, 05-10-2026, 08:12 PM
          0 responses
          96 views
          0 likes
          Last Post CarlTrading  
          Started by Hwop38, 05-04-2026, 07:02 PM
          0 responses
          276 views
          0 likes
          Last Post Hwop38
          by Hwop38
           
          Working...
          X