I tried adding in code to make things work but not sure if this is right. I have bolded the code I added. When compiling, I am getting the error related to turboactivate.cs on line 86 which is code public string VersionGUID { get; }
The error is: 'wyDay.TurboActivate.TurboActivate.VersionGUID.get' must declare a body because it is not marked abstract or extern. Automatically implemented properties must define both get and set accessors.
Here is my code of my indicator
#region Using declarations
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Input;
using System.Windows.Media;
using System.Xml.Serialization;
using NinjaTrader.Cbi;
using NinjaTrader.Gui;
using NinjaTrader.Gui.Chart;
using NinjaTrader.Gui.SuperDom;
using NinjaTrader.Data;
using NinjaTrader.NinjaScript;
using NinjaTrader.Core.FloatingPoint;
using NinjaTrader.NinjaScript.DrawingTools;
using wyDay.TurboActivate;
#endregion
// This namespace holds indicators in this folder and is required. Do not change it.
namespace NinjaTrader.NinjaScript.Indicators
{
public class EMA : Indicator
{
private TurboActivate ta;
private bool isGenuine;
private string productKey;
private double constant1;
private double constant2;
protected override void OnStateChange()
{
if (State == State.SetDefaults)
{
Description = NinjaTrader.Custom.Resource.NinjaScriptIndicatorDescriptionEMA;
Name = NinjaTrader.Custom.Resource.NinjaScriptIndicatorNameEMA;
IsOverlay = true;
IsSuspendedWhileInactive = true;
Period = 14;
AddPlot(Brushes.Goldenrod, NinjaTrader.Custom.Resource.NinjaScriptIndicatorNameEMA);
// Other initialization code... ta = new TurboActivate("Paste GUID Here");
private const uint DaysBetweenChecks = 90;
private const uint GracePeriodLength = 14;
try
{
IsGenuineResult gr = ta.IsGenuine(DaysBetweenChecks, GracePeriodLength, true);
isGenuine = gr == IsGenuineResult.Genuine ||
gr == IsGenuineResult.GenuineFeaturesChanged ||
gr == IsGenuineResult.InternetError;
if (!isGenuine && ta.IsActivated())
{
// Since NinjaTrader doesn't support showing forms, replace this part with suitable code.
// For example, you could disable the indicator functionality here.
Print("The product is not genuine and needs to re-verify with the LimeLM servers.");
}
}
catch (TurboActivateException ex)
{
// Handle the exception. For example, print the error message.
Print("Failed to check if activated: " + ex.Message);
}
// Define your buttons
AddButton("Activate", "Activate License", ActivateLicense);
AddButton("Deactivate", "Deactivate License", DeactivateLicense);
}
else if (State == State.Configure)
{
constant1 = 2.0 / (1 + Period);
constant2 = 1 - (2.0 / (1 + Period));
}
}
protected override void OnBarUpdate()
{
Value[0] = (CurrentBar == 0 ? Input[0] : Input[0] * constant1 + constant2 * Value[1]);
}
private void ActivateLicense()
{
// launch TurboActivate.exe to get the product key from
// the user, and activate.
string documentsPath = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments);
string turboActivateExePath = Path.Combine(documentsPath, @"NinjaTrader 8\bin\Custom\bin\Release\TurboActivate.exe");
Process TAProcess = new Process
{
StartInfo =
{
FileName = Path.Combine(
@"...\NinjaTrader 8\bin\Custom\bin\Release",
"TurboActivate.exe"
)
},
EnableRaisingEvents = true
};
TAProcess.Exited += (sender, e) =>
{
CheckIfActivated();
};
TAProcess.Start();
}
private void DeactivateLicense()
{
if (isGenuine)
{
// deactivate product without deleting the product key
// allows the user to easily reactivate
try
{
ta.Deactivate(false);
}
catch (TurboActivateException ex)
{
Print("Failed to deactivate: " + ex.Message);
return;
}
isGenuine = false;
// ShowTrial(true); // Depends on your trial functionality
}
}
private void CheckIfActivated()
{
bool isNowActivated = false;
try
{
isNowActivated = ta.IsActivated();
}
catch (TurboActivateException ex)
{
Print("Failed to check if activated: " + ex.Message);
return;
}
// recheck if activated
if (isNowActivated)
{
isGenuine = true;
// ReEnableAppFeatures(); // Enable your app features
// ShowTrial(false); // Depends on your trial functionality
}
}
#region Properties
[Range(1, int.MaxValue), NinjaScriptProperty]
[Display(ResourceType = typeof(Custom.Resource), Name = "Product Key", Description = "Enter your product key", Order = 0, GroupName = "NinjaScriptStrategyParameters")]
public string ProductKey
{ get; set; }
[Range(1, int.MaxValue), NinjaScriptProperty]
[Display(ResourceType = typeof(Custom.Resource), Name = "Period", GroupName = "NinjaScriptParameters", Order = 0)]
public int Period
{ get; set; }
#endregion
}
}