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

latest ninjatrader update breaks inchimoku indicator

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

    latest ninjatrader update breaks inchimoku indicator

    Hi,

    I am not getting this indicator to work now, the ichimoku one, it says Error on calling "onStateChange method" value cannot be null Parameter name: render Target"

    Please help.
    Attached Files

    #2
    Hello KhaosTrader,

    Thanks for opening the thread.

    Creating brushes is recommended to be done in OnRenderTargetChanged(). I don't see the purpose of having any of that code within State.Historical. As the code to create the brushes already exists in OnRenderTargetChanged() I don't see the need in using State.Historical at all.

    The only other thing done in State.Historical is to change opacity, which is already done in the user parameter code for the brushes.

    When I remove the code for State.Historical the indicator works fine for me.

    You can reference some examples for creating brushes and performing custom rendering here: http://ninjatrader.com/support/forum...144#post509144

    As recreating brushes is to be done in OnRenderTargetChanged(), I will link the documentation as well: https://ninjatrader.com/support/help...getchanged.htm

    Please let me know if you have any additional questions.
    JimNinjaTrader Customer Service

    Comment


      #3
      The code of the indicator confuses the brushes and declares them everywhere. To fix it please proceed as follows

      (1) First declare a brush "upAreaBrush" in the variables section. The value for this brush can be set in the properties region. You do not wnat to change the opacity of this brush.

      (2) Second declare a brush "upAreaBrushShaded" in the variables section. Do not set a default value in the variables section, but you can

      -> clone the value of upAreaBrush and set it to upAreaBrushShaded
      -> then set the opacity for upAreaBrushShaded
      -> then freeze upAreaBrushShaded

      All this needs to be done within State == State.Configure (not in State == State.Historical)

      (3) Do not set any values for upAreaBrushDX in the OnStateChange() section. It does not belong here.

      Declare upAreaBrushDX in OnRender() and also dispose of it in OnRender(). And everything should work as expected.

      Comment


        #4
        I was able to follow Jim's directions and it seemed to make the script work. Although the signals looked a little strange. However, when I tried to load indicators into a Market Analyzer column this script caused a crash.

        I attempted to follow Harry's instructions but I simply couldn't get it right. I'm far too new to this.

        Any chance that the repaired code could be posted for this? It would help me out in the short term but also show me what I am doing wrong.

        Thank you.

        Comment


          #5
          The problem can be resolved by inserting one statement in the existing code as follows:

          ...
          }
          else if (State == State.Historical)
          {
          // insert the following statement
          if(RenderTarget == null)
          return;

          To minimize future coding pitfall, a better way is to enclose the existing codes as follows:
          ...
          else if (State == State.Historical)
          {
          if(RenderTarget != null)
          {
          ...
          }
          }
          The updated file is uploaded to the Indicator section. I have added two integer series for external access of the signal and strength, which are shown in the variable definition sections.
          Last edited by kkc2015; 06-19-2017, 05:39 PM.

          Comment

          Latest Posts

          Collapse

          Topics Statistics Last Post
          Started by bmartz, 03-12-2024, 06:12 AM
          5 responses
          32 views
          0 likes
          Last Post NinjaTrader_Zachary  
          Started by Aviram Y, Today, 05:29 AM
          4 responses
          13 views
          0 likes
          Last Post Aviram Y  
          Started by algospoke, 04-17-2024, 06:40 PM
          3 responses
          28 views
          0 likes
          Last Post NinjaTrader_Jesse  
          Started by gentlebenthebear, Today, 01:30 AM
          1 response
          8 views
          0 likes
          Last Post NinjaTrader_Jesse  
          Started by cls71, Today, 04:45 AM
          1 response
          7 views
          0 likes
          Last Post NinjaTrader_ChelseaB  
          Working...
          X