Job finished
Specification
Need help regarding compiling error. Based on csharp language on trading platforms.
using System;
using NinjaTrader.Cbi;
using NinjaTrader.Gui.Tools;
using NinjaTrader.NinjaScript;
using NinjaTrader.NinjaScript.Strategies;
namespace NinjaTrader.NinjaScript.Strategies
{
public class StochasticBot : Strategy
{
private Stochastic stochasticOscillator;
private double volumeInUnits;
protected override void OnStateChange()
{
if (State == State.SetDefaults)
{
Description = "StochasticBot Strategy";
Calculate = Calculate.OnEachTick;
Quantity = 0.01;
takeProfit = 150;
stopLoss = 150;
percentK = 150;
percentKSlow = 150;
percentD = 150;
}
else if (State == State.Configure)
{
stochasticOscillator = Stochastic(percentK, percentKSlow, percentD);
}
}
protected override void OnBarUpdate()
{
if (stochasticOscillator.PercentK[2] < stochasticOscillator.PercentD[2])
{
if (stochasticOscillator.PercentK[0] > stochasticOscillator.PercentD[0])
{
Print(stochasticOscillator.PercentK[0]);
EnterLong("Stochastic Long");
}
}
}
#region Properties
[Range(0.01, double.MaxValue, 0.01)]
[NinjaScriptProperty]
public double Quantity { get; set; }
[Range(4, 1000)]
[NinjaScriptProperty]
public int takeProfit { get; set; }
[Range(4, 1000)]
[NinjaScriptProperty]
public int stopLoss { get; set; }
[Range(4, 1000)]
[NinjaScriptProperty]
public int percentK { get; set; }
[Range(4, 1000)]
[NinjaScriptProperty]
public int percentKSlow { get; set; }
[Range(4, 1000)]
[NinjaScriptProperty]
public int percentD { get; set; }
#endregion
}
}