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

NinjaScript generated code from NT7 to NT8

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

    NinjaScript generated code from NT7 to NT8

    I have defined two inputs inNT7 for indicator "ChanKline". Like: ChanKline(Data.IDataSeries input, int show). the NT7 code is below.

    Then I used NT8 to generated a empty indicator with 2 inputs, which in the second section of below.

    But the issue is once I compile the code in NT8. The program automatically removed the second input "show".

    I do want to use 2 inputs and want to know how to fixed it. thanks.



    Codes in NT7 is below:
    --------------------------------------------------------------------------------------------------------------
    #region NinjaScript generated code. Neither change nor remove.
    // This namespace holds all indicators and is required. Do not change it.
    namespace NinjaTrader.Indicator
    {
    public partial class Indicator : IndicatorBase
    {
    private ChanKline[] cacheChanKline = null;
    private static ChanKline checkChanKline = new ChanKline();

    public ChanKline ChanKline(int show) // input with show
    {
    return ChanKline(Input, show);
    }

    public ChanKline ChanKline(Data.IDataSeries input, int show) // two inputs
    {
    checkChanKline.Show = show;
    show = checkChanKline.Show;
    if (cacheChanKline != null)
    for (int idx = 0; idx < cacheChanKline.Length; idx++)
    if (cacheChanKline[idx].Show == show && cacheChanKline[idx].EqualsInput(input))
    return cacheChanKline[idx];
    ChanKline indicator = new ChanKline();
    indicator.BarsRequired = BarsRequired;
    indicator.CalculateOnBarClose = CalculateOnBarClose;
    indicator.Input = input;
    indicator.Show = show;
    indicator.SetUp();
    ChanKline[] tmp = new ChanKline[cacheChanKline == null ? 1 : cacheChanKline.Length + 1];
    if (cacheChanKline != null)
    cacheChanKline.CopyTo(tmp, 0);
    tmp[tmp.Length - 1] = indicator;
    cacheChanKline = tmp;
    Indicators.Add(indicator);
    return indicator;
    }
    }
    ---------------------------------------------------------------------------------------------


    ------------------------------------------------------------------------------------------
    NT8 generated code for me:

    #region NinjaScript generated code. Neither change nor remove.
    namespace NinjaTrader.NinjaScript.Indicators
    {
    public partial class Indicator : NinjaTrader.Gui.NinjaScript.IndicatorRenderBase
    {
    private ChanKline[] cacheChanKline;
    public ChanKline ChanKline()
    {
    return ChanKline(Input);
    }
    public ChanKline ChanKline(ISeries<double> input, show) // two inputs in beginning, but after compile, the program remove "show".
    {
    if (cacheChanKline != null)
    for (int idx = 0; idx < cacheChanKline.Length; idx++)
    if (cacheChanKline[idx] != null && cacheChanKline[idx].EqualsInput(input))
    return cacheChanKline[idx];
    return CacheIndicator<ChanKline>(new ChanKline(), input, ref cacheChanKline);
    }
    }
    }

    #2
    Hello LadGta2018,

    Thank you for your post.

    Can you attach the .cs file for the indicator in NinjaTrader 8 to your response?

    If you prefer you can send it attached to an email to platformsupport[at]ninjatrader[dot]com with 'ATTN: Patrick H' in the subject line and a reference to this thread in the body of the email.

    I look forward to your response.

    Comment


      #3
      Could you help me about how to define 2 inputs in NT8?

      Comment


        #4
        Hello LadGta2018,

        Thank you for your response.

        Can you detail further if you are referring to user defined parameters as in the example linked below?

        - https://ninjatrader.com/support/help...d_input_pa.htm

        I look forward to your response.

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by cls71, Today, 04:45 AM
        0 responses
        1 view
        0 likes
        Last Post cls71
        by cls71
         
        Started by mjairg, 07-20-2023, 11:57 PM
        3 responses
        213 views
        1 like
        Last Post PaulMohn  
        Started by TheWhiteDragon, 01-21-2019, 12:44 PM
        4 responses
        544 views
        0 likes
        Last Post PaulMohn  
        Started by GLFX005, Today, 03:23 AM
        0 responses
        3 views
        0 likes
        Last Post GLFX005
        by GLFX005
         
        Started by XXtrader, Yesterday, 11:30 PM
        2 responses
        12 views
        0 likes
        Last Post XXtrader  
        Working...
        X