1. I don't seem to be able to execute an edited version of a script. If I edit/ save a script and then run it, the prior, unedited version is run instead.
2. I'm trying to add an indicator to a script -- SMA plotted in the price pane in this example and am pasting a piece of code with the following compilation error:
"An object reference is required for the non-static field, method, or property
'NinjaTrader.Strategy.Strategy.SMA (NinjaTrader.Data.IDataSeries, int)' ".
Thank you !
#region Using declarations
using System;
using System.ComponentModel;
using System.Diagnostics;
using System.Drawing;
using System.Drawing.Drawing2D;
using System.Xml.Serialization;
using NinjaTrader.Cbi;
using NinjaTrader.Data;
using NinjaTrader.Indicator;
using NinjaTrader.Gui.Chart;
using NinjaTrader.Strategy;
#endregion
// This namespace holds all strategies and is required. Do not change it.
namespace NinjaTrader.Strategy
{
/// <summary>
/// Enter the description of your strategy here
/// </summary>
[Description("Enter the description of your strategy here")]
public class Hello : Strategy
{
#region Variables
// Wizard generated variables
private int myInput0 = 1; // Default setting for MyInput0
// User defined variables (add any user defined variables below)
#endregion
/// <summary>
/// This method is used to configure the strategy and is called once before any strategy method is called.
/// </summary>
/** ************************************************** ************************* */
protected override void Initialize()
{
CalculateOnBarClose = true;
}
/// <summary>
/// Called on each bar update event (incoming tick)
/// </summary>
public double value = SMA(High, 20)[0];
protected override void OnBarUpdate( )
{
Print("The current SMA value is " + value.ToString());
}
#region Properties
[Description("")]
[GridCategory("Parameters")]
public int MyInput0
{
get { return myInput0; }
set { myInput0 = Math.Max(1, value); }
}
#endregion
}
}
Comment