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

Customized indicator does not get saved in template

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

    Customized indicator does not get saved in template

    I used the built-in HMA indicator as the basis for a customized version that I saved with a different name. I added code to color the indicator line according to the slope and also code to enable the user to select colors for the slopes. I placed three of these indicators on a chart as well as an EMA, then saved it as a template. I was surprised when I opened a new chart and applied the template that ONLY the EMA was displayed. I checked the template file and indeed, only the EMA was included.

    I then returned to the original chart and added the built-in HMA and saved this as a template. Once again, when applying the template to another chart, only the EMA and the built-in HMA were displayed, and the template file contained ONLY those two indicators.

    So why does my custom indicator work fine when selected from the Indicators list, but does not get included in the template?

    EDIT
    I see the log says error generating the XML document, so probably serialization problem. Will recheck the code.
    Last edited by DrDave; 11-13-2019, 08:22 AM.

    #2
    Hello DrDave,

    Thank you for your post.

    I've tested this with a few custom indicators and as of yet haven't been able to replicate it.

    If you're seeing an error generating the XML document, you're right, I would look at serialization. If you're not able to figure out where it's coming from, I'd be happy to take a look at the code if you're comfortable posting it.

    Thanks in advance; I look forward to assisting you further.
    Kate W.NinjaTrader Customer Service

    Comment


      #3
      Originally posted by DrDave View Post
      I used the built-in HMA indicator as the basis for a customized version that I saved with a different name. I added code to color the indicator line according to the slope and also code to enable the user to select colors for the slopes. I placed three of these indicators on a chart as well as an EMA, then saved it as a template. I was surprised when I opened a new chart and applied the template that ONLY the EMA was displayed. I checked the template file and indeed, only the EMA was included.

      I then returned to the original chart and added the built-in HMA and saved this as a template. Once again, when applying the template to another chart, only the EMA and the built-in HMA were displayed, and the template file contained ONLY those two indicators.

      So why does my custom indicator work fine when selected from the Indicators list, but does not get included in the template?

      EDIT
      I see the log says error generating the XML document, so probably serialization problem. Will recheck the code.
      RESOLVED
      I was adding two custom colored brushes in Region Properties. The serialization example begins with
      [XmlIgnore]
      I assumed this would be in effect for all following code, but it is not. I began the code for the second brush without [XmlIgnore] and the indicator is not saved in the template and errors were found recorded in the log file. Simply adding [XmlIgnore] as the first line of code for the second brush definition fixed it.

      Comment


        #4
        Hello DrDave,

        Thank you for your reply.

        I'm glad to hear you were able to locate the cause of the serialization issue and get it squared away. Thanks for posting your resolution for other users that may run into the same thing!

        Please let us know if we may be of further assistance to you.
        Kate W.NinjaTrader Customer Service

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by algospoke, 04-17-2024, 06:40 PM
        6 responses
        49 views
        0 likes
        Last Post algospoke  
        Started by arvidvanstaey, Today, 02:19 PM
        4 responses
        11 views
        0 likes
        Last Post arvidvanstaey  
        Started by samish18, 04-17-2024, 08:57 AM
        16 responses
        61 views
        0 likes
        Last Post samish18  
        Started by jordanq2, Today, 03:10 PM
        2 responses
        9 views
        0 likes
        Last Post jordanq2  
        Started by traderqz, Today, 12:06 AM
        10 responses
        21 views
        0 likes
        Last Post traderqz  
        Working...
        X