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

Indicator Draw Dots Disapear

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

    Indicator Draw Dots Disapear

    I have and indicator saved in a chart template and when I load the chart the draw dots do not show up, it resets the color to empty and I have to go in and manually change the colors back each time I load a chart... why is this happening? I need the indicator and it's maddening...

    Thanks for any help

    #2
    I think the problem in code maybe here? The Color.Empty lines?

    DrawDot(CurrentBar.ToString(), 0, currDotValue, currDotColor);
    DrawText("dot"+CurrentBar.ToString(), true, dotText, 0, currDotValue, yPixels, currDotColor, pfont,
    StringAlignment.Center, Color.Empty, Color.Empty, 10) ;

    Comment


      #3
      Originally posted by tshirtdeal View Post
      I think the problem in code maybe here? The Color.Empty lines?

      DrawDot(CurrentBar.ToString(), 0, currDotValue, currDotColor);
      DrawText("dot"+CurrentBar.ToString(), true, dotText, 0, currDotValue, yPixels, currDotColor, pfont,
      StringAlignment.Center, Color.Empty, Color.Empty, 10) ;
      I presume that currDotColor is a user-input?

      In that case you have to serialize the color, in order for it to be saved with the template. Do a forum search for "serialize color", with or without the quotes, and you should find out how to do so.

      Comment


        #4
        Hi tshirtdeal,

        Are there any error messages in log tab of control center? If it's serialization as Koganam suggests, the following post can help with serializing color inputs.

        Ryan M.NinjaTrader Customer Service

        Comment


          #5
          Thanks for the help...

          There are no errors in the log... Do I simply add the serialization as a code snippet?

          Thanks!
          R.T.

          Comment


            #6
            If there are issues with serialization, there will be errors in the log tab of the control center. I would first isolate one problem to solve at a time with one line of code.

            From the first post there are essentially two issues with your two lines of code:
            Dots don't display
            Color preferences don't save in a template.

            Use only one of those draw statements at a time until you know which is contributing to what problem. Please let us know if you would like assistance once you've narrowed it down to a specific line of code with a specific problem.
            Ryan M.NinjaTrader Customer Service

            Comment


              #7
              Okay, i changed this part of the code :
              {
              currDotValue = Low[1];
              currDotColor = SupportColor;

              To....

              {
              currDotValue = Low[1];
              currDotColor = Color.Red;

              and now it saves the color in chart templates and works, but I have to go into the code whenever I want to change the color, no biggie but perhaps you see an easy complete fix such as creating a default "SupportColor" in the script?

              Thanks for the help,
              R.T.

              Comment


                #8
                Yeah, for custom color inputs use this link here as a guide:


                It's fairly straightforward. You have to setup the properties section just like the sample for the serialization.

                Variables:
                Declare currDotColor in variables region and assign an initial value.
                Code:
                private color currDotColor = Color.Red;
                Properties region:
                Link the lower case color to an Uppercase one that's displayed in your indicator parameters.
                Code:
                [XmlIgnore()]
                [Description("Color for painted region")]
                [GridCategory("Parameters")]
                public Color CurrDotColor
                {
                get { return currDotColor ; }
                set { currDotColor  = value; }
                }
                Add the serialization lines:


                Code:
                [Browsable(false)]
                public string PaintColorSerialize
                {
                     get { return NinjaTrader.Gui.Design.SerializableColor.ToString(currDotColor); }
                     set { currDotColor = NinjaTrader.Gui.Design.SerializableColor.FromString(value); }
                }
                Then can use it in OnBarUpdate() with CurrDotColor.
                Ryan M.NinjaTrader Customer Service

                Comment

                Latest Posts

                Collapse

                Topics Statistics Last Post
                Started by geddyisodin, 04-25-2024, 05:20 AM
                8 responses
                61 views
                0 likes
                Last Post NinjaTrader_Gaby  
                Started by jxs_xrj, 01-12-2020, 09:49 AM
                4 responses
                3,288 views
                1 like
                Last Post jgualdronc  
                Started by Option Whisperer, Today, 09:55 AM
                0 responses
                5 views
                0 likes
                Last Post Option Whisperer  
                Started by halgo_boulder, 04-20-2024, 08:44 AM
                2 responses
                22 views
                0 likes
                Last Post halgo_boulder  
                Started by mishhh, 05-25-2010, 08:54 AM
                19 responses
                6,189 views
                0 likes
                Last Post rene69851  
                Working...
                X