Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

AddRenko() breaks code

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

    AddRenko() breaks code

    i currently try to use a multtimeframe for renkobars but when i include the nessesary AddRenko everything seems to break.
    Code:
            protected override void Initialize()
            {
                Overlay                = true;
                AddRenko(Instrument.MasterInstrument.Name,100,MarketDataType.Last);
                CalculateOnBarClose = true;
            }
    
    
            protected override void OnBarUpdate()
            {
                Print("1");
                if (BarsInProgress == 1){    
                    Print("2");
                }
                if (BarsInProgress == 0){
                    Print("3");
                }
            }
    to figure out whats goin on i got rid of nearly all code. running the above code, i didnt get any prints. however by just removing the AddRenko line, i was able to get 1 and 3 prints as expected.
    i also tried refering to the instrument by simply AddRenko("EURUSD",...) but same thing.

    help?!
    Last edited by BigRo; 12-17-2015, 12:25 PM.

    #2
    Hello BigRo,

    Thank you for your inquiry.

    Please utilize Instrument.FullName rather than Instrument.MasterInstrument.Name.

    Utilizing Instrument.MasterInstrument.Name does not return the full name of the instrument ($EURUSD). You can see this in your Log tab in the Control Center.

    Please, let us know if we may be of further assistance.
    Zachary G.NinjaTrader Customer Service

    Comment


      #3
      I created an indicator using the Gomi Volume ladder on a 10 range chart. I would like to display this indicator on a renko chart but still do ther calculations based on the 10 range chart.

      In the OnStartUp() method I previously had:

      objGomVolumeLadder = GomVolumeLadder();

      The gomi ladder also has an additional constructor where we can pass a dataseries:

      objGomVolumeLadder = GomVolumeLadder(tenRangeSeries);

      Where tenRangeSeries is a dataseries created in the Initialize() method:

      Add(PeriodType.Range, 10);

      tenRangeSeries = new DataSeries(this);


      In OnBarUpdate() I have the following code to populate the dataseries but the indicator is not displaying indicating an error with the approach.

      if (BarsInProgress == 1)
      return;


      tenRangeSeries.Set(BarsArray[1][0]);

      //other processing here

      Comment


        #4
        Hello mballagan,

        Thank you for writing in.

        You'll want to ensure that you have at least 1 range bar before setting it to your tenRangeSeries.

        Example:
        Code:
        if (CurrentBars[1] < 0) return; // we're using 0 as CurrentBar starts at 0 for the first bar and increments by one for each new bar: http://ninjatrader.com/support/helpGuides/nt7/?currentbar.htm
        
        tenRangeSeries.Set(BarsArray[1][0]);
        More information about checking tosee that you have enough bars in the DataSeries you are accessing can be found here: http://ninjatrader.com/support/forum...ead.php?t=3170
        Zachary G.NinjaTrader Customer Service

        Comment


          #5
          Thanks Zachary.

          Also my code uses FirstTickOfBar in the OnBarUpdate() method. Is there a way to reference a second dataseries using this method such as FirstTickOfBar[1] or Bars[1].FirstTickOfBar?

          Comment


            #6
            Hello mballagan,

            You'll need to check for FirstTickOfBar for the secondary series with the BarsInProgress check.

            Code:
            protected override void OnBarUpdate()
            {
                 if (BarsInProgress == 1) // if the secondary series called OnBarUpdate()
                 {
                      if (FirstTickOfBar) // do something if it's the FirstTickOfBar for the secondary series
                      {
                           // do something
                      }
                 }
            }
            Zachary G.NinjaTrader Customer Service

            Comment

            Latest Posts

            Collapse

            Topics Statistics Last Post
            Started by Geovanny Suaza, 02-11-2026, 06:32 PM
            0 responses
            574 views
            0 likes
            Last Post Geovanny Suaza  
            Started by Geovanny Suaza, 02-11-2026, 05:51 PM
            0 responses
            333 views
            1 like
            Last Post Geovanny Suaza  
            Started by Mindset, 02-09-2026, 11:44 AM
            0 responses
            101 views
            0 likes
            Last Post Mindset
            by Mindset
             
            Started by Geovanny Suaza, 02-02-2026, 12:30 PM
            0 responses
            553 views
            1 like
            Last Post Geovanny Suaza  
            Started by RFrosty, 01-28-2026, 06:49 PM
            0 responses
            551 views
            1 like
            Last Post RFrosty
            by RFrosty
             
            Working...
            X