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

Loading a template

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

    Loading a template

    It appears to me that when I load a template into a chart, my custom indicator has Initialize() and OnStartUp() called, however some of the configuration parameters are not set as they were when the template was saved.

    It appears that some of the parameters are set to their default values. Why would that be? Is that by design, or is something wrong?


    -- EV
    Last edited by ETFVoyageur; 03-01-2011, 06:42 PM.

    #2
    I have looked further into this, and it appears that not everything is saved in the template. I have attached a screen shot of the Indicators dialog, showing all of the configuration parameters. I have also appended the proprieties for the missing values and the relevant part of the XML file for the template. Notice that the following are in the screen shot, but not in the XML:
    • Parameters section: Line width, Dash style
    • Inner Band Parameters: Transparency
    • Outer Band Parameters: Transparency

    All of the others are fine.

    ----- Properties for the missing values below here (they look fine to me) -----
    [XmlIgnore()]
    [Description("Moving average line width")]
    [GridCategory("\t\t\t\tParameters")]
    [Gui.Design.DisplayNameAttribute("\t\t\t. Line width")]
    public int IndicatorWidth
    {
    get { return indicatorWidth; }
    set { indicatorWidth = Math.Max(1, value); }
    }

    [XmlIgnore()]
    [Description("Moving average line dash style")]
    [GridCategory("\t\t\t\tParameters")]
    [Gui.Design.DisplayNameAttribute("\t. Dash style")]
    public DashStyle DStyle
    {
    get { return dStyle; }
    set { dStyle = value; }
    }

    [XmlIgnore()]
    [Description("Transparency of the inner band background. Smaller numbers are more transparent.")]
    [GridCategory("\t\t\tInner Band Parameters")]
    [Gui.Design.DisplayNameAttribute("\t\tTransparency" )]
    public int InnerBandTransparency
    {
    get { return innerBandTransparency; }
    set { innerBandTransparency = Math.Max(0, value); }
    }

    [XmlIgnore()]
    [Description("Transparency of the outer band background. Smaller numbers are more transparent.")]
    [GridCategory("\t\tOuter Band Parameters")]
    [Gui.Design.DisplayNameAttribute("\t\tTransparency" )]
    public int OuterBandTransparency
    {
    get { return outerBandTransparency; }
    set { outerBandTransparency = Math.Max(0, value); }
    }


    ----- XML below here -----
    <PlotsConfigurable>false</PlotsConfigurable>
    <ScaleJustification>Right</ScaleJustification>
    <SelectedSeries>0</SelectedSeries>
    <SessionBreakLines>true</SessionBreakLines>
    <VerticalGridLines>true</VerticalGridLines>
    <ZOrder>10007</ZOrder>
    <WhichIndicator>T3</WhichIndicator>
    <Period>63</Period>
    <HorizontalDisplacement>10</HorizontalDisplacement>
    <WhichSmoothType>None</WhichSmoothType>
    <NumberOfSmoothBars>5</NumberOfSmoothBars>
    <DollarShift>0</DollarShift>
    <WhichColorType>SignalLine</WhichColorType>
    <SignalBars>3</SignalBars>
    <ChangeFactor>1</ChangeFactor>
    <BullColorSerialize>n:Green</BullColorSerialize>
    <BearColorSerialize>n:IndianRed</BearColorSerialize>
    <PlainColorSerialize>narkGray</PlainColorSerialize>
    ==> Line width should be here <===
    ==> Dash style should be here <===
    <InnerBandType>None</InnerBandType>
    <InnerBandWidth>1</InnerBandWidth>
    <InnerBandColorSerialize>n:Silver</InnerBandColorSerialize>
    ==> Transparency should be here <===
    <OuterBandType>None</OuterBandType>
    <OuterBandWidth>2</OuterBandWidth>
    <OuterBandColorSerialize>n:LightGray</OuterBandColorSerialize>
    ==> Transparency should be here <===
    <KamaFast>2</KamaFast>
    <KamaPeriod>10</KamaPeriod>
    <KamaSlow>30</KamaSlow>
    <T3Count>1</T3Count>
    <T3vFactor>0.7</T3vFactor>
    <VmaPeriod>9</VmaPeriod>
    <VmaVolatilityPeriod>9</VmaVolatilityPeriod>
    <ZiPeriod>21</ZiPeriod>
    <ZiCycle>4</ZiCycle>
    <ZiCoeff>3</ZiCoeff>
    <ZLagEmaLength>20</ZLagEmaLength>
    <ZLagEmaGainLimit>50</ZLagEmaGainLimit>
    Attached Files

    Comment


      #3
      Remove those [XmlIgnore()] tags. I know that is definitely needed for Plots and Time structures. They are probably needed for some other things, but except for those 2, you always want to start out without the directive, then add it if defaults are not saved when you reload the template. IOW, go the other way. Except for the 2 that I have discovered absolutely need it, I always start without [XmlIgnore()].
      Last edited by koganam; 04-04-2011, 11:36 AM.

      Comment


        #4
        That does it. Thanks.

        I had never really paid attention to what XmlIgnore did -- just cut-and-paste and did not think about it. On doing a little searching in response to your message, it appears it should be used for anything that is not a fundamental data type, because you need to arrange special serialization for any of them that you want saved.

        Thus, do use for DataSeries, color, pen, time, any other struct, but not for most parameters.

        Thanks for pointing me in the right direction.

        --EV
        Last edited by ETFVoyageur; 03-01-2011, 08:59 PM.

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by usazencort, Today, 01:16 AM
        0 responses
        1 view
        0 likes
        Last Post usazencort  
        Started by kaywai, 09-01-2023, 08:44 PM
        5 responses
        603 views
        0 likes
        Last Post NinjaTrader_Jason  
        Started by xiinteractive, 04-09-2024, 08:08 AM
        6 responses
        22 views
        0 likes
        Last Post xiinteractive  
        Started by Pattontje, Yesterday, 02:10 PM
        2 responses
        21 views
        0 likes
        Last Post Pattontje  
        Started by flybuzz, 04-21-2024, 04:07 PM
        17 responses
        230 views
        0 likes
        Last Post TradingLoss  
        Working...
        X