• If this is your first visit, you will have to register before you can post. To view messages, please scroll below and select the forum that you would like to visits. Questions? Be sure to check out the Forum FAQ.

Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Color variable not being initialized if Indicator is included in a Template

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

    Color variable not being initialized if Indicator is included in a Template

    I have an indicator which has a parameter that is a Color type.
    Everything works as expected when that indicator is added to the chart through the Indicators selection dialog. However, if that indicator is saved
    as part of a template and then that template is used as the default Chart Template when opening a new chart, then the variable which is supposed to be initialized to a Color is NOT initalized.

    I have attached a simple indicator to demonstrate. Note that the variables are given inital values just like the wizard does.
    The indicator simply prints to the output window the value of the variables.

    To reproduce the bug:
    -Save the indicator as part of a template.
    -Open the output window.
    -Open a chart with the template as the default.
    -You will see in the output that the value of the color variable is empty.
    -There are other variables, (an int and a double) that clearly have their values initialized correctly.

    I believe this is some kind of bug that the color field is not being initialized like other variables are.

    -Gary
    Attached Files

    #2
    You need to serialize the color.

    See here - http://www.ninjatrader-support.com/v...ead.php?t=4977
    RayNinjaTrader Customer Service

    Comment


      #3
      Ray, thanks for the solution.

      Can I take a moment to point out that this is one of several issues I have
      run across in my learning curve to pick up NinjaScript where the
      documentation is not adequate. I could not find anything describing why
      serialization for parms was required. Keep in mind, I would not know what
      to search the forums for.
      (BTW, I don't think forums are the best way to organize your
      knoweldge base and make it easy for developers to learn.)

      Other examples of issues I needed doc for:
      - In the OnOrderUpdate method, what are the rules for knowing what bar
      is being referred by Close[0]?
      - More info is needed to describe the timing of all the various callbacks
      NT can make.
      - I have seen code that overrides some lower level paint method (I forget
      exact name) but I did not see any doc on why you might care to do this
      and rules to follow if you did
      (code that needs to be done for the method to work right, etc).

      It is hard to learn these 'NT software architecture' concepts from a help system meant for people using the trading platform.

      I like the platform and think you guys have done a great job, but trying
      to learn what it takes to use the NinjaScript well should not be so hard.

      Keep up the good work.

      Regards,
      Gary

      Comment


        #4
        Thanks for your comments.

        - Close[0] always refers to the current bar (Close[1] would refer to 1 bar ago)
        - Not sure what you mean about timing of call backs but if you are referring to the sequence of how they are called --> I would never rely on any consistent order in which they may be triggered. Code your stratey in a away that accounts for randomness
        - You don't see help since this is not overriding plot method is not officially supported
        RayNinjaTrader Customer Service

        Comment


          #5
          Hello,
          I have the same problem but this link doesn't work.
          Could you help me with another reference?

          Thanks!
          Carmen

          Comment


            #6
            Originally posted by casoch View Post
            Hello,
            I have the same problem but this link doesn't work.
            Could you help me with another reference?

            Thanks!
            Carmen
            From the Tips Sub-Forum: http://www.ninjatrader.com/support/f...ead.php?t=4977
            Last edited by koganam; 12-18-2013, 09:44 AM.

            Comment

            Latest Posts

            Collapse

            Topics Statistics Last Post
            Started by abfefmu, Today, 05:33 AM
            0 responses
            1 view
            0 likes
            Last Post abfefmu
            by abfefmu
             
            Started by bbdjad, Today, 04:36 AM
            0 responses
            4 views
            0 likes
            Last Post bbdjad
            by bbdjad
             
            Started by mittie3, Today, 03:33 AM
            0 responses
            7 views
            0 likes
            Last Post mittie3
            by mittie3
             
            Started by Againmain1, Today, 03:04 AM
            0 responses
            8 views
            0 likes
            Last Post Againmain1  
            Started by tonytimpa, Today, 01:33 AM
            0 responses
            5 views
            0 likes
            Last Post tonytimpa  
            Working...
            X