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
}
}
Comment