Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Are multi-version compatible indicators possible ?

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

    Are multi-version compatible indicators possible ?

    hi,

    Is there an elegant recommended way to create a multi-NT version compatible indicator ?

    As some classes have changed,some lines won't compile, so I guess the only way would be to use preprocessing directives in the code. Is there any preprocessor symbol defined that would allow things like
    Code:
    #if NT7
    some line of code for NT7
    #else
    some line of code for NT6.5
    #endif

    #2
    Originally posted by gomifromparis View Post
    hi,

    Is there an elegant recommended way to create a multi-NT version compatible indicator ?

    As some classes have changed,some lines won't compile, so I guess the only way would be to use preprocessing directives in the code. Is there any preprocessor symbol defined that would allow things like
    Code:
    #if NT7
    some line of code for NT7
    #else
    some line of code for NT6.5
    #endif
    What would your goal be in doing this? Apart from the code breaking changes which would require two versions of your script if the script utlized breaking code...The underlying fundamental logic between 6.5 and 7 is essentially the same.
    RayNinjaTrader Customer Service

    Comment


      #3
      we'll I'd like to be able to maintain only one source file of an indicator that would work on NT6.5 and NT7.

      For instance, in NT6.5 I use ChartControl.GetXByBarIdx(index), ChartControl.ChartControl.BarOutlinePen and TickSize.

      in NT7, you have to use ChartControl.GetXByBarIdx(BarsArray[0],index), the BarOutlinePen is elsewhere in the Dataseries and TickSize must be accessed via Instrument.MasterInstrument.TickSize.

      So either I duplicate the code and have to maintain 2 version of the source, one for NT6.5 and one for NT7, or either I am able to use preprocessing instructions to deal with those very specific changes and write:

      Code:
      #if NT7
         x=ChartControl.GetXByBarIdx(BarsArray[0],index);
         pen=WhereverTheNT7PensAre.Location();
         ts= Instrument.MasterInstrument.TickSize;
      #else
         x= ChartControl.GetXByBarIdx(index);
         pen=ChartControl.ChartControl.BarOutlinePen;
         ts=TickSize;
      #endif
      For that to work I think that a /define NT7 would have to be sent on the command line to the compiler when compiling indicators, but maybe you do it already with another symbol name.

      Comment


        #4
        I edited my post, since I reconsidered your suggestion:

        Next NT7 update will support the pre-compiler switch "NT7" which would allow you doing what you wanted to do. In addition we will amend the code generator which generated the "don't touch" region at the very bottom of the indicator files so
        - you could use NT7 to generate your NT7 and NT6.5 compatible indicators
        - however, you can NOT use NT6.5 to generate NT7 indicators. They will compile in NT7 but will exhibit unexpected behavior in some situations. You should NOT do this.

        Comment


          #5
          OK, thanks very much !

          Comment

          Latest Posts

          Collapse

          Topics Statistics Last Post
          Started by Geovanny Suaza, 02-11-2026, 06:32 PM
          0 responses
          605 views
          0 likes
          Last Post Geovanny Suaza  
          Started by Geovanny Suaza, 02-11-2026, 05:51 PM
          0 responses
          351 views
          1 like
          Last Post Geovanny Suaza  
          Started by Mindset, 02-09-2026, 11:44 AM
          0 responses
          105 views
          0 likes
          Last Post Mindset
          by Mindset
           
          Started by Geovanny Suaza, 02-02-2026, 12:30 PM
          0 responses
          560 views
          1 like
          Last Post Geovanny Suaza  
          Started by RFrosty, 01-28-2026, 06:49 PM
          0 responses
          561 views
          1 like
          Last Post RFrosty
          by RFrosty
           
          Working...
          X