Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

A lead to convert certain code lines from Nt7 into NT8

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

    A lead to convert certain code lines from Nt7 into NT8

    These questions are about few lines that I have hard time to convert from Nt7 to Nt8 of inside the OnBarUpdate() block of an indicator. Everything else I've been able to convert.

    For all of the following I only need a lead, not a full code, I am aware that even so I am asking a lot.

    - For the indicator I think I may need to change the entire data loading which was using the iBar object, I think it is undocumented and obsolete.
    I had two lines like:
    this.minBar = this.minBars[this.minBars.GetBar(this.firstSessionBegin)];
    this.minBarTime = this.minBarTime.AddMinutes((double)this.barPeriod) ;
    and I am not able to figure out how to go about these.


    Within a function that deals with minutes data loading, I find the following lines in the namespace Indicator:

    - base.Enabled = false; (what did it do in an indicator?)

    - base.Historical

    - if (base.Disposed)

    - if (BarsType.GetInstance(base.Bars.Period.Id).IsIntra day)

    How should I go about for the four lines above?


    I also have the line:
    - this.lastBarTime = base.BarsArray[1][x].Time; I can't understand how to correct the error: double does not contain a definition for Time..


    - backgr.R (back is a System.Windows.Media.SolidColorBrush object), which equivalent could I use since now I work with brushes?

    - I wander why I can't find the documentation of Period, that I find for the following code line:
    new Period(BarsPeriodType.Minute, this.barPeriod, base.Bars.Period.MarketDataType)


    - Is there and equivalent of
    base.ChartControl.Invalidate(true) ?

    - and an equivalent of
    MyBarDateTime = NinjaTrader.Cbi.Globals.MinDate; it says Globals does not exist in NinjaTrader.Cbi

    - I translate the following line
    public System.Windows.Media.SolidColorBrush myColor = Brushes.Empty;
    into
    Brushes myColor = Brushes.Transparent;
    is it generally a good translation??


    Thank you for all your support. I hope this will be useful for others. I searched a lot in the forum prior writing.
    Gio
    Last edited by giogio1; 11-10-2024, 05:59 PM.

    #2
    Hello giogio1,


    this.minBar = this.minBars[this.minBars.GetBar(this.firstSessionBegin)];
    this.minBarTime = this.minBarTime.AddMinutes((double)this.barPeriod) ;
    For these 2 lines you are just using the GetBar method which still exists, you can then add time to a datetime like you are doing.
    ​You could use the bars ago with the Time series to get a time.




    - base.Enabled = false; (what did it do in an indicator?)

    - base.Historical

    - if (base.Disposed)

    - if (BarsType.GetInstance(base.Bars.Period.Id).IsIntra day)​
    Enabled is not documented, I can't provide any suggestion for that.
    Historical is now the State .Historical or State enum.
    Disposed is not necessary.
    You can reference the bars type using Bars.BarsSeries.BarsType


    ​- this.lastBarTime = base.BarsArray[1][x].Time; I can't understand how to correct the error: double does not contain a definition for Time..
    You need to use the Time series if you want to access times, the error is saying you are trying to access a property named Time on a double type variable, doubles do not have a Time property.

    - backgr.R (back is a System.Windows.Media.SolidColorBrush object), which equivalent could I use since now I work with brushes?
    ​This is your own variable, you would need to convert that variable to a Brush for NT8.

    - I wander why I can't find the documentation of Period, that I find for the following code line:
    ​You can find an example of making a BarsPeriod in the tips of the AddDataSeries page.


    base.ChartControl.Invalidate(true) ?
    ​Invalidate should not be used as it can cause freezing, you can queue a refresh using ForceRefresh.


    MyBarDateTime = NinjaTrader.Cbi.Globals.MinDate; it says Globals does not exist in NinjaTrader.Cbi
    ​You can use DateTime.MinValue or DateTime.MaxValue

    - I translate the following line
    public System.Windows.Media.SolidColorBrush myColor = Brushes.Empty;
    into
    Brushes myColor = Brushes.Transparent;
    is it generally a good translation??

    That could be an equivelent, there is no empty brush so using transparent could work.

    Comment


      #3
      Thank you Jesse

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by Geovanny Suaza, 02-11-2026, 06:32 PM
      0 responses
      637 views
      0 likes
      Last Post Geovanny Suaza  
      Started by Geovanny Suaza, 02-11-2026, 05:51 PM
      0 responses
      366 views
      1 like
      Last Post Geovanny Suaza  
      Started by Mindset, 02-09-2026, 11:44 AM
      0 responses
      107 views
      0 likes
      Last Post Mindset
      by Mindset
       
      Started by Geovanny Suaza, 02-02-2026, 12:30 PM
      0 responses
      569 views
      1 like
      Last Post Geovanny Suaza  
      Started by RFrosty, 01-28-2026, 06:49 PM
      0 responses
      572 views
      1 like
      Last Post RFrosty
      by RFrosty
       
      Working...
      X