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

Plotting delta values OnRender

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

    Plotting delta values OnRender

    Hello

    I am trying to learn how OnRender works. I have been reading several code examples and NT Help and it is very useful.

    I have attached a simple indicator that tries to plot Delta Value above every bar. Colors, rectangles, width, etc... is ok but I am not able that Delta value get fixed at the end of bar and start from 0 in next one...

    Any help about this?

    Thanks a lot

    Attached Files

    #2
    Hi Impeesa, thanks for your post.

    Your getting only the latest value for percDeltaPrimary:

    percDeltaPrimary = Convert.ToInt32(barsType.Volumes[CurrentBars[1]].GetDeltaPercent());

    So this value is being rendered to every visible bar on the chart. The script needs to get the Delta Percent value for each bar in the FOR loop. Since the OnRender method is not a data-driven event, you must access the Volumes array within TriggerCustomEvent(). I have another example of using TriggerCustomEvent here.

    Best regards,
    ChrisL
    Chris L.NinjaTrader Customer Service

    Comment


      #3
      Hello Chris

      Thanks for your answer. I have read almost all posts related, your example and also this one. I have tried several combinations but I am not able to get Delta value, "error on calling "onrender" method, index was outside the bounds of array...

      Where do I have to call for Volumetric? OnBarUpdate? OnRender? TriggerCustomEvent?
      (if (Bars == null)
      return;
      NinjaTrader.NinjaScript.BarsTypes.VolumetricBarsTy pe barsType = BarsArray[1].BarsType as NinjaTrader.NinjaScript.BarsTypes.VolumetricBarsTy pe

      Would be different if I only need to plot EMA value bellow every bar, for example?

      Is ther any other sample or indicator to learn about this?

      Sincerely

      Comment


        #4
        Hi Impeesa, thanks for your reply.

        I will not be able to go further in debugging, but you will use TriggerCustomEvent to set in percDeltaPrimary OnRender like so:

        TriggerCustomEvent(o =>
        {
        if (Bars == null)
        return;
        NinjaTrader.NinjaScript.BarsTypes.VolumetricBarsTy pe barsType = BarsArray[1].BarsType as NinjaTrader.NinjaScript.BarsTypes.VolumetricBarsTy pe;
        percDeltaPrimary = Convert.ToInt32(barsType.Volumes[index].GetDeltaPercent());
        }, null);

        Best regards,
        -ChrisL
        Chris L.NinjaTrader Customer Service

        Comment


          #5
          Hello, Chris

          First of all, thanks for your reply. I have not been able to make it works... I will look for more examples this weekend.
          If anybody knows there is a sample that plots a indicator value in every bar, please tell me.

          Sincerely,

          Comment

          Latest Posts

          Collapse

          Topics Statistics Last Post
          Started by bsbisme, Yesterday, 02:08 PM
          1 response
          15 views
          0 likes
          Last Post NinjaTrader_Gaby  
          Started by prdecast, Today, 06:07 AM
          0 responses
          3 views
          0 likes
          Last Post prdecast  
          Started by i019945nj, 12-14-2023, 06:41 AM
          3 responses
          60 views
          0 likes
          Last Post i019945nj  
          Started by TraderBCL, Today, 04:38 AM
          2 responses
          18 views
          0 likes
          Last Post TraderBCL  
          Started by martin70, 03-24-2023, 04:58 AM
          14 responses
          106 views
          0 likes
          Last Post martin70  
          Working...
          X