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 Belfortbucks, Today, 09:29 PM
        0 responses
        6 views
        0 likes
        Last Post Belfortbucks  
        Started by zstheorist, Today, 07:52 PM
        0 responses
        7 views
        0 likes
        Last Post zstheorist  
        Started by pmachiraju, 11-01-2023, 04:46 AM
        8 responses
        151 views
        0 likes
        Last Post rehmans
        by rehmans
         
        Started by mattbsea, Today, 05:44 PM
        0 responses
        6 views
        0 likes
        Last Post mattbsea  
        Started by RideMe, 04-07-2024, 04:54 PM
        6 responses
        33 views
        0 likes
        Last Post RideMe
        by RideMe
         
        Working...
        X