Announcement

Collapse

Looking for a User App or Add-On built by the NinjaTrader community?

Visit NinjaTrader EcoSystem and our free User App Share!

Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
See more
See less

Partner 728x90

Collapse

Periodtype.Renko

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

    Periodtype.Renko

    I am experimenting with multi-time frame code ...which works for tick, range, minute, but not for Renko. Below I have listed a very simple piece of code that works with (PeriodType.Range,4) .....but will not work with (PeriodType.Renko,4).

    private int cntr = 0;

    protected override void Initialize()
    {
    CalculateOnBarClose = true;
    Add(PeriodType.Range, 4); // BarsInProgress index = 1
    }

    protected override void OnBarUpdate()
    {
    if (BarsInProgress == 1 )
    {
    if (CurrentBar < 1) return;
    cntr ++;
    }
    //--------------------------------
    if (BarsInProgress == 0)
    {
    if (CurrentBar < 1 ) return;
    DrawText("cntr"+CurrentBar, cntr.ToString(),0,High[0],Color.Black);
    }
    }

    I have no idea why this works with everything except Renko...

    Thanks...........

    #2
    Hello,

    Thanks for the forum post.

    The reason this occurs is that you need to use AddRenko() instead for these special bar type.



    I look forward to assisting you further.

    Comment


      #3
      Great!!

      Thanks so much for the fast reply....(and on a weekend no less!!!)

      Ninja support never sleeps

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by CortexZenUSA, Today, 12:53 AM
      0 responses
      1 view
      0 likes
      Last Post CortexZenUSA  
      Started by CortexZenUSA, Today, 12:46 AM
      0 responses
      1 view
      0 likes
      Last Post CortexZenUSA  
      Started by usazencortex, Today, 12:43 AM
      0 responses
      5 views
      0 likes
      Last Post usazencortex  
      Started by sidlercom80, 10-28-2023, 08:49 AM
      168 responses
      2,265 views
      0 likes
      Last Post sidlercom80  
      Started by Barry Milan, Yesterday, 10:35 PM
      3 responses
      12 views
      0 likes
      Last Post NinjaTrader_Manfred  
      Working...
      X