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

VendorLicense

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

    VendorLicense

    I'm having some difficulties to understand the VendorLicense code that I should write in my indicator. Do I have to write it in my indicator code or elsewhere ? How do I call the function VendorLicense.

    The code below has been taken here -->> https://ninjatrader.com/Downloads/Ve...LicenseDemo.cs

    In the code below, let's say I wanna code the indicator named MovingAverage

    Firstly, do I write this code directly in the code of the indicatory that I developed ? Next see the questions in red below.

    //This namespace holds Indicators in this folder and is required. Do not change it.
    namespace NinjaTrader.NinjaScript.Indicators
    {

    public class LicensedIndicatorDemo : Indicator --->> IS IT MY INDICATOR MOVING AVERAGE CLASS OR IS IT FOR THE VENDORLICENSE FUNCTION ??
    {

    // Place your vendor licensing in the default constructor. This guarantees, that your licensing
    // could not be overwritten later by fraudulent hackers who e.g. would derive from your class.
    // Note, that your code only ever should call 'VendorLicense' once.
    public LicensedIndicatorDemo() -->>> IS IT MY INDICATOR MOVING AVERAGE OR A FUNCTION 100% RESERVED TO CALL VendorLicense
    {
    //When no custom configuration is needed, the arguments below will suffice:
    VendorLicense("NT", "Module", "www.your-url.com", "[email protected]",null);

    /*VendorLicense("YourVendorName", "YourProductName", "www.your-url.com", "[email protected]",
    // This optional callback is triggered right before the actual license verification and allows
    // you to delay the configuration.
    // It's defaulted to NULL if not provided. License verification then is triggered as configured above
    () =>
    {
    // The following demonstrates how to set up additional custom configuration for license verification.
    // For example, if you planned to offer the indicator for free for use with indexes only, you could skip
    // the verification process like below:
    if (Instrument.MasterInstrument.InstrumentType == InstrumentType.Index)
    return false;

    // For all other instruments the already configured license verification is triggered.
    return true;
    });*/
    }

    ---->>>>>>>>>>IS THE BELOW SECTION 100% RESERVED TO MY OWN INDICATOR MOVING AVERAGE ??<<<<<<<<<<<<<<<<<<<<<----------


    protected override void OnStateChange()
    {
    if (State == State.SetDefaults)
    {
    Description = @"This is a demo for how to properly apply the vendor licensing";
    Name = "LicensedIndicatorDemo";
    Calculate = Calculate.OnBarClose;
    IsOverlay = false;
    DisplayInDataBox = true;
    DrawOnPricePanel = true;
    DrawHorizontalGridLines = true;
    DrawVerticalGridLines = true;
    PaintPriceMarkers = true;
    ScaleJustification = NinjaTrader.Gui.Chart.ScaleJustification.Right;
    //Disable this property if your indicator requires custom values that cumulate with each new market data event.
    //See Help Guide for additional information.
    IsSuspendedWhileInactive = true;
    AddPlot(Brushes.Orange, "Plot1");
    }
    else if (State == State.Configure)
    {
    }
    }

    protected override void OnBarUpdate()
    {
    Values[0][0] = (High[0] - Low[0]) + High[0];
    }

    region Properties

    [Browsable(false)]
    [XmlIgnore]
    public Series<double> Plot1
    {
    get { return Values[0]; }
    }
    #endregion

    }
    }

    #2
    Hello mktforecast,

    Your indicator class name will be the class name of your indicator and not 'LicensedIndicatorDemo' which is the name of the demo indicator you were provided.

    The class name will reflect the name of the indicator. The example indicator you were provided is named 'LicensedIndicatorDemo'.

    The VendorLicense() method call will be in the Constructor of the class.

    Code:
    namespace NinjaTrader.NinjaScript.Indicators        <-- this is the namespace path the MyClassName class is within the scope of.
    {
    public class MyClassName : Indicator                <-- this is the declaration of the class of the indicator, it inherits from Indicator.​
    {
    public MyClassName()                                <-- this is the constructor for the class
    {
    // code run when class is constructed here          <-- this is where the VendorLicense() call goes, in the class constructor
    }
    }
    }
    Below is a link to a 3rd party educational site on how C# works and demonstrates a class constructor.
    W3Schools offers free online tutorials, references and exercises in all the major languages of the web. Covering popular subjects like HTML, CSS, JavaScript, Python, SQL, Java, and many, many more.


    As well as a link to the Microsoft documentation on the class constructor.
    https://learn.microsoft.com/en-us/do...s/constructors
    Last edited by NinjaTrader_ChelseaB; 11-16-2022, 08:11 AM.
    Chelsea B.NinjaTrader Customer Service

    Comment


      #3
      Thank you Chelsea I now understand where the VendorLicense call goes.

      However, I'm wondering if my indicator code goes in the public MyClassName or below.

      namespace NinjaTrader.NinjaScript.Indicators <-- this is the namespace path the MyClassName class is within the scope of.
      {
      public class MyClassName : Indicator <-- this is the declaration of the class of the indicator, it inherits from Indicator.​
      {

      public MyClassName() <-- this is the constructor for the class
      {
      // code run when class is constructed here <-- this is where the VendorLicense() call goes, in the class constructor
      }


      Then I put my code here outside of the MyClassName() ????


      }
      }​

      Comment


        #4
        Hello mktforecast,

        Yes, other methods should not be in the constructor.

        OnStateChange() should be within the scope of the class.

        OnBarUpdate() should be within the scope of the class.

        Have a look at the ADL (or any indicator) included with NinjaTrader to see where methods are placed in the class.
        Chelsea B.NinjaTrader Customer Service

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by ETFVoyageur, Yesterday, 06:05 PM
        6 responses
        36 views
        0 likes
        Last Post ETFVoyageur  
        Started by rbeckmann05, Today, 02:35 PM
        1 response
        2 views
        0 likes
        Last Post NinjaTrader_BrandonH  
        Started by cmtjoancolmenero, 04-29-2024, 03:40 PM
        13 responses
        41 views
        0 likes
        Last Post NinjaTrader_Jesse  
        Started by Torontobluejays, Yesterday, 08:43 AM
        6 responses
        32 views
        0 likes
        Last Post rc5781
        by rc5781
         
        Started by rbeckmann05, Today, 02:33 PM
        1 response
        2 views
        0 likes
        Last Post NinjaTrader_Jesse  
        Working...
        X